Skip to content

Instantly share code, notes, and snippets.

@tjkhara
Created October 18, 2020 16:38
Show Gist options
  • Select an option

  • Save tjkhara/20c64cafb57d28350edae28e727925e1 to your computer and use it in GitHub Desktop.

Select an option

Save tjkhara/20c64cafb57d28350edae28e727925e1 to your computer and use it in GitHub Desktop.
Fixture scope
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