3232
3333
3434def works_with_current_xdist ():
35- """Returns compatibility with installed pytest-xdist version.
35+ """Return compatibility with installed pytest-xdist version.
3636
3737 When running tests in parallel using pytest-xdist < 1.20.0, the first
3838 report that is logged will finish and terminate the current node rather
@@ -197,9 +197,8 @@ def get_reruns_condition(item):
197197
198198
199199def evaluate_condition (item , mark , condition : object ) -> bool :
200- """
201- copy from python3.8 _pytest.skipping.py
202- """
200+ # copy from python3.8 _pytest.skipping.py
201+
203202 result = False
204203 # String condition.
205204 if isinstance (condition , str ):
@@ -245,9 +244,7 @@ def evaluate_condition(item, mark, condition: object) -> bool:
245244
246245
247246def _remove_cached_results_from_failed_fixtures (item ):
248- """
249- Note: remove all cached_result attribute from every fixture
250- """
247+ """Note: remove all cached_result attribute from every fixture."""
251248 cached_result = "cached_result"
252249 fixture_info = getattr (item , "_fixtureinfo" , None )
253250 for fixture_def_str in getattr (fixture_info , "name2fixturedefs" , ()):
@@ -264,6 +261,8 @@ def _remove_cached_results_from_failed_fixtures(item):
264261
265262def _remove_failed_setup_state_from_session (item ):
266263 """
264+ Clean up setup state.
265+
267266 Note: remove all failures from every node in _setupstate stack
268267 and clean the stack itself
269268 """
@@ -307,10 +306,11 @@ def _should_not_rerun(item, report, reruns):
307306
308307def pytest_runtest_protocol (item , nextitem ):
309308 """
309+ Run the test protocol.
310+
310311 Note: when teardown fails, two reports are generated for the case, one for
311312 the test case and the other for the teardown error.
312313 """
313-
314314 reruns = get_reruns_count (item )
315315 if reruns is None :
316316 # global setting is not specified, and this test is not marked with
@@ -358,13 +358,13 @@ def pytest_runtest_protocol(item, nextitem):
358358
359359
360360def pytest_report_teststatus (report ):
361- """ Adapted from https://pytest.org/latest/_modules/_pytest/skipping.html"""
361+ # Adapted from https://pytest.org/latest/_modules/_pytest/skipping.html
362362 if report .outcome == "rerun" :
363363 return "rerun" , "R" , ("RERUN" , {"yellow" : True })
364364
365365
366366def pytest_terminal_summary (terminalreporter ):
367- """ Adapted from https://pytest.org/latest/_modules/_pytest/skipping.html"""
367+ # Adapted from https://pytest.org/latest/_modules/_pytest/skipping.html
368368 tr = terminalreporter
369369 if not tr .reportchars :
370370 return
@@ -395,10 +395,7 @@ def __init__(self, config, logfile):
395395 ResultLog .__init__ (self , config , logfile )
396396
397397 def pytest_runtest_logreport (self , report ):
398- """
399- Adds support for rerun report fix for issue:
400- https://github.com/pytest-dev/pytest-rerunfailures/issues/28
401- """
398+ """Add support for rerun report."""
402399 if report .when != "call" and report .passed :
403400 return
404401 res = self .config .hook .pytest_report_teststatus (report = report )
0 commit comments