Skip to content

Instantly share code, notes, and snippets.

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

  • Save tjkhara/36bcab86a2400a228e9372dbc1bc41af to your computer and use it in GitHub Desktop.

Select an option

Save tjkhara/36bcab86a2400a228e9372dbc1bc41af to your computer and use it in GitHub Desktop.
setup and tear down in functions
def setup_module(module):
print("\nSetup module")
def teardown_module(module):
print("\nTeardown module")
def setup_function(function):
if function == test1:
print("\nSetting up test 1")
elif function == test2:
print("\nSetting up test 2")
else:
print("\nSetting up unknown test")
def teardown_function(function):
if function == test1:
print("\n Tearing down test 1")
elif function == test2:
print("\n Tearing down test 2")
else:
print("\nTearing down unknown test")
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