Skip to content

Using tmpdir in session scoped fixture changes the fixture to be function scoped #659

Closed
@pytestbot

Description

@pytestbot

Originally reported by: Torsten Landschoff (BitBucket: bluehorn, GitHub: bluehorn)


Running the attached tests gives

$ py.test -q --tb=short test_cached_mkdtemp.py
..
2 passed in 0.03 seconds

as expected, but doing the same using tmpdir I get

$ py.test -q --tb=short test_cached_tmpdir.py
.E
==================================== ERRORS ====================================
______________________ ERROR at setup of test_property_b _______________________
test_cached_tmpdir.py:21: in scenario_prototype
    return ScenarioPrototype(tmpdir.join("prototype"))
test_cached_tmpdir.py:40: in __init__
    assert ScenarioPrototype.instantiation_count <= 1
E   assert 2 <= 1
E    +  where 2 = ScenarioPrototype.instantiation_count
------------------------------- Captured stdout --------------------------------
Creating scenario prototype in /tmp/pytest-89/test_property_b0/prototype
1 passed, 1 error in 0.03 seconds

Tested with pytest 2.6.4 and pytest 2.5.1. I would have expected both to behave identically.


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