diff --git a/.build.yml b/.build.yml index 6b4bce7..31ab756 100644 --- a/.build.yml +++ b/.build.yml @@ -1,13 +1,23 @@ image: archlinux packages: - docker + - python-pip + - python-virtualenv sources: - https://git.sr.ht/~crocmagnon/blog secrets: - 2da6ddc6-3d12-4306-a1e4-8268c6194386 - 29bc352f-0807-46e9-a4ef-2f869f94afa3 - 5c948915-48c2-4542-8fc1-a5676f4d7126 +environment: + TESTING: true tasks: + - test: | + python --version + cd blog + virtualenv venv + venv/bin/python -m pip install -r requirements.txt -r requirements-dev.txt --progress-bar off + venv/bin/python -m pytest - setup_docker: | chmod +x ./blog/docker/setup-docker ./blog/docker/setup-docker diff --git a/blog/settings.py b/blog/settings.py index f85c602..d68e737 100644 --- a/blog/settings.py +++ b/blog/settings.py @@ -26,6 +26,7 @@ SECRET_KEY = os.getenv( # SECURITY WARNING: don't run with debug turned on in production! DEBUG = os.getenv("DEBUG", "true").lower() == "true" +TESTING = os.getenv("TESTING", "true").lower() == "true" ALLOWED_HOSTS = [ "localhost", @@ -130,7 +131,14 @@ USE_TZ = True STATIC_URL = "/static/" STATIC_ROOT = BASE_DIR / "static" -STATICFILES_STORAGE = "django.contrib.staticfiles.storage.ManifestStaticFilesStorage" +if TESTING: + # ManifestStaticFilesStorage requires collectstatic to be run + # and collectstatic is not run for tests + STATICFILES_STORAGE = "django.contrib.staticfiles.storage.StaticFilesStorage" +else: + STATICFILES_STORAGE = ( + "django.contrib.staticfiles.storage.ManifestStaticFilesStorage" + ) AUTH_USER_MODEL = "articles.User"