--- you can reply above this line --- New issue 190: Naming test methods "setup" causes different behavior https://bitbucket.org/hpk42/pytest/issue/190/naming-test-methods-setup-causes-different
Alex Okrushko: depending on the name of the setup-method the behavior is completely different: 1-st scenario: {{{ #!python class TestMyProp(object): @pytest.setup(scope = "class") def stp(self): self.prop = "init" print self.prop def test_prop(self): TestMyProp.prop = "changed" print self.prop def test_prop_again(self): print self.prop }}} OUTPUT: py.test -sq {{{ #!output ============================= test session starts ============================== platform win32 -- Python 2.7.3 -- pytest-2.3.0.dev15 collecting ... collected 2 items my_test.py init changed .changed . =========================== 2 passed in 0.01 seconds =========================== }}} This is the expected result. NOW change the name of the method to "setup": {{{ #!python class TestMyProp(object): @pytest.setup(scope = "class") def setup(self): self.prop = "init" print self.prop def test_prop(self): TestMyProp.prop = "changed" print self.prop def test_prop_again(self): print self.prop }}} and the output becomes: {{{ #!output ============================= test session starts ============================== platform win32 -- Python 2.7.3 -- pytest-2.3.0.dev15 collecting ... collected 2 items my_test.py init init init .init init . =========================== 2 passed in 0.02 seconds =========================== }}} -- This is an issue notification from bitbucket.org. You are receiving this either because you are the owner of the issue, or you are following the issue. _______________________________________________ py-dev mailing list py-dev@codespeak.net http://codespeak.net/mailman/listinfo/py-dev