Created
May 29, 2013 10:27
-
-
Save RonnyPfannschmidt/5669369 to your computer and use it in GitHub Desktop.
example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pytest | |
| pytest_plugins = 'pytester' | |
| @pytest.fixture | |
| def testdir(testdir): | |
| testdir.foo = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % 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 =========================== |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def test(testdir): | |
| assert testdir.foo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
however it does work if -p pytester is passed