Created
October 18, 2020 16:38
-
-
Save tjkhara/20c64cafb57d28350edae28e727925e1 to your computer and use it in GitHub Desktop.
Fixture scope
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.fixture(scope="session", autouse=True) | |
| def setupSession(): | |
| print("\nSetup Session") | |
| @pytest.fixture(scope="module", autouse=True) | |
| def setupModule(): | |
| print("\nSetup Module") | |
| @pytest.fixture(scope="function", autouse=True) | |
| def setupFunction(): | |
| print("\nSetup Function") | |
| def test1(): | |
| print("Executing test 1") | |
| assert True | |
| def test2(): | |
| print("Executing test 2") | |
| assert True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment