[py-dev] [hpk42/pytest] funcarg/fixture uses a different reference to object (issue #203)

eduardo schettino issues-reply at bitbucket.org
Fri Oct 19 23:17:26 CEST 2012


--- you can reply above this line ---

New issue 203: funcarg/fixture uses a different reference to object
https://bitbucket.org/hpk42/pytest/issue/203/funcarg-fixture-uses-a-different-reference

eduardo schettino:

Something like this (using old funcargs) used to work on 2.2
but now fails on 2.3.

    #!python
    import pytest

    class TestClass:
        @pytest.fixture()
        def my_setup(self, request):
            self.foo = True

        def test_method1(self, my_setup):
           assert self.foo


The object instance used to run the test is different from
the instance used to calculate the value of the fixture.
So modification to "self" in the fixture are lost.





--

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.



More information about the Pytest-dev mailing list