mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
Don't use pytest-mock mocker.patch as context manager
Quote from `pytest-mock` docs [1]: > The purpose of this plugin is to make the use of context managers and > function decorators for mocking unnecessary, so it will emit a warning > when used as such. Thus using it as a context manager currently produces a warning during test runs in CI which is extra noise that could make new (possibly more important) warnings harder to spot. [1]: https://pytest-mock.readthedocs.io/en/latest/usage.html#usage-as-context-manager
This commit is contained in:
parent
c3a570eb7d
commit
5b6cc861d8
1 changed files with 5 additions and 4 deletions
|
@ -74,12 +74,13 @@ def test_new_default_setting(tmp_path: Path, mocker: MockerFixture) -> None:
|
|||
settings.save()
|
||||
|
||||
# Ensure new default setting is imported into settings
|
||||
with mocker.patch(
|
||||
mocker.patch(
|
||||
"dangerzone.settings.Settings.generate_default_settings",
|
||||
return_value={"mock_setting": 1},
|
||||
):
|
||||
settings2 = Settings(dz_core)
|
||||
assert settings2.get("mock_setting") == 1
|
||||
)
|
||||
|
||||
settings2 = Settings(dz_core)
|
||||
assert settings2.get("mock_setting") == 1
|
||||
|
||||
|
||||
def test_new_settings_added(tmp_path: Path, mocker: MockerFixture) -> None:
|
||||
|
|
Loading…
Reference in a new issue