Browse Source

run pytest using a temp home directory

pull/5392/head
Devon Rueckner 3 years ago
parent
commit
0128f1351a
  1. 1
      .gitignore
  2. 14
      kolibri/conftest.py
  3. 3
      pytest.ini
  4. 1
      requirements/test.txt

1
.gitignore

@ -120,6 +120,7 @@ build_tools/crowdin-cli.jar
# Ignore pytest cache directory
.pytest_cache/
.pytest_kolibri_home
# ignore source font files
*.ttf

14
kolibri/conftest.py

@ -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
pytest.ini

@ -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
requirements/test.txt

@ -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

Loading…
Cancel
Save