diff --git a/docker/entrypoint-integration-tests.sh b/docker/entrypoint-integration-tests.sh index 0044d0b5b9..5a75ed6b5b 100755 --- a/docker/entrypoint-integration-tests.sh +++ b/docker/entrypoint-integration-tests.sh @@ -29,6 +29,9 @@ export CHROMEDRIVER CHROME_PATH=/opt/chrome/chrome export CHROME_PATH +# We are strict about Warnings during testing +export PYTHONWARNINGS=error + # Run available unittests with a simple setup # All available Integrationtest Scripts are activated below # If successsful, A successs message is printed and the script continues diff --git a/docker/entrypoint-unit-tests-devDocker.sh b/docker/entrypoint-unit-tests-devDocker.sh index e2c63c04fd..96f9906c17 100755 --- a/docker/entrypoint-unit-tests-devDocker.sh +++ b/docker/entrypoint-unit-tests-devDocker.sh @@ -15,6 +15,9 @@ unset DD_DATABASE_URL # Unset the celery broker URL so that we can force the other DD_CELERY_BROKER settings unset DD_CELERY_BROKER_URL +# We are strict about Warnings during testing +export PYTHONWARNINGS=error + python3 manage.py makemigrations dojo python3 manage.py migrate diff --git a/docker/entrypoint-unit-tests.sh b/docker/entrypoint-unit-tests.sh index 99062aff8a..16a5e6c29b 100755 --- a/docker/entrypoint-unit-tests.sh +++ b/docker/entrypoint-unit-tests.sh @@ -16,6 +16,9 @@ unset DD_DATABASE_URL # Unset the celery broker URL so that we can force the other DD_CELERY_BROKER settings unset DD_CELERY_BROKER_URL +# We are strict about Warnings during testing +export PYTHONWARNINGS=error + # TARGET_SETTINGS_FILE=dojo/settings/settings.py # if [ ! -f ${TARGET_SETTINGS_FILE} ]; then # echo "Creating settings.py" diff --git a/dojo/settings/settings.dist.py b/dojo/settings/settings.dist.py index d8eec52a74..0c13170e74 100644 --- a/dojo/settings/settings.dist.py +++ b/dojo/settings/settings.dist.py @@ -7,6 +7,7 @@ from netaddr import IPNetwork, IPSet import json import logging +import warnings logger = logging.getLogger(__name__) @@ -1714,3 +1715,12 @@ def saml2_attrib_map_format(dict): AUDITLOG_FLUSH_RETENTION_PERIOD = env('DD_AUDITLOG_FLUSH_RETENTION_PERIOD') ENABLE_AUDITLOG = env('DD_ENABLE_AUDITLOG') USE_FIRST_SEEN = env('DD_USE_FIRST_SEEN') + +# TODO - these warnings needs to be removed +if DEBUG: + from django.utils.deprecation import RemovedInDjango50Warning + warnings.filterwarnings("ignore", category=RemovedInDjango50Warning) + warnings.filterwarnings("ignore", message="invalid escape sequence.*") + warnings.filterwarnings("ignore", message="'cgi' is deprecated and slated for removal in Python 3\\.13") + warnings.filterwarnings("ignore", message="DateTimeField .+ received a naive datetime .+ while time zone support is active\\.") + warnings.filterwarnings("ignore", message="unclosed file .+") diff --git a/tests/base_test_class.py b/tests/base_test_class.py index b9ccf35290..b5d041d349 100644 --- a/tests/base_test_class.py +++ b/tests/base_test_class.py @@ -90,6 +90,14 @@ def setUpClass(cls): print( "starting chromedriver with options: ", vars(dd_driver_options), desired ) + + # TODO - this filter needs to be removed + import warnings + warnings.filterwarnings("ignore", message="executable_path has been deprecated, please pass in a Service object") + warnings.filterwarnings("ignore", message="use options instead of chrome_options") + warnings.filterwarnings("ignore", message="desired_capabilities has been deprecated, please pass in a Service object") + warnings.filterwarnings("ignore", message="It is deprecated to return a value that is not None from a test case") + dd_driver = webdriver.Chrome( os.environ["CHROMEDRIVER"], chrome_options=dd_driver_options,