Skip to content

Commit

Permalink
Changed pytest runner import (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
OlehKyba committed Apr 14, 2021
1 parent 32fd411 commit 1e8c954
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions flaky/flaky_pytest_plugin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from _pytest.runner import call_runtest_hook # pylint:disable=import-error
from _pytest import runner # pylint:disable=import-error

from flaky._flaky_plugin import _FlakyPlugin

Expand Down Expand Up @@ -130,7 +130,7 @@ def call_and_report(self, item, when, log=True, **kwds):
:type log:
`bool`
"""
call = call_runtest_hook(item, when, **kwds)
call = runner.call_runtest_hook(item, when, **kwds)
self._call_infos[item][when] = call
hook = item.ihook
report = hook.pytest_runtest_makereport(item=item, call=call)
Expand Down
4 changes: 2 additions & 2 deletions test/test_pytest/test_flaky_pytest_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from flaky import flaky
from flaky import _flaky_plugin
from flaky.flaky_pytest_plugin import (
call_runtest_hook,
runner,
FlakyPlugin,
FlakyXdist,
PLUGIN,
Expand Down Expand Up @@ -239,7 +239,7 @@ def error_raising_setup_function(item):
flaky_test.ihook = Mock()
flaky_test.ihook.pytest_runtest_setup = error_raising_setup_function
flaky_plugin._call_infos[flaky_test] = {} # pylint:disable=protected-access
call_info = call_runtest_hook(flaky_test, 'setup')
call_info = runner.call_runtest_hook(flaky_test, 'setup')
assert flaky_test.ran_setup
assert string_io.getvalue() == mock_io.getvalue()
assert call_info.excinfo.type is ZeroDivisionError
Expand Down

0 comments on commit 1e8c954

Please sign in to comment.