File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change 2727try :
2828 import lxml
2929except ImportError :
30- lxml = None
30+ lxml_import_failure = True
3131
3232
3333import pytest
@@ -55,7 +55,7 @@ class TypeCheckSuite(DataSuite):
5555 files = typecheck_files
5656
5757 def run_case (self , testcase : DataDrivenTestCase ) -> None :
58- if lxml is None and os .path .basename (testcase .file ) == "check-reports.test" :
58+ if lxml_import_failure and os .path .basename (testcase .file ) == "check-reports.test" :
5959 pytest .skip ("Cannot import lxml. Is it installed?" )
6060 incremental = (
6161 "incremental" in testcase .name .lower ()
Original file line number Diff line number Diff line change 2222try :
2323 import lxml
2424except ImportError :
25- lxml = None
25+ lxml_import_failure = True
2626
2727import pytest
2828
@@ -38,7 +38,7 @@ class PythonCmdlineSuite(DataSuite):
3838 native_sep = True
3939
4040 def run_case (self , testcase : DataDrivenTestCase ) -> None :
41- if lxml is None and os .path .basename (testcase .file ) == "reports.test" :
41+ if lxml_import_failure and os .path .basename (testcase .file ) == "reports.test" :
4242 pytest .skip ("Cannot import lxml. Is it installed?" )
4343 for step in [1 ] + sorted (testcase .output2 ):
4444 test_python_cmdline (testcase , step )
Original file line number Diff line number Diff line change 1010try :
1111 import lxml
1212except ImportError :
13- lxml = None
13+ lxml_import_failure = True
1414
1515import pytest
1616
1717
1818class CoberturaReportSuite (Suite ):
19- @pytest .mark .skipif (lxml is None , reason = "Cannot import lxml. Is it installed?" )
19+ @pytest .mark .skipif (lxml_import_failure , reason = "Cannot import lxml. Is it installed?" )
2020 def test_get_line_rate (self ) -> None :
2121 assert_equal ("1.0" , get_line_rate (0 , 0 ))
2222 assert_equal ("0.3333" , get_line_rate (1 , 3 ))
2323
24- @pytest .mark .skipif (lxml is None , reason = "Cannot import lxml. Is it installed?" )
24+ @pytest .mark .skipif (lxml_import_failure , reason = "Cannot import lxml. Is it installed?" )
2525 def test_as_xml (self ) -> None :
2626 import lxml .etree as etree
2727
You can’t perform that action at this time.
0 commit comments