File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,12 @@ Backwards incompatible changes
99
1010- Drop support for Python 3.5.
1111
12+ Other changes
13+ +++++++++++++
14+
15+ - Check for the resultlog by feature and not by version as pytest master does
16+ not provide a consistent version.
17+
1218
13199.1.1 (2020-09-29)
1420------------------
Original file line number Diff line number Diff line change 66import pytest
77from _pytest .runner import runtestprotocol
88
9+ HAS_RESULTLOG = False
10+
11+ try :
12+ from _pytest .resultlog import ResultLog
13+
14+ HAS_RESULTLOG = True
15+ except ImportError :
16+ # We have a pytest >= 6.1
17+ pass
18+
19+
920PYTEST_GTE_54 = pkg_resources .parse_version (
1021 pytest .__version__
1122) >= pkg_resources .parse_version ("5.4" )
1223
13- PYTEST_GTE_61 = pkg_resources .parse_version (
14- pytest .__version__
15- ) >= pkg_resources .parse_version ("6.1" )
16-
1724
1825def works_with_current_xdist ():
1926 """Returns compatibility with installed pytest-xdist version.
@@ -75,7 +82,7 @@ def pytest_configure(config):
7582
7683
7784def _get_resultlog (config ):
78- if PYTEST_GTE_61 :
85+ if not HAS_RESULTLOG :
7986 return None
8087 elif PYTEST_GTE_54 :
8188 # hack
@@ -87,7 +94,7 @@ def _get_resultlog(config):
8794
8895
8996def _set_resultlog (config , resultlog ):
90- if PYTEST_GTE_61 :
97+ if not HAS_RESULTLOG :
9198 pass
9299 elif PYTEST_GTE_54 :
93100 # hack
@@ -306,8 +313,7 @@ def show_rerun(terminalreporter, lines):
306313 lines .append (f"RERUN { pos } " )
307314
308315
309- if not PYTEST_GTE_61 :
310- from _pytest .resultlog import ResultLog
316+ if HAS_RESULTLOG :
311317
312318 class RerunResultLog (ResultLog ):
313319 def __init__ (self , config , logfile ):
You can’t perform that action at this time.
0 commit comments