Skip to content

funcarg/fixture uses a different reference to object #203

Closed
@pytestbot

Description

@pytestbot

Originally reported by: eduardo schettino (BitBucket: schettino72, GitHub: schettino72)


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.


Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions