Skip to content

fix blockon forrever lock#24

Merged
vtitor merged 1 commit into
pytest-dev:masterfrom
ybilopolov:master
Mar 8, 2018
Merged

fix blockon forrever lock#24
vtitor merged 1 commit into
pytest-dev:masterfrom
ybilopolov:master

Conversation

@ybilopolov

Copy link
Copy Markdown
Contributor

After last update second call to blockon will lock forever as reactor in greenlet is already running. This PL fixes the issue.

@vtitor

vtitor commented Mar 8, 2018

Copy link
Copy Markdown
Member

@ybilopolov Thanks for this!

@vtitor vtitor merged commit 9e20653 into pytest-dev:master Mar 8, 2018

@altendky altendky left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is _config.external_reactor referring to the use of qt5reactor as being 'external'? Or to the user having created a reactor without using the provided fixture?

Comment thread testing/test_basic.py
reactor.callLater(0.01, d.callback, 1)
reactor.callLater(0.02, d2.callback, 1)
pt.blockon(d)
pt.blockon(d)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intentionally blocking on d twice and ignoring d2?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just typo, thanks for noticing

@ybilopolov

Copy link
Copy Markdown
Contributor Author

@altendky, _config.external_reactor is referring to the case when pytest itself is being run in a thread inside a running twisted application, so that we can't and don't need to run another reactor in a greenlet, but should use blockingCallFromThread instead. test_pytest_from_reactor_thread is an example of such case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants