summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2018-07-03 13:08:54 +0200
committerFlorian Bruhin <git@the-compiler.org>2018-07-03 13:08:54 +0200
commit641f7eb3c56a4c5a089700a91b413d462dfb1855 (patch)
treeef42900c01ebd0a5093945546a8a91016fc22903
parent38791a2386e273193b33c2a6d1abf82709242382 (diff)
downloadqutebrowser-641f7eb3c56a4c5a089700a91b413d462dfb1855.tar.gz
qutebrowser-641f7eb3c56a4c5a089700a91b413d462dfb1855.zip
Don't import test_file on Windows
See https://github.com/pytest-dev/pytest/issues/3650
-rw-r--r--tests/unit/utils/test_qtutils.py25
1 files changed, 15 insertions, 10 deletions
diff --git a/tests/unit/utils/test_qtutils.py b/tests/unit/utils/test_qtutils.py
index 6de085b25..3a848474f 100644
--- a/tests/unit/utils/test_qtutils.py
+++ b/tests/unit/utils/test_qtutils.py
@@ -25,13 +25,6 @@ import os
import os.path
import unittest
import unittest.mock
-try:
- # pylint: disable=no-name-in-module,useless-suppression
- from test import test_file
- # pylint: enable=no-name-in-module,useless-suppression
-except ImportError:
- # Debian patches Python to remove the tests...
- test_file = None
import pytest
from PyQt5.QtCore import (QDataStream, QPoint, QUrl, QByteArray, QIODevice,
@@ -40,6 +33,20 @@ from PyQt5.QtCore import (QDataStream, QPoint, QUrl, QByteArray, QIODevice,
from qutebrowser.utils import qtutils, utils
import overflow_test_cases
+if utils.is_linux:
+ # Those are not run on macOS because that seems to cause a hang sometimes.
+ # On Windows, we don't run them either because of
+ # https://github.com/pytest-dev/pytest/issues/3650
+ try:
+ # pylint: disable=no-name-in-module,useless-suppression
+ from test import test_file
+ # pylint: enable=no-name-in-module,useless-suppression
+ except ImportError:
+ # Debian patches Python to remove the tests...
+ test_file = None
+else:
+ test_file = None
+
# pylint: disable=bad-continuation
@pytest.mark.parametrize(['qversion', 'compiled', 'pyqt', 'version', 'exact',
@@ -476,13 +483,11 @@ class TestSavefileOpen:
assert data == b'foo\nbar\nbaz'
-if test_file is not None and not utils.is_mac:
+if test_file is not None:
# If we were able to import Python's test_file module, we run some code
# here which defines unittest TestCases to run the python tests over
# PyQIODevice.
- # Those are not run on macOS because that seems to cause a hang sometimes.
-
@pytest.fixture(scope='session', autouse=True)
def clean_up_python_testfile():
"""Clean up the python testfile after tests if tests didn't."""