Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix test failures on EDM and Python 3.8 #1090

Merged
merged 3 commits into from
Jan 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions pyface/tests/test_pil_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@


import os
import logging
import unittest

# importlib.resources is new in Python 3.7, and importlib.resources.files is
Expand All @@ -20,13 +21,22 @@
except ImportError:
from importlib_resources import files

from PIL import Image
from pyface.util._optional_dependencies import optional_import

from ..pil_image import PILImage
Image = None

with optional_import(
"pillow",
msg="PILImage not available due to missing pillow.",
logger=logging.getLogger(__name__)):

from PIL import Image
from ..pil_image import PILImage

IMAGE_PATH = os.fspath(files("pyface.tests") / "images" / "core.png")


@unittest.skipIf(Image is None, "Pillow not available")
class TestPILImage(unittest.TestCase):

def setUp(self):
Expand Down
6 changes: 5 additions & 1 deletion pyface/ui/qt4/tests/test_qt_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#
# Thanks for using Enthought open source!

import sys
import unittest
import warnings

Expand All @@ -21,10 +22,13 @@ def test_imports(self):
import pyface.qt.QtOpenGL # noqa: F401
import pyface.qt.QtSvg # noqa: F401
import pyface.qt.QtTest # noqa: F401
import pyface.qt.QtWebKit # noqa: F401
import pyface.qt.QtMultimedia # noqa: F401
import pyface.qt.QtMultimediaWidgets # noqa: F401

@unittest.skipIf(sys.version_info > (3, 6), "WebKit is not available")
def test_import_web_kit(self):
import pyface.qt.QtWebKit # noqa: F401

def test_import_QtScript(self):
# QtScript is not supported on PyQt5/PySide2 and
# this import will raise a deprecation warning.
Expand Down
5 changes: 5 additions & 0 deletions pyface/ui/qt4/workbench/tests/test_workbench_window_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
# Thanks for using Enthought open source!


import sys
import unittest
from unittest import mock

Expand All @@ -19,9 +20,13 @@


class TestWorkbenchWindowLayout(unittest.TestCase):

@unittest.skipIf(sys.version_info == (3, 8), "Can't mock SplitTabWidget")
def test_change_of_active_qt_editor(self):
# Test error condition for enthought/mayavi#321

# This doesn't work on Python 3.8 because of some incompatibility
# between unittest.mock.Mock and Qt, I think
mock_split_tab_widget = mock.Mock(spec=SplitTabWidget)

layout = WorkbenchWindowLayout(_qt4_editor_area=mock_split_tab_widget)
Expand Down