From: Denis Laxalde Date: Sun, 14 Nov 2021 16:15:10 +0000 (+0100) Subject: Configure pytest warning control in pyproject.toml X-Git-Tag: 3.0.4~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0588c13ff901502a422d2fd47627e640d7b37b2f;p=thirdparty%2Fpsycopg.git Configure pytest warning control in pyproject.toml This reduces duplication and makes the configuration available when testing outside CI. --- diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 64db3430f..f5771a66c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -65,27 +65,23 @@ jobs: - name: Run tests (Python implementation) if: ${{ matrix.impl == 'python' }} - # The zoneinfo warning ignore is only required on Python 3.6 run: > tox -c psycopg -e ${{ matrix.python }} -- - --color yes -W error - -W ignore::DeprecationWarning:backports.zoneinfo._common + --color yes - name: Run tests (C implementation) if: ${{ matrix.impl == 'c' }} # skip tests failing on importing psycopg_c.pq on subprocess # they only fail on Travis, work ok locally under tox too. - # The zoneinfo warning ignore is only required on Python 3.6 run: > tox -c psycopg_c -e ${{ matrix.python }} -- - --color yes -W error -m 'not subprocess' - -W ignore::DeprecationWarning:backports.zoneinfo._common + --color yes -m 'not subprocess' - name: Run DNS-related tests if: ${{ matrix.impl == 'dns' }} run: > tox -c psycopg -e dns -- - --color yes -W error -m dns + --color yes -m dns env: PSYCOPG_IMPL: python @@ -93,7 +89,7 @@ jobs: if: ${{ matrix.impl == 'postgis' }} run: > tox -c psycopg -e postgis -- - --color yes -W error -m postgis + --color yes -m postgis env: PSYCOPG_IMPL: python @@ -158,18 +154,15 @@ jobs: - name: Run tests (Python implementation) if: ${{ matrix.impl == 'python' }} - # The zoneinfo warning ignore is only required on Python 3.6 run: > tox -c psycopg -e ${{ matrix.python }} -- - --color yes -W error - -W ignore::DeprecationWarning:backports.zoneinfo._common + --color yes - name: Run tests (C implementation) if: ${{ matrix.impl == 'c' }} run: > tox -c psycopg_c -e ${{ matrix.python }} -- - --color yes -W error - -W ignore::DeprecationWarning:backports.zoneinfo._common + --color yes # }}} @@ -216,11 +209,9 @@ jobs: - name: Run tests (Python implementation) if: ${{ matrix.impl == 'python' }} - # The zoneinfo warning ignore is only required on Python 3.6 run: > tox -c psycopg -e ${{ matrix.python }} -- - --color yes -W error - -W ignore::DeprecationWarning:backports.zoneinfo._common + --color yes # Build a wheel package of the C extensions. # If the wheel is not delocated, import fails with some dll not found @@ -244,9 +235,7 @@ jobs: &"pip" install @(Get-ChildItem wheelhouse\*.whl) # Fix the path for the tests using ctypes $env:Path = "C:\Program Files\PostgreSQL\14\bin\;$env:Path" - # The zoneinfo warning ignore is only required on Python 3.6 - pytest --color yes -W error ` - -W ignore::DeprecationWarning:backports.zoneinfo._common + pytest --color yes # }}} diff --git a/pyproject.toml b/pyproject.toml index 0eab38027..19ee39359 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,6 +6,11 @@ build-backend = "setuptools.build_meta" line-length = 79 [tool.pytest.ini_options] +filterwarnings = [ + "error", + # The zoneinfo warning ignore is only required on Python 3.6 + "ignore::DeprecationWarning:backports.zoneinfo._common", +] testpaths=[ "tests", ]