-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
69 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"color": "Red", | ||
"pid": 2997265, | ||
"size": "42" | ||
} |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Fixture before test using apple | ||
Test using apple | ||
Fixture after test using apple | ||
|
||
Fixture before test using banana | ||
Test not using param | ||
Fixture after test using banana | ||
|
7 changes: 7 additions & 0 deletions
7
python/examples/pytest/test_parametrized_injection_fixture.out
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Fixture before test using apple | ||
Test using apple | ||
Fixture after test using apple | ||
Fixture before test using banana | ||
Test not using param | ||
Fixture after test using banana | ||
|
20 changes: 20 additions & 0 deletions
20
python/examples/pytest/test_parametrized_injection_fixture.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import os | ||
import pathlib | ||
import time | ||
import pytest | ||
|
||
|
||
@pytest.fixture(params=["name"]) | ||
def generate(name): | ||
print(f"Fixture before test using {name}") | ||
yield | ||
print(f"Fixture after test using {name}") | ||
|
||
@pytest.mark.parametrize("name", ["apple"]) | ||
def test_with_param(name, generate): | ||
print(f"Test using {name}") | ||
|
||
@pytest.mark.parametrize("name", ["banana"]) | ||
def test_without_param(generate): | ||
print(f"Test not using param") | ||
|
This file contains 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