Created
October 18, 2020 16:51
-
-
Save tjkhara/f68ad1d181c7ab0a82bfdb515840d942 to your computer and use it in GitHub Desktop.
Fixtures - passing data
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 | |
| # The text fixture and unit test are both run once for each value | |
| # specified in the params list | |
| @pytest.fixture(params=[1,2,3]) | |
| def setup(request): | |
| retVal = request.param | |
| print(f"\nSetup! retVal={retVal}") | |
| return retVal | |
| def test1(setup): | |
| print(f"\n setup = {setup}") | |
| assert True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment