diff options
author | 2022-11-23 12:16:42 -0800 | |
---|---|---|
committer | 2022-11-23 12:16:42 -0800 | |
commit | 0ff39f6cef7d889cc2e14918d65ffaaf05efec6f (patch) | |
tree | 786ee6288cd0a7e02bd5480a1d12972bf8ccd796 /manage.py | |
parent | Use 4 spaces as tab (diff) | |
parent | Merge pull request #800 from python-discord/dependabot/pip/httpx-0.23.1 (diff) |
Merge branch 'main' into discordpy-error-handling
Diffstat (limited to 'manage.py')
-rwxr-xr-x | manage.py | 14 |
1 files changed, 12 insertions, 2 deletions
@@ -7,6 +7,7 @@ from pathlib import Path import django from django.contrib.auth import get_user_model from django.core.management import call_command, execute_from_command_line +from django.test.utils import ignore_warnings DEFAULT_ENVS = { "DJANGO_SETTINGS_MODULE": "pydis_site.settings", @@ -154,7 +155,16 @@ class SiteManager: def run_tests(self) -> None: """Prepare and run the test suite.""" self.prepare_environment() - call_command(*sys.argv[1:]) + # The whitenoise package expects a staticfiles directory to exist during startup, + # else it raises a warning. This is fine under normal application, but during + # tests, staticfiles are not, and do not need to be generated. + # The following line suppresses the warning. + # Reference: https://github.com/evansd/whitenoise/issues/215 + with ignore_warnings( + message=r"No directory at: .*staticfiles", + module="whitenoise.base", + ): + call_command(*sys.argv[1:]) def clean_up_static_files(build_folder: Path) -> None: @@ -185,7 +195,7 @@ def main() -> None: # Pass any others directly to standard management commands else: - _static_build = "distill" in sys.argv[1] + _static_build = len(sys.argv) > 1 and "distill" in sys.argv[1] if _static_build: # Build a static version of the site with no databases and API support |