-
-
Notifications
You must be signed in to change notification settings - Fork 163
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #132 from kobotoolbox/refactoring
Refactoring to improved readibility
- Loading branch information
Showing
18 changed files
with
2,090 additions
and
1,964 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,34 @@ | ||
# coding: utf-8 | ||
import os | ||
import pytest | ||
|
||
# Python retro compatibility | ||
try: | ||
FileNotFoundError | ||
except NameError: | ||
FileNotFoundError = OSError | ||
|
||
|
||
def clean_up(): | ||
""" | ||
Removes files created by tests | ||
""" | ||
files = ['.uniqid', | ||
'upsert_db_users'] | ||
for file_ in files: | ||
try: | ||
os.remove(os.path.join('/tmp', file_)) | ||
except FileNotFoundError: | ||
pass | ||
|
||
|
||
@pytest.fixture(scope="session", autouse=True) | ||
def setup(request): | ||
# Clean up before tests begin in case of orphan files. | ||
clean_up() | ||
request.addfinalizer(_tear_down) | ||
|
||
|
||
def _tear_down(): | ||
clean_up() | ||
pass |
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
Oops, something went wrong.