File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 21
21
from mypy .errors import CompileError
22
22
from mypy .semanal_main import core_modules
23
23
24
+ try :
25
+ import lxml # type: ignore
26
+ except ImportError :
27
+ lxml = None
28
+
29
+ import pytest
24
30
25
31
# List of files that contain test case descriptions.
26
32
typecheck_files = [
@@ -117,6 +123,8 @@ class TypeCheckSuite(DataSuite):
117
123
files = typecheck_files
118
124
119
125
def run_case (self , testcase : DataDrivenTestCase ) -> None :
126
+ if lxml is None and os .path .basename (testcase .file ) == 'check-reports.test' :
127
+ pytest .skip ("Cannot import lxml. Is it installed?" )
120
128
incremental = ('incremental' in testcase .name .lower ()
121
129
or 'incremental' in testcase .file
122
130
or 'serialize' in testcase .file )
Original file line number Diff line number Diff line change 18
18
assert_string_arrays_equal , normalize_error_messages , check_test_output_files
19
19
)
20
20
21
+ try :
22
+ import lxml # type: ignore
23
+ except ImportError :
24
+ lxml = None
25
+
26
+ import pytest
27
+
21
28
# Path to Python 3 interpreter
22
29
python3_path = sys .executable
23
30
@@ -35,6 +42,8 @@ class PythonCmdlineSuite(DataSuite):
35
42
native_sep = True
36
43
37
44
def run_case (self , testcase : DataDrivenTestCase ) -> None :
45
+ if lxml is None and os .path .basename (testcase .file ) == 'reports.test' :
46
+ pytest .skip ("Cannot import lxml. Is it installed?" )
38
47
for step in [1 ] + sorted (testcase .output2 ):
39
48
test_python_cmdline (testcase , step )
40
49
Original file line number Diff line number Diff line change 5
5
from mypy .report import CoberturaPackage , get_line_rate
6
6
7
7
8
+ try :
9
+ import lxml # type: ignore
10
+ except ImportError :
11
+ lxml = None
12
+
13
+ import pytest
14
+
15
+
8
16
class CoberturaReportSuite (Suite ):
17
+ @pytest .mark .skipif (lxml is None , reason = "Cannot import lxml. Is it installed?" )
9
18
def test_get_line_rate (self ) -> None :
10
19
assert_equal ('1.0' , get_line_rate (0 , 0 ))
11
20
assert_equal ('0.3333' , get_line_rate (1 , 3 ))
12
21
22
+ @pytest .mark .skipif (lxml is None , reason = "Cannot import lxml. Is it installed?" )
13
23
def test_as_xml (self ) -> None :
14
24
import lxml .etree as etree # type: ignore
15
25
You can’t perform that action at this time.
0 commit comments