@@ -904,3 +904,47 @@ def test_second(foo):
904
904
testdir .makepyfile (test_file )
905
905
rr = testdir .run (sys .executable , "-m" , "pytest" , "-v" , * cmd_opts )
906
906
assert_outcomes (rr , {"passed" : 2 })
907
+
908
+
909
+ def test_inlinecallbacks_method_with_fixture_gets_self (testdir , cmd_opts ):
910
+ test_file = """
911
+ import pytest
912
+ import pytest_twisted
913
+ from twisted.internet import defer
914
+
915
+ @pytest.fixture
916
+ def foo():
917
+ return 37
918
+
919
+ class TestClass:
920
+ @pytest_twisted.inlineCallbacks
921
+ def test_self_isinstance(self, foo):
922
+ d = defer.succeed(None)
923
+ yield d
924
+ assert isinstance(self, TestClass)
925
+ """
926
+ testdir .makepyfile (test_file )
927
+ rr = testdir .run (sys .executable , "-m" , "pytest" , "-v" , * cmd_opts )
928
+ assert_outcomes (rr , {"passed" : 1 })
929
+
930
+
931
+ def test_inlinecallbacks_method_with_fixture_gets_fixture (testdir , cmd_opts ):
932
+ test_file = """
933
+ import pytest
934
+ import pytest_twisted
935
+ from twisted.internet import defer
936
+
937
+ @pytest.fixture
938
+ def foo():
939
+ return 37
940
+
941
+ class TestClass:
942
+ @pytest_twisted.inlineCallbacks
943
+ def test_self_isinstance(self, foo):
944
+ d = defer.succeed(None)
945
+ yield d
946
+ assert foo == 37
947
+ """
948
+ testdir .makepyfile (test_file )
949
+ rr = testdir .run (sys .executable , "-m" , "pytest" , "-v" , * cmd_opts )
950
+ assert_outcomes (rr , {"passed" : 1 })
0 commit comments