Replies: 2 comments 1 reply
-
One thing you could do is have a fixture what depends on the other ones: import pytest
@pytest.fixture
def create_a():
print("create a")
@pytest.fixture
def create_b():
print("create b")
@pytest.fixture
def db_objects(create_a, create_b):
print("committing")
def test_db(db_objects):
pass If you wanted the db to be prepared like that for all tests, you could also make |
Beta Was this translation helpful? Give feedback.
1 reply
-
I believe that a runtest_setup trylast hook with some terrifying magic is necessary to sort this stuff out |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is there some way to run certain code after all the fixtures have been created but before the test code itself is run?
For example I have a number of fixtures that create DB objects and would like to call
commit()
after they are created but before the test itself is run. I could just call commit at the end of each fixture but that slows down the test set up.Beta Was this translation helpful? Give feedback.
All reactions