Don't import test_file on Windows
See https://github.com/pytest-dev/pytest/issues/3650
This commit is contained in:
parent
38791a2386
commit
641f7eb3c5
@ -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."""
|
||||
|
Loading…
Reference in New Issue
Block a user