Skip to content

Instantly share code, notes, and snippets.

@RonnyPfannschmidt
Created May 29, 2013 10:27
Show Gist options
  • Save RonnyPfannschmidt/5669369 to your computer and use it in GitHub Desktop.
Save RonnyPfannschmidt/5669369 to your computer and use it in GitHub Desktop.
example
import pytest
pytest_plugins = 'pytester'
@pytest.fixture
def testdir(testdir):
testdir.foo = 1
% py.test --tb=short
============================= test session starts =============================
platform linux2 -- Python 2.7.3 -- pytest-2.3.5.dev16
plugins: boxed, xdist, codecheckers, couchdbkit, cov
collected 1 items
test_foo.py F
================================== FAILURES ===================================
____________________________________ test _____________________________________
/home/ronny/foo/test_foo.py:4: in test
> assert testdir.foo
E AttributeError: TmpTestdir instance has no attribute 'foo'
========================== 1 failed in 0.07 seconds ===========================
def test(testdir):
assert testdir.foo
@RonnyPfannschmidt
Copy link
Author

however it does work if -p pytester is passed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment