You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can mock things out in the code that runs under script_runner using the normal approach (see monkeypatch fixture and pytest-mock plugin), however, this will only work in inprocess mode, when the console script is run in the same process as the test (see README for more info). Inprocess mode has some limitations (e.g. #24) but if your tests work in it, then mocking will just work as normal.
In subprocess mode mocking won't work because there the script under test runs in a separate Python process that pytest-console-scripts has no control over other than launching it.
Hi,
I have a question - how can I mock something that I test via
script_runner
?I know it's meant for integration tests, but sometimes it's useful...
I mean my script does an import that I'd like to mock, for example,
import requests
Cheers!
The text was updated successfully, but these errors were encountered: