-
-
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
4 changed files
with
64 additions
and
4 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
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,13 @@ | ||
$ pytest -qqs test_functions.py | ||
|
||
setup_db <TemporaryDirectory '/tmp/tmppjc3h7k2'> | ||
test_one <TemporaryDirectory '/tmp/tmppjc3h7k2'> | ||
test_one after | ||
teardown_db <TemporaryDirectory '/tmp/tmppjc3h7k2'> | ||
setup_db <TemporaryDirectory '/tmp/tmp_0j_gnnb'> | ||
test_two <TemporaryDirectory '/tmp/tmp_0j_gnnb'> | ||
setup_db <TemporaryDirectory '/tmp/tmpl3gvod_3'> | ||
test_three <TemporaryDirectory '/tmp/tmpl3gvod_3'> | ||
test_three after | ||
teardown_db <TemporaryDirectory '/tmp/tmpl3gvod_3'> | ||
|
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,34 @@ | ||
import tempfile | ||
|
||
def test_one(): | ||
db = setup_db() | ||
print(f" test_one {db}") | ||
assert True | ||
print(" test_one after") | ||
teardown_db(db) | ||
|
||
def test_two(): | ||
db = setup_db() | ||
print(f" test_two {db}") | ||
assert False | ||
print(" test_two after") | ||
teardown_db(db) | ||
|
||
def test_three(): | ||
db = setup_db() | ||
print(f" test_three {db}") | ||
assert True | ||
print(" test_three after") | ||
teardown_db(db) | ||
|
||
def setup_db(): | ||
db = tempfile.TemporaryDirectory() | ||
... | ||
print(f"setup_db {db}") | ||
return db | ||
|
||
def teardown_db(db): | ||
... | ||
print(f"teardown_db {db}") | ||
|
||
|
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