@@ -665,16 +665,16 @@ async def test_doubleincrement(doubleincrement):
665
665
def test_blockon_in_hook (testdir , cmd_opts , request ):
666
666
skip_if_reactor_not (request , "default" )
667
667
conftest_file = """
668
- import pytest_twisted as pt
668
+ import pytest_twisted
669
669
from twisted.internet import reactor, defer
670
670
671
671
def pytest_configure(config):
672
- pt .init_default_reactor()
672
+ pytest_twisted .init_default_reactor()
673
673
d1, d2 = defer.Deferred(), defer.Deferred()
674
674
reactor.callLater(0.01, d1.callback, 1)
675
675
reactor.callLater(0.02, d2.callback, 1)
676
- pt .blockon(d1)
677
- pt .blockon(d2)
676
+ pytest_twisted .blockon(d1)
677
+ pytest_twisted .blockon(d2)
678
678
"""
679
679
testdir .makeconftest (conftest_file )
680
680
test_file = """
@@ -710,18 +710,18 @@ def test_succeed():
710
710
def test_blockon_in_hook_with_qt5reactor (testdir , cmd_opts , request ):
711
711
skip_if_reactor_not (request , "qt5reactor" )
712
712
conftest_file = """
713
- import pytest_twisted as pt
713
+ import pytest_twisted
714
714
import pytestqt
715
715
from twisted.internet import defer
716
716
717
717
def pytest_configure(config):
718
- pt .init_qt5_reactor()
718
+ pytest_twisted .init_qt5_reactor()
719
719
d = defer.Deferred()
720
720
721
721
from twisted.internet import reactor
722
722
723
723
reactor.callLater(0.01, d.callback, 1)
724
- pt .blockon(d)
724
+ pytest_twisted .blockon(d)
725
725
"""
726
726
testdir .makeconftest (conftest_file )
727
727
test_file = """
@@ -812,20 +812,20 @@ def test_blockon_in_hook_with_asyncio(testdir, cmd_opts, request):
812
812
skip_if_reactor_not (request , "asyncio" )
813
813
conftest_file = """
814
814
import pytest
815
- import pytest_twisted as pt
815
+ import pytest_twisted
816
816
from twisted.internet import defer
817
817
818
818
@pytest.hookimpl(tryfirst=True)
819
819
def pytest_configure(config):
820
- pt ._use_asyncio_selector_if_required(config=config)
820
+ pytest_twisted ._use_asyncio_selector_if_required(config=config)
821
821
822
- pt .init_asyncio_reactor()
822
+ pytest_twisted .init_asyncio_reactor()
823
823
d = defer.Deferred()
824
824
825
825
from twisted.internet import reactor
826
826
827
827
reactor.callLater(0.01, d.callback, 1)
828
- pt .blockon(d)
828
+ pytest_twisted .blockon(d)
829
829
"""
830
830
testdir .makeconftest (conftest_file )
831
831
test_file = """
@@ -996,3 +996,19 @@ async def test_self_isinstance(self, foo):
996
996
testdir .makepyfile (test_file )
997
997
rr = testdir .run (* cmd_opts , timeout = timeout )
998
998
assert_outcomes (rr , {"passed" : 1 })
999
+
1000
+
1001
+ def test_import_pytest_twisted_in_conftest_py_not_a_problem (testdir , cmd_opts ):
1002
+ conftest_file = """
1003
+ import pytest_twisted
1004
+ """
1005
+ testdir .makeconftest (conftest_file )
1006
+ test_file = """
1007
+ import pytest_twisted
1008
+
1009
+ def test_succeed():
1010
+ pass
1011
+ """
1012
+ testdir .makepyfile (test_file )
1013
+ rr = testdir .run (* cmd_opts , timeout = timeout )
1014
+ assert_outcomes (rr , {"passed" : 1 })
0 commit comments