Turn on deprecation warnings in CI

This commit is contained in:
Kovid Goyal 2021-06-24 10:20:19 +05:30
parent 785d74bda4
commit 009e82c9df
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 11 additions and 1 deletions

View File

@ -28,6 +28,9 @@ jobs:
python setup/unix-ci.py bootstrap python setup/unix-ci.py bootstrap
- name: Test calibre - name: Test calibre
env:
PYTHONWARNINGS: error
CALIBRE_SHOW_DEPRECATION_WARNINGS: 1
run: run:
python setup/unix-ci.py test python setup/unix-ci.py test
@ -56,6 +59,9 @@ jobs:
run: runuser -u ci -- python setup.py bootstrap --ephemeral --debug --sanitize run: runuser -u ci -- python setup.py bootstrap --ephemeral --debug --sanitize
- name: Test calibre - name: Test calibre
env:
PYTHONWARNINGS: error
CALIBRE_SHOW_DEPRECATION_WARNINGS: 1
run: | run: |
set -xe set -xe
runuser -u ci -- python setup.py test --under-sanitize runuser -u ci -- python setup.py test --under-sanitize

View File

@ -34,7 +34,11 @@ class TestImports(unittest.TestCase):
full_module_name = full_module_name.rpartition('.')[0] full_module_name = full_module_name.rpartition('.')[0]
if full_module_name in exclude_modules or ('.' in full_module_name and full_module_name.rpartition('.')[0] in exclude_packages): if full_module_name in exclude_modules or ('.' in full_module_name and full_module_name.rpartition('.')[0] in exclude_packages):
continue continue
importlib.import_module(full_module_name) try:
importlib.import_module(full_module_name)
except DeprecationWarning:
if 'dbus_export' not in full_module_name and 'dbus_service' not in full_module_name:
raise
count += 1 count += 1
return count return count