Skip to content

Instantly share code, notes, and snippets.

@dnephin
Created November 18, 2015 22:42
Show Gist options
  • Save dnephin/b55565ef1921c8070a1c to your computer and use it in GitHub Desktop.
Save dnephin/b55565ef1921c8070a1c to your computer and use it in GitHub Desktop.
py.test autouse session fixture in conftest.py
import pytest
@pytest.fixture(autouse=True, scope='session')
def doit_global():
print "GOOOOOD"
import unittest
class TestSomething(unittest.TestCase):
def test_something(self):
assert True
@dnephin
Copy link
Author

dnephin commented Nov 18, 2015

If I run py.test -vs tests/file_test.py I see GOOOOOD printed

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