-
-
Notifications
You must be signed in to change notification settings - Fork 146
Closed
Description
I've just added pytest
and pytest-mock
to a legacy project and found that this error was being raised after tests completed.
Traceback (most recent call last):
File "…/lib/python2.7/site-packages/pytest.py", line 89, in <module>
raise SystemExit(pytest.main())
File "…/lib/python2.7/site-packages/_pytest/config/__init__.py", line 80, in main
return config.hook.pytest_cmdline_main(config=config)
File "…/lib/python2.7/site-packages/pluggy/hooks.py", line 284, in __call__
return self._hookexec(self, self.get_hookimpls(), kwargs)
File "…/lib/python2.7/site-packages/pluggy/manager.py", line 68, in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
File "…/lib/python2.7/site-packages/pluggy/manager.py", line 62, in <lambda>
firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
File "…/lib/python2.7/site-packages/pluggy/callers.py", line 208, in _multicall
return outcome.get_result()
File "…/lib/python2.7/site-packages/pluggy/callers.py", line 81, in get_result
_reraise(*ex) # noqa
File "…/lib/python2.7/site-packages/pluggy/callers.py", line 187, in _multicall
res = hook_impl.function(*args)
File "…/lib/python2.7/site-packages/_pytest/main.py", line 236, in pytest_cmdline_main
return wrap_session(config, _main)
File "…/lib/python2.7/site-packages/_pytest/main.py", line 231, in wrap_session
config._ensure_unconfigure()
File "…/lib/python2.7/site-packages/_pytest/config/__init__.py", line 648, in _ensure_unconfigure
fin()
File "…/lib/python2.7/site-packages/pytest_mock.py", line 291, in unwrap_assert_methods
patcher.stop()
File "…/lib/python2.7/site-packages/mock/mock.py", line 1513, in stop
return self.__exit__()
File "…/lib/python2.7/site-packages/mock/mock.py", line 1477, in __exit__
raise RuntimeError('stop called on unstarted patcher')
RuntimeError: stop called on unstarted patcher
One of the tests in the test suite included a call to patch.stopall()
, which seems to have stopped pytest-mock
's mocks and caused this error.
Metadata
Metadata
Assignees
Labels
No labels