Skip to content

Commit

Permalink
run pytest using a temp home directory
Browse files Browse the repository at this point in the history
  • Loading branch information
indirectlylit committed Apr 19, 2019
1 parent f3e3139 commit 0128f13
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ build_tools/crowdin-cli.jar

# Ignore pytest cache directory
.pytest_cache/
.pytest_kolibri_home

# ignore source font files
*.ttf
Expand Down
14 changes: 14 additions & 0 deletions kolibri/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import os
import shutil

import pytest

# referenced in pytest.ini
TEMP_KOLIBRI_HOME = "./.pytest_kolibri_home"


@pytest.fixture(scope="session", autouse=True)
def global_fixture():
yield # wait until the test ended
if os.path.exists(TEMP_KOLIBRI_HOME):
shutil.rmtree(TEMP_KOLIBRI_HOME)
3 changes: 3 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ django_find_project = false
DJANGO_SETTINGS_MODULE = kolibri.deployment.default.settings.test
# Settings for pytest-pythonpath
python_paths = kolibri/dist
env =
# cleaned up in conftest.py fixture
KOLIBRI_HOME=./.pytest_kolibri_home
1 change: 1 addition & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ mixer==6.0.1
pytest==3.7.1 # pyup: < 4.0.0
pytest-cov==2.5.1
pytest-django==3.3.3
pytest-env==0.6.2
pytest-pythonpath==0.7.2
sh==1.12.14

0 comments on commit 0128f13

Please sign in to comment.