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 2121from mypy .errors import CompileError
2222from mypy .semanal_main import core_modules
2323
24+ try :
25+ import lxml # type: ignore
26+ except ImportError :
27+ lxml = None
28+
29+ import pytest
2430
2531# List of files that contain test case descriptions.
2632typecheck_files = [
@@ -117,6 +123,8 @@ class TypeCheckSuite(DataSuite):
117123 files = typecheck_files
118124
119125 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?" )
120128 incremental = ('incremental' in testcase .name .lower ()
121129 or 'incremental' in testcase .file
122130 or 'serialize' in testcase .file )
Original file line number Diff line number Diff line change 1818 assert_string_arrays_equal , normalize_error_messages , check_test_output_files
1919)
2020
21+ try :
22+ import lxml # type: ignore
23+ except ImportError :
24+ lxml = None
25+
26+ import pytest
27+
2128# Path to Python 3 interpreter
2229python3_path = sys .executable
2330
@@ -35,6 +42,8 @@ class PythonCmdlineSuite(DataSuite):
3542 native_sep = True
3643
3744 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?" )
3847 for step in [1 ] + sorted (testcase .output2 ):
3948 test_python_cmdline (testcase , step )
4049
Original file line number Diff line number Diff line change 55from mypy .report import CoberturaPackage , get_line_rate
66
77
8+ try :
9+ import lxml # type: ignore
10+ except ImportError :
11+ lxml = None
12+
13+ import pytest
14+
15+
816class CoberturaReportSuite (Suite ):
17+ @pytest .mark .skipif (lxml is None , reason = "Cannot import lxml. Is it installed?" )
918 def test_get_line_rate (self ) -> None :
1019 assert_equal ('1.0' , get_line_rate (0 , 0 ))
1120 assert_equal ('0.3333' , get_line_rate (1 , 3 ))
1221
22+ @pytest .mark .skipif (lxml is None , reason = "Cannot import lxml. Is it installed?" )
1323 def test_as_xml (self ) -> None :
1424 import lxml .etree as etree # type: ignore
1525
You can’t perform that action at this time.
0 commit comments