From 40711f9edb20f9f2034cade8bb2ae94bbe84b4ac Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sat, 23 Apr 2022 08:01:02 +1000 Subject: [PATCH] Run deprecated import check before imports from other tests --- Tests/test_deprecated_imageqt.py | 18 ++++++++++++++++++ Tests/test_imageqt_deprecated.py | 18 ------------------ 2 files changed, 18 insertions(+), 18 deletions(-) create mode 100644 Tests/test_deprecated_imageqt.py delete mode 100644 Tests/test_imageqt_deprecated.py diff --git a/Tests/test_deprecated_imageqt.py b/Tests/test_deprecated_imageqt.py new file mode 100644 index 000000000..2528ff3f7 --- /dev/null +++ b/Tests/test_deprecated_imageqt.py @@ -0,0 +1,18 @@ +import warnings + +with warnings.catch_warnings(record=True) as w: + # Arrange: cause all warnings to always be triggered + warnings.simplefilter("always") + + # Act: trigger a warning with Qt5 + from PIL import ImageQt + + +def test_deprecated(): + # Assert + if ImageQt.qt_version in ("5", "side2"): + assert len(w) == 1 + assert issubclass(w[0].category, DeprecationWarning) + assert "deprecated" in str(w[0].message) + else: + assert len(w) == 0 diff --git a/Tests/test_imageqt_deprecated.py b/Tests/test_imageqt_deprecated.py deleted file mode 100644 index 2662995f7..000000000 --- a/Tests/test_imageqt_deprecated.py +++ /dev/null @@ -1,18 +0,0 @@ -import warnings - - -def test_deprecated(): - with warnings.catch_warnings(record=True) as w: - # Arrange: cause all warnings to always be triggered - warnings.simplefilter("always") - - # Act: trigger a warning with Qt5 - from PIL import ImageQt - - # Assert - if ImageQt.qt_version in ("5", "side2"): - assert len(w) == 1 - assert issubclass(w[0].category, DeprecationWarning) - assert "deprecated" in str(w[0].message) - else: - assert len(w) == 0