From 009e82c9dfe86e963fd1bbb14f7cecaa219dcd57 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 24 Jun 2021 10:20:19 +0530 Subject: [PATCH] Turn on deprecation warnings in CI --- .github/workflows/ci.yml | 6 ++++++ setup/test.py | 6 +++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f623ec72d2..c3f3b8f814 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,6 +28,9 @@ jobs: python setup/unix-ci.py bootstrap - name: Test calibre + env: + PYTHONWARNINGS: error + CALIBRE_SHOW_DEPRECATION_WARNINGS: 1 run: python setup/unix-ci.py test @@ -56,6 +59,9 @@ jobs: run: runuser -u ci -- python setup.py bootstrap --ephemeral --debug --sanitize - name: Test calibre + env: + PYTHONWARNINGS: error + CALIBRE_SHOW_DEPRECATION_WARNINGS: 1 run: | set -xe runuser -u ci -- python setup.py test --under-sanitize diff --git a/setup/test.py b/setup/test.py index 3c1fd16ff7..f9fe9d569b 100644 --- a/setup/test.py +++ b/setup/test.py @@ -34,7 +34,11 @@ class TestImports(unittest.TestCase): 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): 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 return count