From 86297627b33bdef804e48293fe8c18a7629eab34 Mon Sep 17 00:00:00 2001 From: gchqdev227 <62302861+gchqdev227@users.noreply.github.com> Date: Fri, 16 May 2025 15:09:33 +0100 Subject: [PATCH 1/2] Added set up and tear down logic to ignore the botocore UTC deprecation warnings --- tests/test_examples.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_examples.py b/tests/test_examples.py index af1bcab..987b871 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -11,6 +11,7 @@ import unittest import unittest.mock import urllib.parse +import warnings try: from dateutil.tz import tzlocal @@ -35,6 +36,16 @@ from examples.xkcd import ComicVersion, XKCDResource +def setUpModule() -> None: + """Code to run before any single test in the module is run.""" + warnings.filterwarnings("ignore", category=DeprecationWarning, module="botocore.auth") + + +def tearDownModule() -> None: + """Code to run after every single test in the module has been run.""" + warnings.filterwarnings("default", category=DeprecationWarning, module="botocore.auth") + + class MockedTextResponse: """ Represents a mocked requests.Response object containing a body. From ea33cd37581598bd4f55aafc1daaba8c393568a8 Mon Sep 17 00:00:00 2001 From: gchqdev227 <62302861+gchqdev227@users.noreply.github.com> Date: Fri, 16 May 2025 15:11:13 +0100 Subject: [PATCH 2/2] Unit test actions will now fail on deprecation warnings --- .github/workflows/unit-tests.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml index 9172014..4d59d51 100644 --- a/.github/workflows/unit-tests.yaml +++ b/.github/workflows/unit-tests.yaml @@ -27,4 +27,4 @@ jobs: python -m pip install -r requirements-tests.txt --no-deps - name: Run tests run: | - python -m unittest discover . + python -W error -m unittest --verbose