Created
October 18, 2020 16:13
-
-
Save tjkhara/36bcab86a2400a228e9372dbc1bc41af to your computer and use it in GitHub Desktop.
setup and tear down in functions
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
| 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