Marco Ricci commited on 2025-08-09 15:12:40
Zeige 10 geänderte Dateien mit 496 Einfügungen und 504 Löschungen.
Instead of importing submodules and navigating to them via the top-level module (`import spam.ham.eggs`), use leaf module imports (`from spam.ham import eggs`). Though there is sometimes the need to rename the imported module, doing so leads to shorter expressions in general. It also allows static analysis tools to accurately detect whether a module is in use or not. (Such a detection is much more murky if the whole module path needs to be traversed each time.)
| ... | ... |
@@ -8,8 +8,8 @@ import base64 |
| 8 | 8 |
|
| 9 | 9 |
import pytest |
| 10 | 10 |
|
| 11 |
-import tests.data |
|
| 12 | 11 |
from derivepassphrase import ssh_agent |
| 12 |
+from tests import data |
|
| 13 | 13 |
|
| 14 | 14 |
OPENSSH_MAGIC = b"openssh-key-v1\x00" |
| 15 | 15 |
OPENSSH_HEADER = ( |
| ... | ... |
@@ -139,15 +139,15 @@ class Parametrize: |
| 139 | 139 |
|
| 140 | 140 |
TEST_KEYS = pytest.mark.parametrize( |
| 141 | 141 |
["keyname", "key"], |
| 142 |
- tests.data.ALL_KEYS.items(), |
|
| 143 |
- ids=tests.data.ALL_KEYS.keys(), |
|
| 142 |
+ data.ALL_KEYS.items(), |
|
| 143 |
+ ids=data.ALL_KEYS.keys(), |
|
| 144 | 144 |
) |
| 145 | 145 |
|
| 146 | 146 |
|
| 147 | 147 |
@Parametrize.TEST_KEYS |
| 148 | 148 |
def test_100_test_keys_public_keys_are_internally_consistent( |
| 149 | 149 |
keyname: str, |
| 150 |
- key: tests.data.SSHTestKey, |
|
| 150 |
+ key: data.SSHTestKey, |
|
| 151 | 151 |
) -> None: |
| 152 | 152 |
"""The test key public key data structures are internally consistent.""" |
| 153 | 153 |
del keyname |
| ... | ... |
@@ -163,7 +163,7 @@ def test_100_test_keys_public_keys_are_internally_consistent( |
| 163 | 163 |
@Parametrize.TEST_KEYS |
| 164 | 164 |
def test_101_test_keys_private_keys_are_consistent_with_public_keys( |
| 165 | 165 |
keyname: str, |
| 166 |
- key: tests.data.SSHTestKey, |
|
| 166 |
+ key: data.SSHTestKey, |
|
| 167 | 167 |
) -> None: |
| 168 | 168 |
"""The test key private key data are consistent with their public parts.""" |
| 169 | 169 |
del keyname |
| ... | ... |
@@ -197,7 +197,7 @@ def test_101_test_keys_private_keys_are_consistent_with_public_keys( |
| 197 | 197 |
@Parametrize.TEST_KEYS |
| 198 | 198 |
def test_102_test_keys_private_keys_are_internally_consistent( |
| 199 | 199 |
keyname: str, |
| 200 |
- key: tests.data.SSHTestKey, |
|
| 200 |
+ key: data.SSHTestKey, |
|
| 201 | 201 |
) -> None: |
| 202 | 202 |
"""The test key private key data structures are internally consistent.""" |
| 203 | 203 |
del keyname |
| ... | ... |
@@ -33,11 +33,6 @@ import pytest |
| 33 | 33 |
from hypothesis import strategies |
| 34 | 34 |
from typing_extensions import Any, NamedTuple |
| 35 | 35 |
|
| 36 |
-import tests.data |
|
| 37 |
-import tests.data.callables |
|
| 38 |
-import tests.machinery |
|
| 39 |
-import tests.machinery.hypothesis |
|
| 40 |
-import tests.machinery.pytest |
|
| 41 | 36 |
from derivepassphrase import _types, cli, ssh_agent, vault |
| 42 | 37 |
from derivepassphrase._internals import ( |
| 43 | 38 |
cli_helpers, |
| ... | ... |
@@ -45,6 +40,10 @@ from derivepassphrase._internals import ( |
| 45 | 40 |
cli_messages, |
| 46 | 41 |
) |
| 47 | 42 |
from derivepassphrase.ssh_agent import socketprovider |
| 43 |
+from tests import data, machinery |
|
| 44 |
+from tests.data import callables |
|
| 45 |
+from tests.machinery import hypothesis as hypothesis_machinery |
|
| 46 |
+from tests.machinery import pytest as pytest_machinery |
|
| 48 | 47 |
|
| 49 | 48 |
if TYPE_CHECKING: |
| 50 | 49 |
from collections.abc import Callable, Iterable, Iterator, Sequence |
| ... | ... |
@@ -53,22 +52,22 @@ if TYPE_CHECKING: |
| 53 | 52 |
|
| 54 | 53 |
from typing_extensions import Literal |
| 55 | 54 |
|
| 56 |
-DUMMY_SERVICE = tests.data.DUMMY_SERVICE |
|
| 57 |
-DUMMY_PASSPHRASE = tests.data.DUMMY_PASSPHRASE |
|
| 58 |
-DUMMY_CONFIG_SETTINGS = tests.data.DUMMY_CONFIG_SETTINGS |
|
| 59 |
-DUMMY_RESULT_PASSPHRASE = tests.data.DUMMY_RESULT_PASSPHRASE |
|
| 60 |
-DUMMY_RESULT_KEY1 = tests.data.DUMMY_RESULT_KEY1 |
|
| 61 |
-DUMMY_PHRASE_FROM_KEY1_RAW = tests.data.DUMMY_PHRASE_FROM_KEY1_RAW |
|
| 62 |
-DUMMY_PHRASE_FROM_KEY1 = tests.data.DUMMY_PHRASE_FROM_KEY1 |
|
| 55 |
+DUMMY_SERVICE = data.DUMMY_SERVICE |
|
| 56 |
+DUMMY_PASSPHRASE = data.DUMMY_PASSPHRASE |
|
| 57 |
+DUMMY_CONFIG_SETTINGS = data.DUMMY_CONFIG_SETTINGS |
|
| 58 |
+DUMMY_RESULT_PASSPHRASE = data.DUMMY_RESULT_PASSPHRASE |
|
| 59 |
+DUMMY_RESULT_KEY1 = data.DUMMY_RESULT_KEY1 |
|
| 60 |
+DUMMY_PHRASE_FROM_KEY1_RAW = data.DUMMY_PHRASE_FROM_KEY1_RAW |
|
| 61 |
+DUMMY_PHRASE_FROM_KEY1 = data.DUMMY_PHRASE_FROM_KEY1 |
|
| 63 | 62 |
|
| 64 |
-DUMMY_KEY1 = tests.data.DUMMY_KEY1 |
|
| 65 |
-DUMMY_KEY1_B64 = tests.data.DUMMY_KEY1_B64 |
|
| 66 |
-DUMMY_KEY2 = tests.data.DUMMY_KEY2 |
|
| 67 |
-DUMMY_KEY2_B64 = tests.data.DUMMY_KEY2_B64 |
|
| 68 |
-DUMMY_KEY3 = tests.data.DUMMY_KEY3 |
|
| 69 |
-DUMMY_KEY3_B64 = tests.data.DUMMY_KEY3_B64 |
|
| 63 |
+DUMMY_KEY1 = data.DUMMY_KEY1 |
|
| 64 |
+DUMMY_KEY1_B64 = data.DUMMY_KEY1_B64 |
|
| 65 |
+DUMMY_KEY2 = data.DUMMY_KEY2 |
|
| 66 |
+DUMMY_KEY2_B64 = data.DUMMY_KEY2_B64 |
|
| 67 |
+DUMMY_KEY3 = data.DUMMY_KEY3 |
|
| 68 |
+DUMMY_KEY3_B64 = data.DUMMY_KEY3_B64 |
|
| 70 | 69 |
|
| 71 |
-TEST_CONFIGS = tests.data.TEST_CONFIGS |
|
| 70 |
+TEST_CONFIGS = data.TEST_CONFIGS |
|
| 72 | 71 |
|
| 73 | 72 |
|
| 74 | 73 |
class IncompatibleConfiguration(NamedTuple): |
| ... | ... |
@@ -277,7 +276,7 @@ def is_harmless_config_import_warning(record: tuple[str, int, str]) -> bool: |
| 277 | 276 |
), |
| 278 | 277 |
] |
| 279 | 278 |
return any( |
| 280 |
- tests.machinery.warning_emitted(w, [record]) for w in possible_warnings |
|
| 279 |
+ machinery.warning_emitted(w, [record]) for w in possible_warnings |
|
| 281 | 280 |
) |
| 282 | 281 |
|
| 283 | 282 |
|
| ... | ... |
@@ -327,8 +326,8 @@ def vault_config_exporter_shell_interpreter( # noqa: C901 |
| 327 | 326 |
*, |
| 328 | 327 |
prog_name_list: list[str] | None = None, |
| 329 | 328 |
command: click.BaseCommand | None = None, |
| 330 |
- runner: tests.machinery.CliRunner | None = None, |
|
| 331 |
-) -> Iterator[tests.machinery.ReadableResult]: |
|
| 329 |
+ runner: machinery.CliRunner | None = None, |
|
| 330 |
+) -> Iterator[machinery.ReadableResult]: |
|
| 332 | 331 |
"""A rudimentary sh(1) interpreter for `--export-as=sh` output. |
| 333 | 332 |
|
| 334 | 333 |
Assumes a script as emitted by `derivepassphrase vault |
| ... | ... |
@@ -345,7 +344,7 @@ def vault_config_exporter_shell_interpreter( # noqa: C901 |
| 345 | 344 |
if command is None: # pragma: no cover |
| 346 | 345 |
command = cli.derivepassphrase_vault |
| 347 | 346 |
if runner is None: # pragma: no cover |
| 348 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 347 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 349 | 348 |
n = len(prog_name_list) |
| 350 | 349 |
it = iter(script) |
| 351 | 350 |
while True: |
| ... | ... |
@@ -2015,14 +2014,14 @@ class TestAllCLI: |
| 2015 | 2014 |
TODO: Do we actually need this? What should we check for? |
| 2016 | 2015 |
|
| 2017 | 2016 |
""" |
| 2018 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2017 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2019 | 2018 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2020 | 2019 |
# with-statements. |
| 2021 | 2020 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2022 | 2021 |
with contextlib.ExitStack() as stack: |
| 2023 | 2022 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2024 | 2023 |
stack.enter_context( |
| 2025 |
- tests.machinery.pytest.isolated_config( |
|
| 2024 |
+ pytest_machinery.isolated_config( |
|
| 2026 | 2025 |
monkeypatch=monkeypatch, |
| 2027 | 2026 |
runner=runner, |
| 2028 | 2027 |
) |
| ... | ... |
@@ -2044,14 +2043,14 @@ class TestAllCLI: |
| 2044 | 2043 |
TODO: Do we actually need this? What should we check for? |
| 2045 | 2044 |
|
| 2046 | 2045 |
""" |
| 2047 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2046 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2048 | 2047 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2049 | 2048 |
# with-statements. |
| 2050 | 2049 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2051 | 2050 |
with contextlib.ExitStack() as stack: |
| 2052 | 2051 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2053 | 2052 |
stack.enter_context( |
| 2054 |
- tests.machinery.pytest.isolated_config( |
|
| 2053 |
+ pytest_machinery.isolated_config( |
|
| 2055 | 2054 |
monkeypatch=monkeypatch, |
| 2056 | 2055 |
runner=runner, |
| 2057 | 2056 |
) |
| ... | ... |
@@ -2075,14 +2074,14 @@ class TestAllCLI: |
| 2075 | 2074 |
TODO: Do we actually need this? What should we check for? |
| 2076 | 2075 |
|
| 2077 | 2076 |
""" |
| 2078 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2077 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2079 | 2078 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2080 | 2079 |
# with-statements. |
| 2081 | 2080 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2082 | 2081 |
with contextlib.ExitStack() as stack: |
| 2083 | 2082 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2084 | 2083 |
stack.enter_context( |
| 2085 |
- tests.machinery.pytest.isolated_config( |
|
| 2084 |
+ pytest_machinery.isolated_config( |
|
| 2086 | 2085 |
monkeypatch=monkeypatch, |
| 2087 | 2086 |
runner=runner, |
| 2088 | 2087 |
) |
| ... | ... |
@@ -2106,14 +2105,14 @@ class TestAllCLI: |
| 2106 | 2105 |
TODO: Do we actually need this? What should we check for? |
| 2107 | 2106 |
|
| 2108 | 2107 |
""" |
| 2109 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2108 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2110 | 2109 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2111 | 2110 |
# with-statements. |
| 2112 | 2111 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2113 | 2112 |
with contextlib.ExitStack() as stack: |
| 2114 | 2113 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2115 | 2114 |
stack.enter_context( |
| 2116 |
- tests.machinery.pytest.isolated_config( |
|
| 2115 |
+ pytest_machinery.isolated_config( |
|
| 2117 | 2116 |
monkeypatch=monkeypatch, |
| 2118 | 2117 |
runner=runner, |
| 2119 | 2118 |
) |
| ... | ... |
@@ -2139,14 +2138,14 @@ class TestAllCLI: |
| 2139 | 2138 |
non_eager_arguments: list[str], |
| 2140 | 2139 |
) -> None: |
| 2141 | 2140 |
"""Eager options terminate option and argument processing.""" |
| 2142 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2141 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2143 | 2142 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2144 | 2143 |
# with-statements. |
| 2145 | 2144 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2146 | 2145 |
with contextlib.ExitStack() as stack: |
| 2147 | 2146 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2148 | 2147 |
stack.enter_context( |
| 2149 |
- tests.machinery.pytest.isolated_config( |
|
| 2148 |
+ pytest_machinery.isolated_config( |
|
| 2150 | 2149 |
monkeypatch=monkeypatch, |
| 2151 | 2150 |
runner=runner, |
| 2152 | 2151 |
) |
| ... | ... |
@@ -2174,14 +2173,14 @@ class TestAllCLI: |
| 2174 | 2173 |
|
| 2175 | 2174 |
""" |
| 2176 | 2175 |
color = False |
| 2177 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2176 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2178 | 2177 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2179 | 2178 |
# with-statements. |
| 2180 | 2179 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2181 | 2180 |
with contextlib.ExitStack() as stack: |
| 2182 | 2181 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2183 | 2182 |
stack.enter_context( |
| 2184 |
- tests.machinery.pytest.isolated_config( |
|
| 2183 |
+ pytest_machinery.isolated_config( |
|
| 2185 | 2184 |
monkeypatch=monkeypatch, |
| 2186 | 2185 |
runner=runner, |
| 2187 | 2186 |
) |
| ... | ... |
@@ -2215,14 +2214,14 @@ class TestAllCLI: |
| 2215 | 2214 |
subcommands. |
| 2216 | 2215 |
|
| 2217 | 2216 |
""" |
| 2218 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2217 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2219 | 2218 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2220 | 2219 |
# with-statements. |
| 2221 | 2220 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2222 | 2221 |
with contextlib.ExitStack() as stack: |
| 2223 | 2222 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2224 | 2223 |
stack.enter_context( |
| 2225 |
- tests.machinery.pytest.isolated_config( |
|
| 2224 |
+ pytest_machinery.isolated_config( |
|
| 2226 | 2225 |
monkeypatch=monkeypatch, |
| 2227 | 2226 |
runner=runner, |
| 2228 | 2227 |
) |
| ... | ... |
@@ -2256,14 +2255,14 @@ class TestAllCLI: |
| 2256 | 2255 |
of subcommands. |
| 2257 | 2256 |
|
| 2258 | 2257 |
""" |
| 2259 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2258 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2260 | 2259 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2261 | 2260 |
# with-statements. |
| 2262 | 2261 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2263 | 2262 |
with contextlib.ExitStack() as stack: |
| 2264 | 2263 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2265 | 2264 |
stack.enter_context( |
| 2266 |
- tests.machinery.pytest.isolated_config( |
|
| 2265 |
+ pytest_machinery.isolated_config( |
|
| 2267 | 2266 |
monkeypatch=monkeypatch, |
| 2268 | 2267 |
runner=runner, |
| 2269 | 2268 |
) |
| ... | ... |
@@ -2304,14 +2303,14 @@ class TestAllCLI: |
| 2304 | 2303 |
configuration formats, and a list of available PEP 508 extras. |
| 2305 | 2304 |
|
| 2306 | 2305 |
""" |
| 2307 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2306 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2308 | 2307 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2309 | 2308 |
# with-statements. |
| 2310 | 2309 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2311 | 2310 |
with contextlib.ExitStack() as stack: |
| 2312 | 2311 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2313 | 2312 |
stack.enter_context( |
| 2314 |
- tests.machinery.pytest.isolated_config( |
|
| 2313 |
+ pytest_machinery.isolated_config( |
|
| 2315 | 2314 |
monkeypatch=monkeypatch, |
| 2316 | 2315 |
runner=runner, |
| 2317 | 2316 |
) |
| ... | ... |
@@ -2359,14 +2358,14 @@ class TestAllCLI: |
| 2359 | 2358 |
first paragraph. |
| 2360 | 2359 |
|
| 2361 | 2360 |
""" |
| 2362 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2361 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2363 | 2362 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2364 | 2363 |
# with-statements. |
| 2365 | 2364 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2366 | 2365 |
with contextlib.ExitStack() as stack: |
| 2367 | 2366 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2368 | 2367 |
stack.enter_context( |
| 2369 |
- tests.machinery.pytest.isolated_config( |
|
| 2368 |
+ pytest_machinery.isolated_config( |
|
| 2370 | 2369 |
monkeypatch=monkeypatch, |
| 2371 | 2370 |
runner=runner, |
| 2372 | 2371 |
) |
| ... | ... |
@@ -2411,14 +2410,14 @@ class TestCLI: |
| 2411 | 2410 |
self, |
| 2412 | 2411 |
) -> None: |
| 2413 | 2412 |
"""The `--help` option emits help text.""" |
| 2414 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2413 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2415 | 2414 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2416 | 2415 |
# with-statements. |
| 2417 | 2416 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2418 | 2417 |
with contextlib.ExitStack() as stack: |
| 2419 | 2418 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2420 | 2419 |
stack.enter_context( |
| 2421 |
- tests.machinery.pytest.isolated_config( |
|
| 2420 |
+ pytest_machinery.isolated_config( |
|
| 2422 | 2421 |
monkeypatch=monkeypatch, |
| 2423 | 2422 |
runner=runner, |
| 2424 | 2423 |
) |
| ... | ... |
@@ -2441,14 +2440,14 @@ class TestCLI: |
| 2441 | 2440 |
self, |
| 2442 | 2441 |
) -> None: |
| 2443 | 2442 |
"""The `--version` option emits version information.""" |
| 2444 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2443 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2445 | 2444 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2446 | 2445 |
# with-statements. |
| 2447 | 2446 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2448 | 2447 |
with contextlib.ExitStack() as stack: |
| 2449 | 2448 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2450 | 2449 |
stack.enter_context( |
| 2451 |
- tests.machinery.pytest.isolated_config( |
|
| 2450 |
+ pytest_machinery.isolated_config( |
|
| 2452 | 2451 |
monkeypatch=monkeypatch, |
| 2453 | 2452 |
runner=runner, |
| 2454 | 2453 |
) |
| ... | ... |
@@ -2473,14 +2472,14 @@ class TestCLI: |
| 2473 | 2472 |
"""Named character classes can be disabled on the command-line.""" |
| 2474 | 2473 |
option = f"--{charset_name}"
|
| 2475 | 2474 |
charset = vault.Vault.CHARSETS[charset_name].decode("ascii")
|
| 2476 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2475 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2477 | 2476 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2478 | 2477 |
# with-statements. |
| 2479 | 2478 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2480 | 2479 |
with contextlib.ExitStack() as stack: |
| 2481 | 2480 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2482 | 2481 |
stack.enter_context( |
| 2483 |
- tests.machinery.pytest.isolated_config( |
|
| 2482 |
+ pytest_machinery.isolated_config( |
|
| 2484 | 2483 |
monkeypatch=monkeypatch, |
| 2485 | 2484 |
runner=runner, |
| 2486 | 2485 |
) |
| ... | ... |
@@ -2488,7 +2487,7 @@ class TestCLI: |
| 2488 | 2487 |
monkeypatch.setattr( |
| 2489 | 2488 |
cli_helpers, |
| 2490 | 2489 |
"prompt_for_passphrase", |
| 2491 |
- tests.data.callables.auto_prompt, |
|
| 2490 |
+ callables.auto_prompt, |
|
| 2492 | 2491 |
) |
| 2493 | 2492 |
result = runner.invoke( |
| 2494 | 2493 |
cli.derivepassphrase_vault, |
| ... | ... |
@@ -2506,14 +2505,14 @@ class TestCLI: |
| 2506 | 2505 |
self, |
| 2507 | 2506 |
) -> None: |
| 2508 | 2507 |
"""Character repetition can be disabled on the command-line.""" |
| 2509 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2508 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2510 | 2509 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2511 | 2510 |
# with-statements. |
| 2512 | 2511 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2513 | 2512 |
with contextlib.ExitStack() as stack: |
| 2514 | 2513 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2515 | 2514 |
stack.enter_context( |
| 2516 |
- tests.machinery.pytest.isolated_config( |
|
| 2515 |
+ pytest_machinery.isolated_config( |
|
| 2517 | 2516 |
monkeypatch=monkeypatch, |
| 2518 | 2517 |
runner=runner, |
| 2519 | 2518 |
) |
| ... | ... |
@@ -2521,7 +2520,7 @@ class TestCLI: |
| 2521 | 2520 |
monkeypatch.setattr( |
| 2522 | 2521 |
cli_helpers, |
| 2523 | 2522 |
"prompt_for_passphrase", |
| 2524 |
- tests.data.callables.auto_prompt, |
|
| 2523 |
+ callables.auto_prompt, |
|
| 2525 | 2524 |
) |
| 2526 | 2525 |
result = runner.invoke( |
| 2527 | 2526 |
cli.derivepassphrase_vault, |
| ... | ... |
@@ -2542,19 +2541,19 @@ class TestCLI: |
| 2542 | 2541 |
@Parametrize.CONFIG_WITH_KEY |
| 2543 | 2542 |
def test_204a_key_from_config( |
| 2544 | 2543 |
self, |
| 2545 |
- running_ssh_agent: tests.data.RunningSSHAgentInfo, |
|
| 2544 |
+ running_ssh_agent: data.RunningSSHAgentInfo, |
|
| 2546 | 2545 |
config: _types.VaultConfig, |
| 2547 | 2546 |
) -> None: |
| 2548 | 2547 |
"""A stored configured SSH key will be used.""" |
| 2549 | 2548 |
del running_ssh_agent |
| 2550 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2549 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2551 | 2550 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2552 | 2551 |
# with-statements. |
| 2553 | 2552 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2554 | 2553 |
with contextlib.ExitStack() as stack: |
| 2555 | 2554 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2556 | 2555 |
stack.enter_context( |
| 2557 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 2556 |
+ pytest_machinery.isolated_vault_config( |
|
| 2558 | 2557 |
monkeypatch=monkeypatch, |
| 2559 | 2558 |
runner=runner, |
| 2560 | 2559 |
vault_config=config, |
| ... | ... |
@@ -2563,7 +2562,7 @@ class TestCLI: |
| 2563 | 2562 |
monkeypatch.setattr( |
| 2564 | 2563 |
vault.Vault, |
| 2565 | 2564 |
"phrase_from_key", |
| 2566 |
- tests.data.callables.phrase_from_key, |
|
| 2565 |
+ callables.phrase_from_key, |
|
| 2567 | 2566 |
) |
| 2568 | 2567 |
result = runner.invoke( |
| 2569 | 2568 |
cli.derivepassphrase_vault, |
| ... | ... |
@@ -2584,18 +2583,18 @@ class TestCLI: |
| 2584 | 2583 |
|
| 2585 | 2584 |
def test_204b_key_from_command_line( |
| 2586 | 2585 |
self, |
| 2587 |
- running_ssh_agent: tests.data.RunningSSHAgentInfo, |
|
| 2586 |
+ running_ssh_agent: data.RunningSSHAgentInfo, |
|
| 2588 | 2587 |
) -> None: |
| 2589 | 2588 |
"""An SSH key requested on the command-line will be used.""" |
| 2590 | 2589 |
del running_ssh_agent |
| 2591 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2590 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2592 | 2591 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2593 | 2592 |
# with-statements. |
| 2594 | 2593 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2595 | 2594 |
with contextlib.ExitStack() as stack: |
| 2596 | 2595 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2597 | 2596 |
stack.enter_context( |
| 2598 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 2597 |
+ pytest_machinery.isolated_vault_config( |
|
| 2599 | 2598 |
monkeypatch=monkeypatch, |
| 2600 | 2599 |
runner=runner, |
| 2601 | 2600 |
vault_config={
|
| ... | ... |
@@ -2606,12 +2605,12 @@ class TestCLI: |
| 2606 | 2605 |
monkeypatch.setattr( |
| 2607 | 2606 |
cli_helpers, |
| 2608 | 2607 |
"get_suitable_ssh_keys", |
| 2609 |
- tests.data.callables.suitable_ssh_keys, |
|
| 2608 |
+ callables.suitable_ssh_keys, |
|
| 2610 | 2609 |
) |
| 2611 | 2610 |
monkeypatch.setattr( |
| 2612 | 2611 |
vault.Vault, |
| 2613 | 2612 |
"phrase_from_key", |
| 2614 |
- tests.data.callables.phrase_from_key, |
|
| 2613 |
+ callables.phrase_from_key, |
|
| 2615 | 2614 |
) |
| 2616 | 2615 |
result = runner.invoke( |
| 2617 | 2616 |
cli.derivepassphrase_vault, |
| ... | ... |
@@ -2633,20 +2632,20 @@ class TestCLI: |
| 2633 | 2632 |
@Parametrize.KEY_INDEX |
| 2634 | 2633 |
def test_204c_key_override_on_command_line( |
| 2635 | 2634 |
self, |
| 2636 |
- running_ssh_agent: tests.data.RunningSSHAgentInfo, |
|
| 2635 |
+ running_ssh_agent: data.RunningSSHAgentInfo, |
|
| 2637 | 2636 |
config: dict[str, Any], |
| 2638 | 2637 |
key_index: int, |
| 2639 | 2638 |
) -> None: |
| 2640 | 2639 |
"""A command-line SSH key will override the configured key.""" |
| 2641 | 2640 |
del running_ssh_agent |
| 2642 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2641 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2643 | 2642 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2644 | 2643 |
# with-statements. |
| 2645 | 2644 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2646 | 2645 |
with contextlib.ExitStack() as stack: |
| 2647 | 2646 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2648 | 2647 |
stack.enter_context( |
| 2649 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 2648 |
+ pytest_machinery.isolated_vault_config( |
|
| 2650 | 2649 |
monkeypatch=monkeypatch, |
| 2651 | 2650 |
runner=runner, |
| 2652 | 2651 |
vault_config=config, |
| ... | ... |
@@ -2655,10 +2654,10 @@ class TestCLI: |
| 2655 | 2654 |
monkeypatch.setattr( |
| 2656 | 2655 |
ssh_agent.SSHAgentClient, |
| 2657 | 2656 |
"list_keys", |
| 2658 |
- tests.data.callables.list_keys, |
|
| 2657 |
+ callables.list_keys, |
|
| 2659 | 2658 |
) |
| 2660 | 2659 |
monkeypatch.setattr( |
| 2661 |
- ssh_agent.SSHAgentClient, "sign", tests.data.callables.sign |
|
| 2660 |
+ ssh_agent.SSHAgentClient, "sign", callables.sign |
|
| 2662 | 2661 |
) |
| 2663 | 2662 |
result = runner.invoke( |
| 2664 | 2663 |
cli.derivepassphrase_vault, |
| ... | ... |
@@ -2674,18 +2673,18 @@ class TestCLI: |
| 2674 | 2673 |
|
| 2675 | 2674 |
def test_205_service_phrase_if_key_in_global_config( |
| 2676 | 2675 |
self, |
| 2677 |
- running_ssh_agent: tests.data.RunningSSHAgentInfo, |
|
| 2676 |
+ running_ssh_agent: data.RunningSSHAgentInfo, |
|
| 2678 | 2677 |
) -> None: |
| 2679 | 2678 |
"""A command-line passphrase will override the configured key.""" |
| 2680 | 2679 |
del running_ssh_agent |
| 2681 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2680 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2682 | 2681 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2683 | 2682 |
# with-statements. |
| 2684 | 2683 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2685 | 2684 |
with contextlib.ExitStack() as stack: |
| 2686 | 2685 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2687 | 2686 |
stack.enter_context( |
| 2688 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 2687 |
+ pytest_machinery.isolated_vault_config( |
|
| 2689 | 2688 |
monkeypatch=monkeypatch, |
| 2690 | 2689 |
runner=runner, |
| 2691 | 2690 |
vault_config={
|
| ... | ... |
@@ -2702,10 +2701,10 @@ class TestCLI: |
| 2702 | 2701 |
monkeypatch.setattr( |
| 2703 | 2702 |
ssh_agent.SSHAgentClient, |
| 2704 | 2703 |
"list_keys", |
| 2705 |
- tests.data.callables.list_keys, |
|
| 2704 |
+ callables.list_keys, |
|
| 2706 | 2705 |
) |
| 2707 | 2706 |
monkeypatch.setattr( |
| 2708 |
- ssh_agent.SSHAgentClient, "sign", tests.data.callables.sign |
|
| 2707 |
+ ssh_agent.SSHAgentClient, "sign", callables.sign |
|
| 2709 | 2708 |
) |
| 2710 | 2709 |
result = runner.invoke( |
| 2711 | 2710 |
cli.derivepassphrase_vault, |
| ... | ... |
@@ -2725,21 +2724,21 @@ class TestCLI: |
| 2725 | 2724 |
@Parametrize.KEY_OVERRIDING_IN_CONFIG |
| 2726 | 2725 |
def test_206_setting_phrase_thus_overriding_key_in_config( |
| 2727 | 2726 |
self, |
| 2728 |
- running_ssh_agent: tests.data.RunningSSHAgentInfo, |
|
| 2727 |
+ running_ssh_agent: data.RunningSSHAgentInfo, |
|
| 2729 | 2728 |
caplog: pytest.LogCaptureFixture, |
| 2730 | 2729 |
config: _types.VaultConfig, |
| 2731 | 2730 |
command_line: list[str], |
| 2732 | 2731 |
) -> None: |
| 2733 | 2732 |
"""Configuring a passphrase atop an SSH key works, but warns.""" |
| 2734 | 2733 |
del running_ssh_agent |
| 2735 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2734 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2736 | 2735 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2737 | 2736 |
# with-statements. |
| 2738 | 2737 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2739 | 2738 |
with contextlib.ExitStack() as stack: |
| 2740 | 2739 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2741 | 2740 |
stack.enter_context( |
| 2742 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 2741 |
+ pytest_machinery.isolated_vault_config( |
|
| 2743 | 2742 |
monkeypatch=monkeypatch, |
| 2744 | 2743 |
runner=runner, |
| 2745 | 2744 |
vault_config=config, |
| ... | ... |
@@ -2748,10 +2747,10 @@ class TestCLI: |
| 2748 | 2747 |
monkeypatch.setattr( |
| 2749 | 2748 |
ssh_agent.SSHAgentClient, |
| 2750 | 2749 |
"list_keys", |
| 2751 |
- tests.data.callables.list_keys, |
|
| 2750 |
+ callables.list_keys, |
|
| 2752 | 2751 |
) |
| 2753 | 2752 |
monkeypatch.setattr( |
| 2754 |
- ssh_agent.SSHAgentClient, "sign", tests.data.callables.sign |
|
| 2753 |
+ ssh_agent.SSHAgentClient, "sign", callables.sign |
|
| 2755 | 2754 |
) |
| 2756 | 2755 |
result = runner.invoke( |
| 2757 | 2756 |
cli.derivepassphrase_vault, |
| ... | ... |
@@ -2764,10 +2763,10 @@ class TestCLI: |
| 2764 | 2763 |
assert result.stderr, "expected known error output" |
| 2765 | 2764 |
err_lines = result.stderr.splitlines(False) |
| 2766 | 2765 |
assert err_lines[0].startswith("Passphrase:")
|
| 2767 |
- assert tests.machinery.warning_emitted( |
|
| 2766 |
+ assert machinery.warning_emitted( |
|
| 2768 | 2767 |
"Setting a service passphrase is ineffective ", |
| 2769 | 2768 |
caplog.record_tuples, |
| 2770 |
- ) or tests.machinery.warning_emitted( |
|
| 2769 |
+ ) or machinery.warning_emitted( |
|
| 2771 | 2770 |
"Setting a global passphrase is ineffective ", |
| 2772 | 2771 |
caplog.record_tuples, |
| 2773 | 2772 |
), "expected known warning message" |
| ... | ... |
@@ -2792,14 +2791,14 @@ class TestCLI: |
| 2792 | 2791 |
) -> None: |
| 2793 | 2792 |
"""Service notes are printed, if they exist.""" |
| 2794 | 2793 |
hypothesis.assume("Error:" not in notes)
|
| 2795 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2794 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2796 | 2795 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2797 | 2796 |
# with-statements. |
| 2798 | 2797 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2799 | 2798 |
with contextlib.ExitStack() as stack: |
| 2800 | 2799 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2801 | 2800 |
stack.enter_context( |
| 2802 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 2801 |
+ pytest_machinery.isolated_vault_config( |
|
| 2803 | 2802 |
monkeypatch=monkeypatch, |
| 2804 | 2803 |
runner=runner, |
| 2805 | 2804 |
vault_config={
|
| ... | ... |
@@ -2838,14 +2837,14 @@ class TestCLI: |
| 2838 | 2837 |
option: str, |
| 2839 | 2838 |
) -> None: |
| 2840 | 2839 |
"""Requesting invalidly many characters from a class fails.""" |
| 2841 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2840 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2842 | 2841 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2843 | 2842 |
# with-statements. |
| 2844 | 2843 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2845 | 2844 |
with contextlib.ExitStack() as stack: |
| 2846 | 2845 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2847 | 2846 |
stack.enter_context( |
| 2848 |
- tests.machinery.pytest.isolated_config( |
|
| 2847 |
+ pytest_machinery.isolated_config( |
|
| 2849 | 2848 |
monkeypatch=monkeypatch, |
| 2850 | 2849 |
runner=runner, |
| 2851 | 2850 |
) |
| ... | ... |
@@ -2870,14 +2869,14 @@ class TestCLI: |
| 2870 | 2869 |
check_success: bool, |
| 2871 | 2870 |
) -> None: |
| 2872 | 2871 |
"""We require or forbid a service argument, depending on options.""" |
| 2873 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2872 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2874 | 2873 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2875 | 2874 |
# with-statements. |
| 2876 | 2875 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2877 | 2876 |
with contextlib.ExitStack() as stack: |
| 2878 | 2877 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2879 | 2878 |
stack.enter_context( |
| 2880 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 2879 |
+ pytest_machinery.isolated_vault_config( |
|
| 2881 | 2880 |
monkeypatch=monkeypatch, |
| 2882 | 2881 |
runner=runner, |
| 2883 | 2882 |
vault_config={"global": {"phrase": "abc"}, "services": {}},
|
| ... | ... |
@@ -2886,7 +2885,7 @@ class TestCLI: |
| 2886 | 2885 |
monkeypatch.setattr( |
| 2887 | 2886 |
cli_helpers, |
| 2888 | 2887 |
"prompt_for_passphrase", |
| 2889 |
- tests.data.callables.auto_prompt, |
|
| 2888 |
+ callables.auto_prompt, |
|
| 2890 | 2889 |
) |
| 2891 | 2890 |
result = runner.invoke( |
| 2892 | 2891 |
cli.derivepassphrase_vault, |
| ... | ... |
@@ -2914,7 +2913,7 @@ class TestCLI: |
| 2914 | 2913 |
with contextlib.ExitStack() as stack: |
| 2915 | 2914 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2916 | 2915 |
stack.enter_context( |
| 2917 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 2916 |
+ pytest_machinery.isolated_vault_config( |
|
| 2918 | 2917 |
monkeypatch=monkeypatch, |
| 2919 | 2918 |
runner=runner, |
| 2920 | 2919 |
vault_config={
|
| ... | ... |
@@ -2926,7 +2925,7 @@ class TestCLI: |
| 2926 | 2925 |
monkeypatch.setattr( |
| 2927 | 2926 |
cli_helpers, |
| 2928 | 2927 |
"prompt_for_passphrase", |
| 2929 |
- tests.data.callables.auto_prompt, |
|
| 2928 |
+ callables.auto_prompt, |
|
| 2930 | 2929 |
) |
| 2931 | 2930 |
result = runner.invoke( |
| 2932 | 2931 |
cli.derivepassphrase_vault, |
| ... | ... |
@@ -2949,18 +2948,18 @@ class TestCLI: |
| 2949 | 2948 |
def is_expected_warning(record: tuple[str, int, str]) -> bool: |
| 2950 | 2949 |
return is_harmless_config_import_warning( |
| 2951 | 2950 |
record |
| 2952 |
- ) or tests.machinery.warning_emitted( |
|
| 2951 |
+ ) or machinery.warning_emitted( |
|
| 2953 | 2952 |
"An empty SERVICE is not supported by vault(1)", [record] |
| 2954 | 2953 |
) |
| 2955 | 2954 |
|
| 2956 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 2955 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 2957 | 2956 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 2958 | 2957 |
# with-statements. |
| 2959 | 2958 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 2960 | 2959 |
with contextlib.ExitStack() as stack: |
| 2961 | 2960 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 2962 | 2961 |
stack.enter_context( |
| 2963 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 2962 |
+ pytest_machinery.isolated_vault_config( |
|
| 2964 | 2963 |
monkeypatch=monkeypatch, |
| 2965 | 2964 |
runner=runner, |
| 2966 | 2965 |
vault_config={"services": {}},
|
| ... | ... |
@@ -2969,7 +2968,7 @@ class TestCLI: |
| 2969 | 2968 |
monkeypatch.setattr( |
| 2970 | 2969 |
cli_helpers, |
| 2971 | 2970 |
"prompt_for_passphrase", |
| 2972 |
- tests.data.callables.auto_prompt, |
|
| 2971 |
+ callables.auto_prompt, |
|
| 2973 | 2972 |
) |
| 2974 | 2973 |
result = runner.invoke( |
| 2975 | 2974 |
cli.derivepassphrase_vault, |
| ... | ... |
@@ -3009,14 +3008,14 @@ class TestCLI: |
| 3009 | 3008 |
service: bool | None, |
| 3010 | 3009 |
) -> None: |
| 3011 | 3010 |
"""Incompatible options are detected.""" |
| 3012 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 3011 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 3013 | 3012 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 3014 | 3013 |
# with-statements. |
| 3015 | 3014 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 3016 | 3015 |
with contextlib.ExitStack() as stack: |
| 3017 | 3016 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 3018 | 3017 |
stack.enter_context( |
| 3019 |
- tests.machinery.pytest.isolated_config( |
|
| 3018 |
+ pytest_machinery.isolated_config( |
|
| 3020 | 3019 |
monkeypatch=monkeypatch, |
| 3021 | 3020 |
runner=runner, |
| 3022 | 3021 |
) |
| ... | ... |
@@ -3038,14 +3037,14 @@ class TestCLI: |
| 3038 | 3037 |
config: Any, |
| 3039 | 3038 |
) -> None: |
| 3040 | 3039 |
"""Importing a configuration works.""" |
| 3041 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 3040 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 3042 | 3041 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 3043 | 3042 |
# with-statements. |
| 3044 | 3043 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 3045 | 3044 |
with contextlib.ExitStack() as stack: |
| 3046 | 3045 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 3047 | 3046 |
stack.enter_context( |
| 3048 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 3047 |
+ pytest_machinery.isolated_vault_config( |
|
| 3049 | 3048 |
monkeypatch=monkeypatch, |
| 3050 | 3049 |
runner=runner, |
| 3051 | 3050 |
vault_config={"services": {}},
|
| ... | ... |
@@ -3075,16 +3074,16 @@ class TestCLI: |
| 3075 | 3074 |
], |
| 3076 | 3075 |
) |
| 3077 | 3076 |
@hypothesis.given( |
| 3078 |
- conf=tests.machinery.hypothesis.smudged_vault_test_config( |
|
| 3077 |
+ conf=hypothesis_machinery.smudged_vault_test_config( |
|
| 3079 | 3078 |
strategies.sampled_from([ |
| 3080 |
- conf for conf in tests.data.TEST_CONFIGS if conf.is_valid() |
|
| 3079 |
+ conf for conf in data.TEST_CONFIGS if conf.is_valid() |
|
| 3081 | 3080 |
]) |
| 3082 | 3081 |
) |
| 3083 | 3082 |
) |
| 3084 | 3083 |
def test_213a_import_config_success( |
| 3085 | 3084 |
self, |
| 3086 | 3085 |
caplog: pytest.LogCaptureFixture, |
| 3087 |
- conf: tests.data.VaultTestConfig, |
|
| 3086 |
+ conf: data.VaultTestConfig, |
|
| 3088 | 3087 |
) -> None: |
| 3089 | 3088 |
"""Importing a smudged configuration works. |
| 3090 | 3089 |
|
| ... | ... |
@@ -3096,14 +3095,14 @@ class TestCLI: |
| 3096 | 3095 |
_types.clean_up_falsy_vault_config_values(config2) |
| 3097 | 3096 |
# Reset caplog between hypothesis runs. |
| 3098 | 3097 |
caplog.clear() |
| 3099 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 3098 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 3100 | 3099 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 3101 | 3100 |
# with-statements. |
| 3102 | 3101 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 3103 | 3102 |
with contextlib.ExitStack() as stack: |
| 3104 | 3103 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 3105 | 3104 |
stack.enter_context( |
| 3106 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 3105 |
+ pytest_machinery.isolated_vault_config( |
|
| 3107 | 3106 |
monkeypatch=monkeypatch, |
| 3108 | 3107 |
runner=runner, |
| 3109 | 3108 |
vault_config={"services": {}},
|
| ... | ... |
@@ -3130,14 +3129,14 @@ class TestCLI: |
| 3130 | 3129 |
self, |
| 3131 | 3130 |
) -> None: |
| 3132 | 3131 |
"""Importing an invalid config fails.""" |
| 3133 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 3132 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 3134 | 3133 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 3135 | 3134 |
# with-statements. |
| 3136 | 3135 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 3137 | 3136 |
with contextlib.ExitStack() as stack: |
| 3138 | 3137 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 3139 | 3138 |
stack.enter_context( |
| 3140 |
- tests.machinery.pytest.isolated_config( |
|
| 3139 |
+ pytest_machinery.isolated_config( |
|
| 3141 | 3140 |
monkeypatch=monkeypatch, |
| 3142 | 3141 |
runner=runner, |
| 3143 | 3142 |
) |
| ... | ... |
@@ -3156,14 +3155,14 @@ class TestCLI: |
| 3156 | 3155 |
self, |
| 3157 | 3156 |
) -> None: |
| 3158 | 3157 |
"""Importing an invalid config fails.""" |
| 3159 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 3158 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 3160 | 3159 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 3161 | 3160 |
# with-statements. |
| 3162 | 3161 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 3163 | 3162 |
with contextlib.ExitStack() as stack: |
| 3164 | 3163 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 3165 | 3164 |
stack.enter_context( |
| 3166 |
- tests.machinery.pytest.isolated_config( |
|
| 3165 |
+ pytest_machinery.isolated_config( |
|
| 3167 | 3166 |
monkeypatch=monkeypatch, |
| 3168 | 3167 |
runner=runner, |
| 3169 | 3168 |
) |
| ... | ... |
@@ -3182,7 +3181,7 @@ class TestCLI: |
| 3182 | 3181 |
self, |
| 3183 | 3182 |
) -> None: |
| 3184 | 3183 |
"""Importing an invalid config fails.""" |
| 3185 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 3184 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 3186 | 3185 |
# `isolated_vault_config` ensures the configuration is valid |
| 3187 | 3186 |
# JSON. So, to pass an actual broken configuration, we must |
| 3188 | 3187 |
# open the configuration file ourselves afterwards, inside the |
| ... | ... |
@@ -3194,7 +3193,7 @@ class TestCLI: |
| 3194 | 3193 |
with contextlib.ExitStack() as stack: |
| 3195 | 3194 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 3196 | 3195 |
stack.enter_context( |
| 3197 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 3196 |
+ pytest_machinery.isolated_vault_config( |
|
| 3198 | 3197 |
monkeypatch=monkeypatch, |
| 3199 | 3198 |
runner=runner, |
| 3200 | 3199 |
vault_config={"services": {}},
|
| ... | ... |
@@ -3223,14 +3222,14 @@ class TestCLI: |
| 3223 | 3222 |
config: Any, |
| 3224 | 3223 |
) -> None: |
| 3225 | 3224 |
"""Exporting a configuration works.""" |
| 3226 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 3225 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 3227 | 3226 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 3228 | 3227 |
# with-statements. |
| 3229 | 3228 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 3230 | 3229 |
with contextlib.ExitStack() as stack: |
| 3231 | 3230 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 3232 | 3231 |
stack.enter_context( |
| 3233 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 3232 |
+ pytest_machinery.isolated_vault_config( |
|
| 3234 | 3233 |
monkeypatch=monkeypatch, |
| 3235 | 3234 |
runner=runner, |
| 3236 | 3235 |
vault_config=config, |
| ... | ... |
@@ -3263,14 +3262,14 @@ class TestCLI: |
| 3263 | 3262 |
export_options: list[str], |
| 3264 | 3263 |
) -> None: |
| 3265 | 3264 |
"""Exporting the default, empty config works.""" |
| 3266 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 3265 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 3267 | 3266 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 3268 | 3267 |
# with-statements. |
| 3269 | 3268 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 3270 | 3269 |
with contextlib.ExitStack() as stack: |
| 3271 | 3270 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 3272 | 3271 |
stack.enter_context( |
| 3273 |
- tests.machinery.pytest.isolated_config( |
|
| 3272 |
+ pytest_machinery.isolated_config( |
|
| 3274 | 3273 |
monkeypatch=monkeypatch, |
| 3275 | 3274 |
runner=runner, |
| 3276 | 3275 |
) |
| ... | ... |
@@ -3295,14 +3294,14 @@ class TestCLI: |
| 3295 | 3294 |
export_options: list[str], |
| 3296 | 3295 |
) -> None: |
| 3297 | 3296 |
"""Exporting an invalid config fails.""" |
| 3298 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 3297 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 3299 | 3298 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 3300 | 3299 |
# with-statements. |
| 3301 | 3300 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 3302 | 3301 |
with contextlib.ExitStack() as stack: |
| 3303 | 3302 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 3304 | 3303 |
stack.enter_context( |
| 3305 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 3304 |
+ pytest_machinery.isolated_vault_config( |
|
| 3306 | 3305 |
monkeypatch=monkeypatch, |
| 3307 | 3306 |
runner=runner, |
| 3308 | 3307 |
vault_config={},
|
| ... | ... |
@@ -3324,14 +3323,14 @@ class TestCLI: |
| 3324 | 3323 |
export_options: list[str], |
| 3325 | 3324 |
) -> None: |
| 3326 | 3325 |
"""Exporting an invalid config fails.""" |
| 3327 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 3326 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 3328 | 3327 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 3329 | 3328 |
# with-statements. |
| 3330 | 3329 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 3331 | 3330 |
with contextlib.ExitStack() as stack: |
| 3332 | 3331 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 3333 | 3332 |
stack.enter_context( |
| 3334 |
- tests.machinery.pytest.isolated_config( |
|
| 3333 |
+ pytest_machinery.isolated_config( |
|
| 3335 | 3334 |
monkeypatch=monkeypatch, |
| 3336 | 3335 |
runner=runner, |
| 3337 | 3336 |
) |
| ... | ... |
@@ -3355,14 +3354,14 @@ class TestCLI: |
| 3355 | 3354 |
export_options: list[str], |
| 3356 | 3355 |
) -> None: |
| 3357 | 3356 |
"""Exporting an invalid config fails.""" |
| 3358 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 3357 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 3359 | 3358 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 3360 | 3359 |
# with-statements. |
| 3361 | 3360 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 3362 | 3361 |
with contextlib.ExitStack() as stack: |
| 3363 | 3362 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 3364 | 3363 |
stack.enter_context( |
| 3365 |
- tests.machinery.pytest.isolated_config( |
|
| 3364 |
+ pytest_machinery.isolated_config( |
|
| 3366 | 3365 |
monkeypatch=monkeypatch, |
| 3367 | 3366 |
runner=runner, |
| 3368 | 3367 |
) |
| ... | ... |
@@ -3378,21 +3377,21 @@ class TestCLI: |
| 3378 | 3377 |
"expected error exit and known error message" |
| 3379 | 3378 |
) |
| 3380 | 3379 |
|
| 3381 |
- @tests.machinery.pytest.skip_if_on_the_annoying_os |
|
| 3380 |
+ @pytest_machinery.skip_if_on_the_annoying_os |
|
| 3382 | 3381 |
@Parametrize.EXPORT_FORMAT_OPTIONS |
| 3383 | 3382 |
def test_214e_export_settings_settings_directory_not_a_directory( |
| 3384 | 3383 |
self, |
| 3385 | 3384 |
export_options: list[str], |
| 3386 | 3385 |
) -> None: |
| 3387 | 3386 |
"""Exporting an invalid config fails.""" |
| 3388 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 3387 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 3389 | 3388 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 3390 | 3389 |
# with-statements. |
| 3391 | 3390 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 3392 | 3391 |
with contextlib.ExitStack() as stack: |
| 3393 | 3392 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 3394 | 3393 |
stack.enter_context( |
| 3395 |
- tests.machinery.pytest.isolated_config( |
|
| 3394 |
+ pytest_machinery.isolated_config( |
|
| 3396 | 3395 |
monkeypatch=monkeypatch, |
| 3397 | 3396 |
runner=runner, |
| 3398 | 3397 |
) |
| ... | ... |
@@ -3443,14 +3442,14 @@ class TestCLI: |
| 3443 | 3442 |
if notes_placement == "before" |
| 3444 | 3443 |
else f"{result_phrase}\n\n{notes}\n\n"
|
| 3445 | 3444 |
) |
| 3446 |
- runner = tests.machinery.CliRunner(mix_stderr=True) |
|
| 3445 |
+ runner = machinery.CliRunner(mix_stderr=True) |
|
| 3447 | 3446 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 3448 | 3447 |
# with-statements. |
| 3449 | 3448 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 3450 | 3449 |
with contextlib.ExitStack() as stack: |
| 3451 | 3450 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 3452 | 3451 |
stack.enter_context( |
| 3453 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 3452 |
+ pytest_machinery.isolated_vault_config( |
|
| 3454 | 3453 |
monkeypatch=monkeypatch, |
| 3455 | 3454 |
runner=runner, |
| 3456 | 3455 |
vault_config=vault_config, |
| ... | ... |
@@ -3496,14 +3495,14 @@ class TestCLI: |
| 3496 | 3495 |
""" |
| 3497 | 3496 |
# Reset caplog between hypothesis runs. |
| 3498 | 3497 |
caplog.clear() |
| 3499 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 3498 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 3500 | 3499 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 3501 | 3500 |
# with-statements. |
| 3502 | 3501 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 3503 | 3502 |
with contextlib.ExitStack() as stack: |
| 3504 | 3503 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 3505 | 3504 |
stack.enter_context( |
| 3506 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 3505 |
+ pytest_machinery.isolated_vault_config( |
|
| 3507 | 3506 |
monkeypatch=monkeypatch, |
| 3508 | 3507 |
runner=runner, |
| 3509 | 3508 |
vault_config={
|
| ... | ... |
@@ -3535,7 +3534,7 @@ class TestCLI: |
| 3535 | 3534 |
) |
| 3536 | 3535 |
assert result.clean_exit(), "expected clean exit" |
| 3537 | 3536 |
assert all(map(is_warning_line, result.stderr.splitlines(True))) |
| 3538 |
- assert modern_editor_interface or tests.machinery.warning_emitted( |
|
| 3537 |
+ assert modern_editor_interface or machinery.warning_emitted( |
|
| 3539 | 3538 |
"A backup copy of the old notes was saved", |
| 3540 | 3539 |
caplog.record_tuples, |
| 3541 | 3540 |
), "expected known warning message in stderr" |
| ... | ... |
@@ -3586,14 +3585,14 @@ class TestCLI: |
| 3586 | 3585 |
return " " + notes.strip() + "\n\n\n\n\n\n" |
| 3587 | 3586 |
|
| 3588 | 3587 |
edit_funcs = {"empty": empty, "space": space}
|
| 3589 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 3588 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 3590 | 3589 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 3591 | 3590 |
# with-statements. |
| 3592 | 3591 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 3593 | 3592 |
with contextlib.ExitStack() as stack: |
| 3594 | 3593 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 3595 | 3594 |
stack.enter_context( |
| 3596 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 3595 |
+ pytest_machinery.isolated_vault_config( |
|
| 3597 | 3596 |
monkeypatch=monkeypatch, |
| 3598 | 3597 |
runner=runner, |
| 3599 | 3598 |
vault_config={
|
| ... | ... |
@@ -3675,14 +3674,14 @@ class TestCLI: |
| 3675 | 3674 |
hypothesis.assume(str(notes_marker) not in notes.strip()) |
| 3676 | 3675 |
# Reset caplog between hypothesis runs. |
| 3677 | 3676 |
caplog.clear() |
| 3678 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 3677 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 3679 | 3678 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 3680 | 3679 |
# with-statements. |
| 3681 | 3680 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 3682 | 3681 |
with contextlib.ExitStack() as stack: |
| 3683 | 3682 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 3684 | 3683 |
stack.enter_context( |
| 3685 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 3684 |
+ pytest_machinery.isolated_vault_config( |
|
| 3686 | 3685 |
monkeypatch=monkeypatch, |
| 3687 | 3686 |
runner=runner, |
| 3688 | 3687 |
vault_config={
|
| ... | ... |
@@ -3716,7 +3715,7 @@ class TestCLI: |
| 3716 | 3715 |
assert not result.stderr or all( |
| 3717 | 3716 |
map(is_warning_line, result.stderr.splitlines(True)) |
| 3718 | 3717 |
) |
| 3719 |
- assert not caplog.record_tuples or tests.machinery.warning_emitted( |
|
| 3718 |
+ assert not caplog.record_tuples or machinery.warning_emitted( |
|
| 3720 | 3719 |
"A backup copy of the old notes was saved", |
| 3721 | 3720 |
caplog.record_tuples, |
| 3722 | 3721 |
), "expected known warning message in stderr" |
| ... | ... |
@@ -3752,14 +3751,14 @@ class TestCLI: |
| 3752 | 3751 |
Aborting is only supported with the modern editor interface. |
| 3753 | 3752 |
|
| 3754 | 3753 |
""" |
| 3755 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 3754 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 3756 | 3755 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 3757 | 3756 |
# with-statements. |
| 3758 | 3757 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 3759 | 3758 |
with contextlib.ExitStack() as stack: |
| 3760 | 3759 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 3761 | 3760 |
stack.enter_context( |
| 3762 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 3761 |
+ pytest_machinery.isolated_vault_config( |
|
| 3763 | 3762 |
monkeypatch=monkeypatch, |
| 3764 | 3763 |
runner=runner, |
| 3765 | 3764 |
vault_config={
|
| ... | ... |
@@ -3800,14 +3799,14 @@ class TestCLI: |
| 3800 | 3799 |
Aborting is only supported with the modern editor interface. |
| 3801 | 3800 |
|
| 3802 | 3801 |
""" |
| 3803 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 3802 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 3804 | 3803 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 3805 | 3804 |
# with-statements. |
| 3806 | 3805 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 3807 | 3806 |
with contextlib.ExitStack() as stack: |
| 3808 | 3807 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 3809 | 3808 |
stack.enter_context( |
| 3810 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 3809 |
+ pytest_machinery.isolated_vault_config( |
|
| 3811 | 3810 |
monkeypatch=monkeypatch, |
| 3812 | 3811 |
runner=runner, |
| 3813 | 3812 |
vault_config={
|
| ... | ... |
@@ -3871,14 +3870,14 @@ class TestCLI: |
| 3871 | 3870 |
} |
| 3872 | 3871 |
# Reset caplog between hypothesis runs. |
| 3873 | 3872 |
caplog.clear() |
| 3874 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 3873 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 3875 | 3874 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 3876 | 3875 |
# with-statements. |
| 3877 | 3876 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 3878 | 3877 |
with contextlib.ExitStack() as stack: |
| 3879 | 3878 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 3880 | 3879 |
stack.enter_context( |
| 3881 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 3880 |
+ pytest_machinery.isolated_vault_config( |
|
| 3882 | 3881 |
monkeypatch=monkeypatch, |
| 3883 | 3882 |
runner=runner, |
| 3884 | 3883 |
vault_config=vault_config, |
| ... | ... |
@@ -3919,7 +3918,7 @@ class TestCLI: |
| 3919 | 3918 |
for line in result.stderr.splitlines(True) |
| 3920 | 3919 |
if line.startswith(f"{cli.PROG_NAME}: ")
|
| 3921 | 3920 |
) |
| 3922 |
- assert tests.machinery.warning_emitted( |
|
| 3921 |
+ assert machinery.warning_emitted( |
|
| 3923 | 3922 |
"Specifying --notes without --config is ineffective. " |
| 3924 | 3923 |
"No notes will be edited.", |
| 3925 | 3924 |
caplog.record_tuples, |
| ... | ... |
@@ -3948,14 +3947,14 @@ class TestCLI: |
| 3948 | 3947 |
the config more readable. |
| 3949 | 3948 |
|
| 3950 | 3949 |
""" |
| 3951 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 3950 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 3952 | 3951 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 3953 | 3952 |
# with-statements. |
| 3954 | 3953 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 3955 | 3954 |
with contextlib.ExitStack() as stack: |
| 3956 | 3955 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 3957 | 3956 |
stack.enter_context( |
| 3958 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 3957 |
+ pytest_machinery.isolated_vault_config( |
|
| 3959 | 3958 |
monkeypatch=monkeypatch, |
| 3960 | 3959 |
runner=runner, |
| 3961 | 3960 |
vault_config={"global": {"phrase": "abc"}, "services": {}},
|
| ... | ... |
@@ -3964,7 +3963,7 @@ class TestCLI: |
| 3964 | 3963 |
monkeypatch.setattr( |
| 3965 | 3964 |
cli_helpers, |
| 3966 | 3965 |
"get_suitable_ssh_keys", |
| 3967 |
- tests.data.callables.suitable_ssh_keys, |
|
| 3966 |
+ callables.suitable_ssh_keys, |
|
| 3968 | 3967 |
) |
| 3969 | 3968 |
result = runner.invoke( |
| 3970 | 3969 |
cli.derivepassphrase_vault, |
| ... | ... |
@@ -3990,14 +3989,14 @@ class TestCLI: |
| 3990 | 3989 |
err_text: str, |
| 3991 | 3990 |
) -> None: |
| 3992 | 3991 |
"""Storing invalid settings via `--config` fails.""" |
| 3993 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 3992 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 3994 | 3993 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 3995 | 3994 |
# with-statements. |
| 3996 | 3995 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 3997 | 3996 |
with contextlib.ExitStack() as stack: |
| 3998 | 3997 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 3999 | 3998 |
stack.enter_context( |
| 4000 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 3999 |
+ pytest_machinery.isolated_vault_config( |
|
| 4001 | 4000 |
monkeypatch=monkeypatch, |
| 4002 | 4001 |
runner=runner, |
| 4003 | 4002 |
vault_config={"global": {"phrase": "abc"}, "services": {}},
|
| ... | ... |
@@ -4006,7 +4005,7 @@ class TestCLI: |
| 4006 | 4005 |
monkeypatch.setattr( |
| 4007 | 4006 |
cli_helpers, |
| 4008 | 4007 |
"get_suitable_ssh_keys", |
| 4009 |
- tests.data.callables.suitable_ssh_keys, |
|
| 4008 |
+ callables.suitable_ssh_keys, |
|
| 4010 | 4009 |
) |
| 4011 | 4010 |
result = runner.invoke( |
| 4012 | 4011 |
cli.derivepassphrase_vault, |
| ... | ... |
@@ -4020,18 +4019,18 @@ class TestCLI: |
| 4020 | 4019 |
|
| 4021 | 4020 |
def test_225a_store_config_fail_manual_no_ssh_key_selection( |
| 4022 | 4021 |
self, |
| 4023 |
- running_ssh_agent: tests.data.RunningSSHAgentInfo, |
|
| 4022 |
+ running_ssh_agent: data.RunningSSHAgentInfo, |
|
| 4024 | 4023 |
) -> None: |
| 4025 | 4024 |
"""Not selecting an SSH key during `--config --key` fails.""" |
| 4026 | 4025 |
del running_ssh_agent |
| 4027 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 4026 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 4028 | 4027 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 4029 | 4028 |
# with-statements. |
| 4030 | 4029 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 4031 | 4030 |
with contextlib.ExitStack() as stack: |
| 4032 | 4031 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 4033 | 4032 |
stack.enter_context( |
| 4034 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 4033 |
+ pytest_machinery.isolated_vault_config( |
|
| 4035 | 4034 |
monkeypatch=monkeypatch, |
| 4036 | 4035 |
runner=runner, |
| 4037 | 4036 |
vault_config={"global": {"phrase": "abc"}, "services": {}},
|
| ... | ... |
@@ -4049,7 +4048,7 @@ class TestCLI: |
| 4049 | 4048 |
monkeypatch.setattr( |
| 4050 | 4049 |
cli_helpers, |
| 4051 | 4050 |
"get_suitable_ssh_keys", |
| 4052 |
- tests.data.callables.suitable_ssh_keys, |
|
| 4051 |
+ callables.suitable_ssh_keys, |
|
| 4053 | 4052 |
) |
| 4054 | 4053 |
result = runner.invoke( |
| 4055 | 4054 |
cli.derivepassphrase_vault, |
| ... | ... |
@@ -4062,18 +4061,18 @@ class TestCLI: |
| 4062 | 4061 |
|
| 4063 | 4062 |
def test_225b_store_config_fail_manual_no_ssh_agent( |
| 4064 | 4063 |
self, |
| 4065 |
- running_ssh_agent: tests.data.RunningSSHAgentInfo, |
|
| 4064 |
+ running_ssh_agent: data.RunningSSHAgentInfo, |
|
| 4066 | 4065 |
) -> None: |
| 4067 | 4066 |
"""Not running an SSH agent during `--config --key` fails.""" |
| 4068 | 4067 |
del running_ssh_agent |
| 4069 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 4068 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 4070 | 4069 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 4071 | 4070 |
# with-statements. |
| 4072 | 4071 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 4073 | 4072 |
with contextlib.ExitStack() as stack: |
| 4074 | 4073 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 4075 | 4074 |
stack.enter_context( |
| 4076 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 4075 |
+ pytest_machinery.isolated_vault_config( |
|
| 4077 | 4076 |
monkeypatch=monkeypatch, |
| 4078 | 4077 |
runner=runner, |
| 4079 | 4078 |
vault_config={"global": {"phrase": "abc"}, "services": {}},
|
| ... | ... |
@@ -4091,18 +4090,18 @@ class TestCLI: |
| 4091 | 4090 |
|
| 4092 | 4091 |
def test_225c_store_config_fail_manual_bad_ssh_agent_connection( |
| 4093 | 4092 |
self, |
| 4094 |
- running_ssh_agent: tests.data.RunningSSHAgentInfo, |
|
| 4093 |
+ running_ssh_agent: data.RunningSSHAgentInfo, |
|
| 4095 | 4094 |
) -> None: |
| 4096 | 4095 |
"""Not running a reachable SSH agent during `--config --key` fails.""" |
| 4097 | 4096 |
running_ssh_agent.require_external_address() |
| 4098 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 4097 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 4099 | 4098 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 4100 | 4099 |
# with-statements. |
| 4101 | 4100 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 4102 | 4101 |
with contextlib.ExitStack() as stack: |
| 4103 | 4102 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 4104 | 4103 |
stack.enter_context( |
| 4105 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 4104 |
+ pytest_machinery.isolated_vault_config( |
|
| 4106 | 4105 |
monkeypatch=monkeypatch, |
| 4107 | 4106 |
runner=runner, |
| 4108 | 4107 |
vault_config={"global": {"phrase": "abc"}, "services": {}},
|
| ... | ... |
@@ -4125,20 +4124,20 @@ class TestCLI: |
| 4125 | 4124 |
try_race_free_implementation: bool, |
| 4126 | 4125 |
) -> None: |
| 4127 | 4126 |
"""Using a read-only configuration file with `--config` fails.""" |
| 4128 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 4127 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 4129 | 4128 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 4130 | 4129 |
# with-statements. |
| 4131 | 4130 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 4132 | 4131 |
with contextlib.ExitStack() as stack: |
| 4133 | 4132 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 4134 | 4133 |
stack.enter_context( |
| 4135 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 4134 |
+ pytest_machinery.isolated_vault_config( |
|
| 4136 | 4135 |
monkeypatch=monkeypatch, |
| 4137 | 4136 |
runner=runner, |
| 4138 | 4137 |
vault_config={"global": {"phrase": "abc"}, "services": {}},
|
| 4139 | 4138 |
) |
| 4140 | 4139 |
) |
| 4141 |
- tests.data.callables.make_file_readonly( |
|
| 4140 |
+ callables.make_file_readonly( |
|
| 4142 | 4141 |
cli_helpers.config_filename(subsystem="vault"), |
| 4143 | 4142 |
try_race_free_implementation=try_race_free_implementation, |
| 4144 | 4143 |
) |
| ... | ... |
@@ -4155,14 +4154,14 @@ class TestCLI: |
| 4155 | 4154 |
self, |
| 4156 | 4155 |
) -> None: |
| 4157 | 4156 |
"""OS-erroring with `--config` fails.""" |
| 4158 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 4157 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 4159 | 4158 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 4160 | 4159 |
# with-statements. |
| 4161 | 4160 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 4162 | 4161 |
with contextlib.ExitStack() as stack: |
| 4163 | 4162 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 4164 | 4163 |
stack.enter_context( |
| 4165 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 4164 |
+ pytest_machinery.isolated_vault_config( |
|
| 4166 | 4165 |
monkeypatch=monkeypatch, |
| 4167 | 4166 |
runner=runner, |
| 4168 | 4167 |
vault_config={"global": {"phrase": "abc"}, "services": {}},
|
| ... | ... |
@@ -4188,14 +4187,14 @@ class TestCLI: |
| 4188 | 4187 |
self, |
| 4189 | 4188 |
) -> None: |
| 4190 | 4189 |
"""Issuing conflicting settings to `--config` fails.""" |
| 4191 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 4190 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 4192 | 4191 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 4193 | 4192 |
# with-statements. |
| 4194 | 4193 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 4195 | 4194 |
with contextlib.ExitStack() as stack: |
| 4196 | 4195 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 4197 | 4196 |
stack.enter_context( |
| 4198 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 4197 |
+ pytest_machinery.isolated_vault_config( |
|
| 4199 | 4198 |
monkeypatch=monkeypatch, |
| 4200 | 4199 |
runner=runner, |
| 4201 | 4200 |
vault_config={"global": {"phrase": "abc"}, "services": {}},
|
| ... | ... |
@@ -4218,18 +4217,18 @@ class TestCLI: |
| 4218 | 4217 |
|
| 4219 | 4218 |
def test_225g_store_config_fail_manual_ssh_agent_no_keys_loaded( |
| 4220 | 4219 |
self, |
| 4221 |
- running_ssh_agent: tests.data.RunningSSHAgentInfo, |
|
| 4220 |
+ running_ssh_agent: data.RunningSSHAgentInfo, |
|
| 4222 | 4221 |
) -> None: |
| 4223 | 4222 |
"""Not holding any SSH keys during `--config --key` fails.""" |
| 4224 | 4223 |
del running_ssh_agent |
| 4225 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 4224 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 4226 | 4225 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 4227 | 4226 |
# with-statements. |
| 4228 | 4227 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 4229 | 4228 |
with contextlib.ExitStack() as stack: |
| 4230 | 4229 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 4231 | 4230 |
stack.enter_context( |
| 4232 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 4231 |
+ pytest_machinery.isolated_vault_config( |
|
| 4233 | 4232 |
monkeypatch=monkeypatch, |
| 4234 | 4233 |
runner=runner, |
| 4235 | 4234 |
vault_config={"global": {"phrase": "abc"}, "services": {}},
|
| ... | ... |
@@ -4254,18 +4253,18 @@ class TestCLI: |
| 4254 | 4253 |
|
| 4255 | 4254 |
def test_225h_store_config_fail_manual_ssh_agent_runtime_error( |
| 4256 | 4255 |
self, |
| 4257 |
- running_ssh_agent: tests.data.RunningSSHAgentInfo, |
|
| 4256 |
+ running_ssh_agent: data.RunningSSHAgentInfo, |
|
| 4258 | 4257 |
) -> None: |
| 4259 | 4258 |
"""The SSH agent erroring during `--config --key` fails.""" |
| 4260 | 4259 |
del running_ssh_agent |
| 4261 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 4260 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 4262 | 4261 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 4263 | 4262 |
# with-statements. |
| 4264 | 4263 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 4265 | 4264 |
with contextlib.ExitStack() as stack: |
| 4266 | 4265 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 4267 | 4266 |
stack.enter_context( |
| 4268 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 4267 |
+ pytest_machinery.isolated_vault_config( |
|
| 4269 | 4268 |
monkeypatch=monkeypatch, |
| 4270 | 4269 |
runner=runner, |
| 4271 | 4270 |
vault_config={"global": {"phrase": "abc"}, "services": {}},
|
| ... | ... |
@@ -4287,18 +4286,18 @@ class TestCLI: |
| 4287 | 4286 |
|
| 4288 | 4287 |
def test_225i_store_config_fail_manual_ssh_agent_refuses( |
| 4289 | 4288 |
self, |
| 4290 |
- running_ssh_agent: tests.data.RunningSSHAgentInfo, |
|
| 4289 |
+ running_ssh_agent: data.RunningSSHAgentInfo, |
|
| 4291 | 4290 |
) -> None: |
| 4292 | 4291 |
"""The SSH agent refusing during `--config --key` fails.""" |
| 4293 | 4292 |
del running_ssh_agent |
| 4294 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 4293 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 4295 | 4294 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 4296 | 4295 |
# with-statements. |
| 4297 | 4296 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 4298 | 4297 |
with contextlib.ExitStack() as stack: |
| 4299 | 4298 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 4300 | 4299 |
stack.enter_context( |
| 4301 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 4300 |
+ pytest_machinery.isolated_vault_config( |
|
| 4302 | 4301 |
monkeypatch=monkeypatch, |
| 4303 | 4302 |
runner=runner, |
| 4304 | 4303 |
vault_config={"global": {"phrase": "abc"}, "services": {}},
|
| ... | ... |
@@ -4322,14 +4321,14 @@ class TestCLI: |
| 4322 | 4321 |
|
| 4323 | 4322 |
def test_226_no_arguments(self) -> None: |
| 4324 | 4323 |
"""Calling `derivepassphrase vault` without any arguments fails.""" |
| 4325 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 4324 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 4326 | 4325 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 4327 | 4326 |
# with-statements. |
| 4328 | 4327 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 4329 | 4328 |
with contextlib.ExitStack() as stack: |
| 4330 | 4329 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 4331 | 4330 |
stack.enter_context( |
| 4332 |
- tests.machinery.pytest.isolated_config( |
|
| 4331 |
+ pytest_machinery.isolated_config( |
|
| 4333 | 4332 |
monkeypatch=monkeypatch, |
| 4334 | 4333 |
runner=runner, |
| 4335 | 4334 |
) |
| ... | ... |
@@ -4345,14 +4344,14 @@ class TestCLI: |
| 4345 | 4344 |
self, |
| 4346 | 4345 |
) -> None: |
| 4347 | 4346 |
"""Deriving a passphrase without a passphrase or key fails.""" |
| 4348 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 4347 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 4349 | 4348 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 4350 | 4349 |
# with-statements. |
| 4351 | 4350 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 4352 | 4351 |
with contextlib.ExitStack() as stack: |
| 4353 | 4352 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 4354 | 4353 |
stack.enter_context( |
| 4355 |
- tests.machinery.pytest.isolated_config( |
|
| 4354 |
+ pytest_machinery.isolated_config( |
|
| 4356 | 4355 |
monkeypatch=monkeypatch, |
| 4357 | 4356 |
runner=runner, |
| 4358 | 4357 |
) |
| ... | ... |
@@ -4376,14 +4375,14 @@ class TestCLI: |
| 4376 | 4375 |
[issue #6]: https://github.com/the-13th-letter/derivepassphrase/issues/6 |
| 4377 | 4376 |
|
| 4378 | 4377 |
""" |
| 4379 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 4378 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 4380 | 4379 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 4381 | 4380 |
# with-statements. |
| 4382 | 4381 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 4383 | 4382 |
with contextlib.ExitStack() as stack: |
| 4384 | 4383 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 4385 | 4384 |
stack.enter_context( |
| 4386 |
- tests.machinery.pytest.isolated_config( |
|
| 4385 |
+ pytest_machinery.isolated_config( |
|
| 4387 | 4386 |
monkeypatch=monkeypatch, |
| 4388 | 4387 |
runner=runner, |
| 4389 | 4388 |
) |
| ... | ... |
@@ -4422,14 +4421,14 @@ class TestCLI: |
| 4422 | 4421 |
[issue #6]: https://github.com/the-13th-letter/derivepassphrase/issues/6 |
| 4423 | 4422 |
|
| 4424 | 4423 |
""" |
| 4425 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 4424 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 4426 | 4425 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 4427 | 4426 |
# with-statements. |
| 4428 | 4427 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 4429 | 4428 |
with contextlib.ExitStack() as stack: |
| 4430 | 4429 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 4431 | 4430 |
stack.enter_context( |
| 4432 |
- tests.machinery.pytest.isolated_config( |
|
| 4431 |
+ pytest_machinery.isolated_config( |
|
| 4433 | 4432 |
monkeypatch=monkeypatch, |
| 4434 | 4433 |
runner=runner, |
| 4435 | 4434 |
) |
| ... | ... |
@@ -4461,14 +4460,14 @@ class TestCLI: |
| 4461 | 4460 |
self, |
| 4462 | 4461 |
) -> None: |
| 4463 | 4462 |
"""Storing the configuration reacts even to weird errors.""" |
| 4464 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 4463 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 4465 | 4464 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 4466 | 4465 |
# with-statements. |
| 4467 | 4466 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 4468 | 4467 |
with contextlib.ExitStack() as stack: |
| 4469 | 4468 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 4470 | 4469 |
stack.enter_context( |
| 4471 |
- tests.machinery.pytest.isolated_config( |
|
| 4470 |
+ pytest_machinery.isolated_config( |
|
| 4472 | 4471 |
monkeypatch=monkeypatch, |
| 4473 | 4472 |
runner=runner, |
| 4474 | 4473 |
) |
| ... | ... |
@@ -4500,14 +4499,14 @@ class TestCLI: |
| 4500 | 4499 |
warning_message: str, |
| 4501 | 4500 |
) -> None: |
| 4502 | 4501 |
"""Using unnormalized Unicode passphrases warns.""" |
| 4503 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 4502 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 4504 | 4503 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 4505 | 4504 |
# with-statements. |
| 4506 | 4505 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 4507 | 4506 |
with contextlib.ExitStack() as stack: |
| 4508 | 4507 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 4509 | 4508 |
stack.enter_context( |
| 4510 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 4509 |
+ pytest_machinery.isolated_vault_config( |
|
| 4511 | 4510 |
monkeypatch=monkeypatch, |
| 4512 | 4511 |
runner=runner, |
| 4513 | 4512 |
vault_config={
|
| ... | ... |
@@ -4525,7 +4524,7 @@ class TestCLI: |
| 4525 | 4524 |
input=input, |
| 4526 | 4525 |
) |
| 4527 | 4526 |
assert result.clean_exit(), "expected clean exit" |
| 4528 |
- assert tests.machinery.warning_emitted( |
|
| 4527 |
+ assert machinery.warning_emitted( |
|
| 4529 | 4528 |
warning_message, caplog.record_tuples |
| 4530 | 4529 |
), "expected known warning message in stderr" |
| 4531 | 4530 |
|
| ... | ... |
@@ -4538,14 +4537,14 @@ class TestCLI: |
| 4538 | 4537 |
error_message: str, |
| 4539 | 4538 |
) -> None: |
| 4540 | 4539 |
"""Using unknown Unicode normalization forms fails.""" |
| 4541 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 4540 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 4542 | 4541 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 4543 | 4542 |
# with-statements. |
| 4544 | 4543 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 4545 | 4544 |
with contextlib.ExitStack() as stack: |
| 4546 | 4545 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 4547 | 4546 |
stack.enter_context( |
| 4548 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 4547 |
+ pytest_machinery.isolated_vault_config( |
|
| 4549 | 4548 |
monkeypatch=monkeypatch, |
| 4550 | 4549 |
runner=runner, |
| 4551 | 4550 |
vault_config={
|
| ... | ... |
@@ -4575,14 +4574,14 @@ class TestCLI: |
| 4575 | 4574 |
command_line: list[str], |
| 4576 | 4575 |
) -> None: |
| 4577 | 4576 |
"""Using unknown Unicode normalization forms in the config fails.""" |
| 4578 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 4577 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 4579 | 4578 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 4580 | 4579 |
# with-statements. |
| 4581 | 4580 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 4582 | 4581 |
with contextlib.ExitStack() as stack: |
| 4583 | 4582 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 4584 | 4583 |
stack.enter_context( |
| 4585 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 4584 |
+ pytest_machinery.isolated_vault_config( |
|
| 4586 | 4585 |
monkeypatch=monkeypatch, |
| 4587 | 4586 |
runner=runner, |
| 4588 | 4587 |
vault_config={
|
| ... | ... |
@@ -4615,14 +4614,14 @@ class TestCLI: |
| 4615 | 4614 |
self, |
| 4616 | 4615 |
) -> None: |
| 4617 | 4616 |
"""Loading a user configuration file in an invalid format fails.""" |
| 4618 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 4617 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 4619 | 4618 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 4620 | 4619 |
# with-statements. |
| 4621 | 4620 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 4622 | 4621 |
with contextlib.ExitStack() as stack: |
| 4623 | 4622 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 4624 | 4623 |
stack.enter_context( |
| 4625 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 4624 |
+ pytest_machinery.isolated_vault_config( |
|
| 4626 | 4625 |
monkeypatch=monkeypatch, |
| 4627 | 4626 |
runner=runner, |
| 4628 | 4627 |
vault_config={"services": {}},
|
| ... | ... |
@@ -4643,14 +4642,14 @@ class TestCLI: |
| 4643 | 4642 |
self, |
| 4644 | 4643 |
) -> None: |
| 4645 | 4644 |
"""Loading a user configuration file in an invalid format fails.""" |
| 4646 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 4645 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 4647 | 4646 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 4648 | 4647 |
# with-statements. |
| 4649 | 4648 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 4650 | 4649 |
with contextlib.ExitStack() as stack: |
| 4651 | 4650 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 4652 | 4651 |
stack.enter_context( |
| 4653 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 4652 |
+ pytest_machinery.isolated_vault_config( |
|
| 4654 | 4653 |
monkeypatch=monkeypatch, |
| 4655 | 4654 |
runner=runner, |
| 4656 | 4655 |
vault_config={"services": {}},
|
| ... | ... |
@@ -4677,14 +4676,14 @@ class TestCLI: |
| 4677 | 4676 |
caplog: pytest.LogCaptureFixture, |
| 4678 | 4677 |
) -> None: |
| 4679 | 4678 |
"""Querying the SSH agent without `AF_UNIX` support fails.""" |
| 4680 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 4679 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 4681 | 4680 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 4682 | 4681 |
# with-statements. |
| 4683 | 4682 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 4684 | 4683 |
with contextlib.ExitStack() as stack: |
| 4685 | 4684 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 4686 | 4685 |
stack.enter_context( |
| 4687 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 4686 |
+ pytest_machinery.isolated_vault_config( |
|
| 4688 | 4687 |
monkeypatch=monkeypatch, |
| 4689 | 4688 |
runner=runner, |
| 4690 | 4689 |
vault_config={"global": {"phrase": "abc"}, "services": {}},
|
| ... | ... |
@@ -4705,7 +4704,7 @@ class TestCLI: |
| 4705 | 4704 |
assert result.error_exit( |
| 4706 | 4705 |
error="does not support communicating with it" |
| 4707 | 4706 |
), "expected error exit and known error message" |
| 4708 |
- assert tests.machinery.warning_emitted( |
|
| 4707 |
+ assert machinery.warning_emitted( |
|
| 4709 | 4708 |
"Cannot connect to an SSH agent via UNIX domain sockets", |
| 4710 | 4709 |
caplog.record_tuples, |
| 4711 | 4710 |
), "expected known warning message in stderr" |
| ... | ... |
@@ -4720,14 +4719,14 @@ class TestCLIUtils: |
| 4720 | 4719 |
config: Any, |
| 4721 | 4720 |
) -> None: |
| 4722 | 4721 |
"""[`cli_helpers.load_config`][] works for valid configurations.""" |
| 4723 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 4722 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 4724 | 4723 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 4725 | 4724 |
# with-statements. |
| 4726 | 4725 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 4727 | 4726 |
with contextlib.ExitStack() as stack: |
| 4728 | 4727 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 4729 | 4728 |
stack.enter_context( |
| 4730 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 4729 |
+ pytest_machinery.isolated_vault_config( |
|
| 4731 | 4730 |
monkeypatch=monkeypatch, |
| 4732 | 4731 |
runner=runner, |
| 4733 | 4732 |
vault_config=config, |
| ... | ... |
@@ -4742,14 +4741,14 @@ class TestCLIUtils: |
| 4742 | 4741 |
self, |
| 4743 | 4742 |
) -> None: |
| 4744 | 4743 |
"""[`cli_helpers.save_config`][] fails for bad configurations.""" |
| 4745 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 4744 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 4746 | 4745 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 4747 | 4746 |
# with-statements. |
| 4748 | 4747 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 4749 | 4748 |
with contextlib.ExitStack() as stack: |
| 4750 | 4749 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 4751 | 4750 |
stack.enter_context( |
| 4752 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 4751 |
+ pytest_machinery.isolated_vault_config( |
|
| 4753 | 4752 |
monkeypatch=monkeypatch, |
| 4754 | 4753 |
runner=runner, |
| 4755 | 4754 |
vault_config={},
|
| ... | ... |
@@ -4792,7 +4791,7 @@ class TestCLIUtils: |
| 4792 | 4791 |
click.echo(items[index]) |
| 4793 | 4792 |
click.echo("(Note: Vikings strictly optional.)")
|
| 4794 | 4793 |
|
| 4795 |
- runner = tests.machinery.CliRunner(mix_stderr=True) |
|
| 4794 |
+ runner = machinery.CliRunner(mix_stderr=True) |
|
| 4796 | 4795 |
result = runner.invoke(driver, [], input="9") |
| 4797 | 4796 |
assert result.clean_exit( |
| 4798 | 4797 |
output="""\ |
| ... | ... |
@@ -4889,7 +4888,7 @@ Your selection? (1-10, leave empty to abort): """, |
| 4889 | 4888 |
else: |
| 4890 | 4889 |
click.echo("Great!")
|
| 4891 | 4890 |
|
| 4892 |
- runner = tests.machinery.CliRunner(mix_stderr=True) |
|
| 4891 |
+ runner = machinery.CliRunner(mix_stderr=True) |
|
| 4893 | 4892 |
result = runner.invoke( |
| 4894 | 4893 |
driver, ["Will replace with spam. Confirm, y/n?"], input="y" |
| 4895 | 4894 |
) |
| ... | ... |
@@ -5104,14 +5103,14 @@ Will replace with spam, okay? (Please say "y" or "n".): Boo. |
| 5104 | 5103 |
config, outfile=outfile, prog_name_list=prog_name_list |
| 5105 | 5104 |
) |
| 5106 | 5105 |
script = outfile.getvalue() |
| 5107 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 5106 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 5108 | 5107 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 5109 | 5108 |
# with-statements. |
| 5110 | 5109 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 5111 | 5110 |
with contextlib.ExitStack() as stack: |
| 5112 | 5111 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 5113 | 5112 |
stack.enter_context( |
| 5114 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 5113 |
+ pytest_machinery.isolated_vault_config( |
|
| 5115 | 5114 |
monkeypatch=monkeypatch, |
| 5116 | 5115 |
runner=runner, |
| 5117 | 5116 |
vault_config={"services": {}},
|
| ... | ... |
@@ -5122,7 +5121,7 @@ Will replace with spam, okay? (Please say "y" or "n".): Boo. |
| 5122 | 5121 |
assert cli_helpers.load_config() == config |
| 5123 | 5122 |
|
| 5124 | 5123 |
@hypothesis.given( |
| 5125 |
- global_config_settable=tests.machinery.hypothesis.vault_full_service_config(), |
|
| 5124 |
+ global_config_settable=hypothesis_machinery.vault_full_service_config(), |
|
| 5126 | 5125 |
global_config_importable=strategies.fixed_dictionaries( |
| 5127 | 5126 |
{},
|
| 5128 | 5127 |
optional={
|
| ... | ... |
@@ -5217,7 +5216,7 @@ Will replace with spam, okay? (Please say "y" or "n".): Boo. |
| 5217 | 5216 |
min_size=4, |
| 5218 | 5217 |
max_size=64, |
| 5219 | 5218 |
), |
| 5220 |
- service_config_settable=tests.machinery.hypothesis.vault_full_service_config(), |
|
| 5219 |
+ service_config_settable=hypothesis_machinery.vault_full_service_config(), |
|
| 5221 | 5220 |
service_config_importable=strategies.fixed_dictionaries( |
| 5222 | 5221 |
{},
|
| 5223 | 5222 |
optional={
|
| ... | ... |
@@ -5374,14 +5373,14 @@ Will replace with spam, okay? (Please say "y" or "n".): Boo. |
| 5374 | 5373 |
finally: |
| 5375 | 5374 |
shutil.rmtree(path) |
| 5376 | 5375 |
|
| 5377 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 5376 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 5378 | 5377 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 5379 | 5378 |
# with-statements. |
| 5380 | 5379 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 5381 | 5380 |
with contextlib.ExitStack() as stack: |
| 5382 | 5381 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 5383 | 5382 |
stack.enter_context( |
| 5384 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 5383 |
+ pytest_machinery.isolated_vault_config( |
|
| 5385 | 5384 |
monkeypatch=monkeypatch, |
| 5386 | 5385 |
runner=runner, |
| 5387 | 5386 |
vault_config={"services": {}},
|
| ... | ... |
@@ -5404,7 +5403,7 @@ Will replace with spam, okay? (Please say "y" or "n".): Boo. |
| 5404 | 5403 |
system_tempdir = os.fsdecode(tempfile.gettempdir()) |
| 5405 | 5404 |
our_tempdir = cli_helpers.get_tempdir() |
| 5406 | 5405 |
assert system_tempdir == os.fsdecode(our_tempdir) or ( |
| 5407 |
- # TODO(the-13th-letter): `tests.machinery.pytest.isolated_config` |
|
| 5406 |
+ # TODO(the-13th-letter): `pytest_machinery.isolated_config` |
|
| 5408 | 5407 |
# guarantees that `Path.cwd() == config_filename(None)`. |
| 5409 | 5408 |
# So this sub-branch ought to never trigger in our |
| 5410 | 5409 |
# tests. |
| ... | ... |
@@ -5421,14 +5420,14 @@ Will replace with spam, okay? (Please say "y" or "n".): Boo. |
| 5421 | 5420 |
configuration directory. |
| 5422 | 5421 |
|
| 5423 | 5422 |
""" |
| 5424 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 5423 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 5425 | 5424 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 5426 | 5425 |
# with-statements. |
| 5427 | 5426 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 5428 | 5427 |
with contextlib.ExitStack() as stack: |
| 5429 | 5428 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 5430 | 5429 |
stack.enter_context( |
| 5431 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 5430 |
+ pytest_machinery.isolated_vault_config( |
|
| 5432 | 5431 |
monkeypatch=monkeypatch, |
| 5433 | 5432 |
runner=runner, |
| 5434 | 5433 |
vault_config={"services": {}},
|
| ... | ... |
@@ -5476,14 +5475,14 @@ Will replace with spam, okay? (Please say "y" or "n".): Boo. |
| 5476 | 5475 |
) -> None: |
| 5477 | 5476 |
"""Repeatedly removing the same parts of a configuration works.""" |
| 5478 | 5477 |
for start_config in [config, result_config]: |
| 5479 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 5478 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 5480 | 5479 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 5481 | 5480 |
# with-statements. |
| 5482 | 5481 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 5483 | 5482 |
with contextlib.ExitStack() as stack: |
| 5484 | 5483 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 5485 | 5484 |
stack.enter_context( |
| 5486 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 5485 |
+ pytest_machinery.isolated_vault_config( |
|
| 5487 | 5486 |
monkeypatch=monkeypatch, |
| 5488 | 5487 |
runner=runner, |
| 5489 | 5488 |
vault_config=start_config, |
| ... | ... |
@@ -5526,7 +5525,7 @@ Will replace with spam, okay? (Please say "y" or "n".): Boo. |
| 5526 | 5525 |
@Parametrize.CONNECTION_HINTS |
| 5527 | 5526 |
def test_227_get_suitable_ssh_keys( |
| 5528 | 5527 |
self, |
| 5529 |
- running_ssh_agent: tests.data.RunningSSHAgentInfo, |
|
| 5528 |
+ running_ssh_agent: data.RunningSSHAgentInfo, |
|
| 5530 | 5529 |
conn_hint: str, |
| 5531 | 5530 |
) -> None: |
| 5532 | 5531 |
"""[`cli_helpers.get_suitable_ssh_keys`][] works.""" |
| ... | ... |
@@ -5534,7 +5533,7 @@ Will replace with spam, okay? (Please say "y" or "n".): Boo. |
| 5534 | 5533 |
monkeypatch.setattr( |
| 5535 | 5534 |
ssh_agent.SSHAgentClient, |
| 5536 | 5535 |
"list_keys", |
| 5537 |
- tests.data.callables.list_keys, |
|
| 5536 |
+ callables.list_keys, |
|
| 5538 | 5537 |
) |
| 5539 | 5538 |
hint: ssh_agent.SSHAgentClient | _types.SSHAgentSocket | None |
| 5540 | 5539 |
# TODO(the-13th-letter): Rewrite using structural pattern |
| ... | ... |
@@ -5629,14 +5628,14 @@ class TestCLITransition: |
| 5629 | 5628 |
config: Any, |
| 5630 | 5629 |
) -> None: |
| 5631 | 5630 |
"""Loading the old settings file works.""" |
| 5632 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 5631 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 5633 | 5632 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 5634 | 5633 |
# with-statements. |
| 5635 | 5634 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 5636 | 5635 |
with contextlib.ExitStack() as stack: |
| 5637 | 5636 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 5638 | 5637 |
stack.enter_context( |
| 5639 |
- tests.machinery.pytest.isolated_config( |
|
| 5638 |
+ pytest_machinery.isolated_config( |
|
| 5640 | 5639 |
monkeypatch=monkeypatch, |
| 5641 | 5640 |
runner=runner, |
| 5642 | 5641 |
) |
| ... | ... |
@@ -5652,14 +5651,14 @@ class TestCLITransition: |
| 5652 | 5651 |
config: Any, |
| 5653 | 5652 |
) -> None: |
| 5654 | 5653 |
"""Migrating the old settings file works.""" |
| 5655 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 5654 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 5656 | 5655 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 5657 | 5656 |
# with-statements. |
| 5658 | 5657 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 5659 | 5658 |
with contextlib.ExitStack() as stack: |
| 5660 | 5659 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 5661 | 5660 |
stack.enter_context( |
| 5662 |
- tests.machinery.pytest.isolated_config( |
|
| 5661 |
+ pytest_machinery.isolated_config( |
|
| 5663 | 5662 |
monkeypatch=monkeypatch, |
| 5664 | 5663 |
runner=runner, |
| 5665 | 5664 |
) |
| ... | ... |
@@ -5675,14 +5674,14 @@ class TestCLITransition: |
| 5675 | 5674 |
config: Any, |
| 5676 | 5675 |
) -> None: |
| 5677 | 5676 |
"""Migrating the old settings file atop a directory fails.""" |
| 5678 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 5677 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 5679 | 5678 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 5680 | 5679 |
# with-statements. |
| 5681 | 5680 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 5682 | 5681 |
with contextlib.ExitStack() as stack: |
| 5683 | 5682 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 5684 | 5683 |
stack.enter_context( |
| 5685 |
- tests.machinery.pytest.isolated_config( |
|
| 5684 |
+ pytest_machinery.isolated_config( |
|
| 5686 | 5685 |
monkeypatch=monkeypatch, |
| 5687 | 5686 |
runner=runner, |
| 5688 | 5687 |
) |
| ... | ... |
@@ -5705,14 +5704,14 @@ class TestCLITransition: |
| 5705 | 5704 |
config: Any, |
| 5706 | 5705 |
) -> None: |
| 5707 | 5706 |
"""Migrating an invalid old settings file fails.""" |
| 5708 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 5707 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 5709 | 5708 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 5710 | 5709 |
# with-statements. |
| 5711 | 5710 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 5712 | 5711 |
with contextlib.ExitStack() as stack: |
| 5713 | 5712 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 5714 | 5713 |
stack.enter_context( |
| 5715 |
- tests.machinery.pytest.isolated_config( |
|
| 5714 |
+ pytest_machinery.isolated_config( |
|
| 5716 | 5715 |
monkeypatch=monkeypatch, |
| 5717 | 5716 |
runner=runner, |
| 5718 | 5717 |
) |
| ... | ... |
@@ -5731,33 +5730,33 @@ class TestCLITransition: |
| 5731 | 5730 |
) -> None: |
| 5732 | 5731 |
"""Forwarding arguments from "export" to "export vault" works.""" |
| 5733 | 5732 |
pytest.importorskip("cryptography", minversion="38.0")
|
| 5734 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 5733 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 5735 | 5734 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 5736 | 5735 |
# with-statements. |
| 5737 | 5736 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 5738 | 5737 |
with contextlib.ExitStack() as stack: |
| 5739 | 5738 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 5740 | 5739 |
stack.enter_context( |
| 5741 |
- tests.machinery.pytest.isolated_vault_exporter_config( |
|
| 5740 |
+ pytest_machinery.isolated_vault_exporter_config( |
|
| 5742 | 5741 |
monkeypatch=monkeypatch, |
| 5743 | 5742 |
runner=runner, |
| 5744 |
- vault_config=tests.data.VAULT_V03_CONFIG, |
|
| 5745 |
- vault_key=tests.data.VAULT_MASTER_KEY, |
|
| 5743 |
+ vault_config=data.VAULT_V03_CONFIG, |
|
| 5744 |
+ vault_key=data.VAULT_MASTER_KEY, |
|
| 5746 | 5745 |
) |
| 5747 | 5746 |
) |
| 5748 |
- monkeypatch.setenv("VAULT_KEY", tests.data.VAULT_MASTER_KEY)
|
|
| 5747 |
+ monkeypatch.setenv("VAULT_KEY", data.VAULT_MASTER_KEY)
|
|
| 5749 | 5748 |
result = runner.invoke( |
| 5750 | 5749 |
cli.derivepassphrase, |
| 5751 | 5750 |
["export", "VAULT_PATH"], |
| 5752 | 5751 |
) |
| 5753 | 5752 |
assert result.clean_exit(empty_stderr=False), "expected clean exit" |
| 5754 |
- assert tests.machinery.deprecation_warning_emitted( |
|
| 5753 |
+ assert machinery.deprecation_warning_emitted( |
|
| 5755 | 5754 |
"A subcommand will be required here in v1.0", caplog.record_tuples |
| 5756 | 5755 |
) |
| 5757 |
- assert tests.machinery.deprecation_warning_emitted( |
|
| 5756 |
+ assert machinery.deprecation_warning_emitted( |
|
| 5758 | 5757 |
'Defaulting to subcommand "vault"', caplog.record_tuples |
| 5759 | 5758 |
) |
| 5760 |
- assert json.loads(result.stdout) == tests.data.VAULT_V03_CONFIG_DATA |
|
| 5759 |
+ assert json.loads(result.stdout) == data.VAULT_V03_CONFIG_DATA |
|
| 5761 | 5760 |
|
| 5762 | 5761 |
def test_201_forward_export_vault_empty_commandline( |
| 5763 | 5762 |
self, |
| ... | ... |
@@ -5765,14 +5764,14 @@ class TestCLITransition: |
| 5765 | 5764 |
) -> None: |
| 5766 | 5765 |
"""Deferring from "export" to "export vault" works.""" |
| 5767 | 5766 |
pytest.importorskip("cryptography", minversion="38.0")
|
| 5768 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 5767 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 5769 | 5768 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 5770 | 5769 |
# with-statements. |
| 5771 | 5770 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 5772 | 5771 |
with contextlib.ExitStack() as stack: |
| 5773 | 5772 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 5774 | 5773 |
stack.enter_context( |
| 5775 |
- tests.machinery.pytest.isolated_config( |
|
| 5774 |
+ pytest_machinery.isolated_config( |
|
| 5776 | 5775 |
monkeypatch=monkeypatch, |
| 5777 | 5776 |
runner=runner, |
| 5778 | 5777 |
) |
| ... | ... |
@@ -5781,10 +5780,10 @@ class TestCLITransition: |
| 5781 | 5780 |
cli.derivepassphrase, |
| 5782 | 5781 |
["export"], |
| 5783 | 5782 |
) |
| 5784 |
- assert tests.machinery.deprecation_warning_emitted( |
|
| 5783 |
+ assert machinery.deprecation_warning_emitted( |
|
| 5785 | 5784 |
"A subcommand will be required here in v1.0", caplog.record_tuples |
| 5786 | 5785 |
) |
| 5787 |
- assert tests.machinery.deprecation_warning_emitted( |
|
| 5786 |
+ assert machinery.deprecation_warning_emitted( |
|
| 5788 | 5787 |
'Defaulting to subcommand "vault"', caplog.record_tuples |
| 5789 | 5788 |
) |
| 5790 | 5789 |
assert result.error_exit(error="Missing argument 'PATH'"), ( |
| ... | ... |
@@ -5800,14 +5799,14 @@ class TestCLITransition: |
| 5800 | 5799 |
"""Forwarding arguments from top-level to "vault" works.""" |
| 5801 | 5800 |
option = f"--{charset_name}"
|
| 5802 | 5801 |
charset = vault.Vault.CHARSETS[charset_name].decode("ascii")
|
| 5803 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 5802 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 5804 | 5803 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 5805 | 5804 |
# with-statements. |
| 5806 | 5805 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 5807 | 5806 |
with contextlib.ExitStack() as stack: |
| 5808 | 5807 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 5809 | 5808 |
stack.enter_context( |
| 5810 |
- tests.machinery.pytest.isolated_config( |
|
| 5809 |
+ pytest_machinery.isolated_config( |
|
| 5811 | 5810 |
monkeypatch=monkeypatch, |
| 5812 | 5811 |
runner=runner, |
| 5813 | 5812 |
) |
| ... | ... |
@@ -5815,7 +5814,7 @@ class TestCLITransition: |
| 5815 | 5814 |
monkeypatch.setattr( |
| 5816 | 5815 |
cli_helpers, |
| 5817 | 5816 |
"prompt_for_passphrase", |
| 5818 |
- tests.data.callables.auto_prompt, |
|
| 5817 |
+ callables.auto_prompt, |
|
| 5819 | 5818 |
) |
| 5820 | 5819 |
result = runner.invoke( |
| 5821 | 5820 |
cli.derivepassphrase, |
| ... | ... |
@@ -5824,10 +5823,10 @@ class TestCLITransition: |
| 5824 | 5823 |
catch_exceptions=False, |
| 5825 | 5824 |
) |
| 5826 | 5825 |
assert result.clean_exit(empty_stderr=False), "expected clean exit" |
| 5827 |
- assert tests.machinery.deprecation_warning_emitted( |
|
| 5826 |
+ assert machinery.deprecation_warning_emitted( |
|
| 5828 | 5827 |
"A subcommand will be required here in v1.0", caplog.record_tuples |
| 5829 | 5828 |
) |
| 5830 |
- assert tests.machinery.deprecation_warning_emitted( |
|
| 5829 |
+ assert machinery.deprecation_warning_emitted( |
|
| 5831 | 5830 |
'Defaulting to subcommand "vault"', caplog.record_tuples |
| 5832 | 5831 |
) |
| 5833 | 5832 |
for c in charset: |
| ... | ... |
@@ -5840,14 +5839,14 @@ class TestCLITransition: |
| 5840 | 5839 |
caplog: pytest.LogCaptureFixture, |
| 5841 | 5840 |
) -> None: |
| 5842 | 5841 |
"""Deferring from top-level to "vault" works.""" |
| 5843 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 5842 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 5844 | 5843 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 5845 | 5844 |
# with-statements. |
| 5846 | 5845 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 5847 | 5846 |
with contextlib.ExitStack() as stack: |
| 5848 | 5847 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 5849 | 5848 |
stack.enter_context( |
| 5850 |
- tests.machinery.pytest.isolated_config( |
|
| 5849 |
+ pytest_machinery.isolated_config( |
|
| 5851 | 5850 |
monkeypatch=monkeypatch, |
| 5852 | 5851 |
runner=runner, |
| 5853 | 5852 |
) |
| ... | ... |
@@ -5858,10 +5857,10 @@ class TestCLITransition: |
| 5858 | 5857 |
input=DUMMY_PASSPHRASE, |
| 5859 | 5858 |
catch_exceptions=False, |
| 5860 | 5859 |
) |
| 5861 |
- assert tests.machinery.deprecation_warning_emitted( |
|
| 5860 |
+ assert machinery.deprecation_warning_emitted( |
|
| 5862 | 5861 |
"A subcommand will be required here in v1.0", caplog.record_tuples |
| 5863 | 5862 |
) |
| 5864 |
- assert tests.machinery.deprecation_warning_emitted( |
|
| 5863 |
+ assert machinery.deprecation_warning_emitted( |
|
| 5865 | 5864 |
'Defaulting to subcommand "vault"', caplog.record_tuples |
| 5866 | 5865 |
) |
| 5867 | 5866 |
assert result.error_exit( |
| ... | ... |
@@ -5874,14 +5873,14 @@ class TestCLITransition: |
| 5874 | 5873 |
) -> None: |
| 5875 | 5874 |
"""Exporting from (and migrating) the old settings file works.""" |
| 5876 | 5875 |
caplog.set_level(logging.INFO) |
| 5877 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 5876 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 5878 | 5877 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 5879 | 5878 |
# with-statements. |
| 5880 | 5879 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 5881 | 5880 |
with contextlib.ExitStack() as stack: |
| 5882 | 5881 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 5883 | 5882 |
stack.enter_context( |
| 5884 |
- tests.machinery.pytest.isolated_config( |
|
| 5883 |
+ pytest_machinery.isolated_config( |
|
| 5885 | 5884 |
monkeypatch=monkeypatch, |
| 5886 | 5885 |
runner=runner, |
| 5887 | 5886 |
) |
| ... | ... |
@@ -5902,10 +5901,10 @@ class TestCLITransition: |
| 5902 | 5901 |
catch_exceptions=False, |
| 5903 | 5902 |
) |
| 5904 | 5903 |
assert result.clean_exit(), "expected clean exit" |
| 5905 |
- assert tests.machinery.deprecation_warning_emitted( |
|
| 5904 |
+ assert machinery.deprecation_warning_emitted( |
|
| 5906 | 5905 |
"v0.1-style config file", caplog.record_tuples |
| 5907 | 5906 |
), "expected known warning message in stderr" |
| 5908 |
- assert tests.machinery.deprecation_info_emitted( |
|
| 5907 |
+ assert machinery.deprecation_info_emitted( |
|
| 5909 | 5908 |
"Successfully migrated to ", caplog.record_tuples |
| 5910 | 5909 |
), "expected known warning message in stderr" |
| 5911 | 5910 |
|
| ... | ... |
@@ -5914,14 +5913,14 @@ class TestCLITransition: |
| 5914 | 5913 |
caplog: pytest.LogCaptureFixture, |
| 5915 | 5914 |
) -> None: |
| 5916 | 5915 |
"""Exporting from (and not migrating) the old settings file fails.""" |
| 5917 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 5916 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 5918 | 5917 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 5919 | 5918 |
# with-statements. |
| 5920 | 5919 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 5921 | 5920 |
with contextlib.ExitStack() as stack: |
| 5922 | 5921 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 5923 | 5922 |
stack.enter_context( |
| 5924 |
- tests.machinery.pytest.isolated_config( |
|
| 5923 |
+ pytest_machinery.isolated_config( |
|
| 5925 | 5924 |
monkeypatch=monkeypatch, |
| 5926 | 5925 |
runner=runner, |
| 5927 | 5926 |
) |
| ... | ... |
@@ -5952,10 +5951,10 @@ class TestCLITransition: |
| 5952 | 5951 |
catch_exceptions=False, |
| 5953 | 5952 |
) |
| 5954 | 5953 |
assert result.clean_exit(), "expected clean exit" |
| 5955 |
- assert tests.machinery.deprecation_warning_emitted( |
|
| 5954 |
+ assert machinery.deprecation_warning_emitted( |
|
| 5956 | 5955 |
"v0.1-style config file", caplog.record_tuples |
| 5957 | 5956 |
), "expected known warning message in stderr" |
| 5958 |
- assert tests.machinery.warning_emitted( |
|
| 5957 |
+ assert machinery.warning_emitted( |
|
| 5959 | 5958 |
"Failed to migrate to ", caplog.record_tuples |
| 5960 | 5959 |
), "expected known warning message in stderr" |
| 5961 | 5960 |
|
| ... | ... |
@@ -5964,14 +5963,14 @@ class TestCLITransition: |
| 5964 | 5963 |
) -> None: |
| 5965 | 5964 |
"""Completing service names from the old settings file works.""" |
| 5966 | 5965 |
config = {"services": {DUMMY_SERVICE: DUMMY_CONFIG_SETTINGS.copy()}}
|
| 5967 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 5966 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 5968 | 5967 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 5969 | 5968 |
# with-statements. |
| 5970 | 5969 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 5971 | 5970 |
with contextlib.ExitStack() as stack: |
| 5972 | 5971 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 5973 | 5972 |
stack.enter_context( |
| 5974 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 5973 |
+ pytest_machinery.isolated_vault_config( |
|
| 5975 | 5974 |
monkeypatch=monkeypatch, |
| 5976 | 5975 |
runner=runner, |
| 5977 | 5976 |
vault_config=config, |
| ... | ... |
@@ -6106,14 +6105,14 @@ class TestShellCompletion: |
| 6106 | 6105 |
completions: AbstractSet[str], |
| 6107 | 6106 |
) -> None: |
| 6108 | 6107 |
"""Our completion machinery works for vault service names.""" |
| 6109 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 6108 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 6110 | 6109 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 6111 | 6110 |
# with-statements. |
| 6112 | 6111 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 6113 | 6112 |
with contextlib.ExitStack() as stack: |
| 6114 | 6113 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 6115 | 6114 |
stack.enter_context( |
| 6116 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 6115 |
+ pytest_machinery.isolated_vault_config( |
|
| 6117 | 6116 |
monkeypatch=monkeypatch, |
| 6118 | 6117 |
runner=runner, |
| 6119 | 6118 |
vault_config=config, |
| ... | ... |
@@ -6138,14 +6137,14 @@ class TestShellCompletion: |
| 6138 | 6137 |
results: list[str | click.shell_completion.CompletionItem], |
| 6139 | 6138 |
) -> None: |
| 6140 | 6139 |
"""Custom completion functions work for all shells.""" |
| 6141 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 6140 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 6142 | 6141 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 6143 | 6142 |
# with-statements. |
| 6144 | 6143 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 6145 | 6144 |
with contextlib.ExitStack() as stack: |
| 6146 | 6145 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 6147 | 6146 |
stack.enter_context( |
| 6148 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 6147 |
+ pytest_machinery.isolated_vault_config( |
|
| 6149 | 6148 |
monkeypatch=monkeypatch, |
| 6150 | 6149 |
runner=runner, |
| 6151 | 6150 |
vault_config=config, |
| ... | ... |
@@ -6200,14 +6199,14 @@ class TestShellCompletion: |
| 6200 | 6199 |
) -> None: |
| 6201 | 6200 |
"""Completion skips incompletable items.""" |
| 6202 | 6201 |
vault_config = config if mode == "config" else {"services": {}}
|
| 6203 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 6202 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 6204 | 6203 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 6205 | 6204 |
# with-statements. |
| 6206 | 6205 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 6207 | 6206 |
with contextlib.ExitStack() as stack: |
| 6208 | 6207 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 6209 | 6208 |
stack.enter_context( |
| 6210 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 6209 |
+ pytest_machinery.isolated_vault_config( |
|
| 6211 | 6210 |
monkeypatch=monkeypatch, |
| 6212 | 6211 |
runner=runner, |
| 6213 | 6212 |
vault_config=vault_config, |
| ... | ... |
@@ -6227,10 +6226,10 @@ class TestShellCompletion: |
| 6227 | 6226 |
input=json.dumps(config), |
| 6228 | 6227 |
) |
| 6229 | 6228 |
assert result.clean_exit(), "expected clean exit" |
| 6230 |
- assert tests.machinery.warning_emitted( |
|
| 6229 |
+ assert machinery.warning_emitted( |
|
| 6231 | 6230 |
"contains an ASCII control character", caplog.record_tuples |
| 6232 | 6231 |
), "expected known warning message in stderr" |
| 6233 |
- assert tests.machinery.warning_emitted( |
|
| 6232 |
+ assert machinery.warning_emitted( |
|
| 6234 | 6233 |
"not be available for completion", caplog.record_tuples |
| 6235 | 6234 |
), "expected known warning message in stderr" |
| 6236 | 6235 |
assert cli_helpers.load_config() == config |
| ... | ... |
@@ -6241,14 +6240,14 @@ class TestShellCompletion: |
| 6241 | 6240 |
self, |
| 6242 | 6241 |
) -> None: |
| 6243 | 6242 |
"""Service name completion quietly fails on missing configuration.""" |
| 6244 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 6243 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 6245 | 6244 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 6246 | 6245 |
# with-statements. |
| 6247 | 6246 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 6248 | 6247 |
with contextlib.ExitStack() as stack: |
| 6249 | 6248 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 6250 | 6249 |
stack.enter_context( |
| 6251 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 6250 |
+ pytest_machinery.isolated_vault_config( |
|
| 6252 | 6251 |
monkeypatch=monkeypatch, |
| 6253 | 6252 |
runner=runner, |
| 6254 | 6253 |
vault_config={
|
| ... | ... |
@@ -6271,14 +6270,14 @@ class TestShellCompletion: |
| 6271 | 6270 |
exc_type: type[Exception], |
| 6272 | 6271 |
) -> None: |
| 6273 | 6272 |
"""Service name completion quietly fails on configuration errors.""" |
| 6274 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 6273 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 6275 | 6274 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 6276 | 6275 |
# with-statements. |
| 6277 | 6276 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 6278 | 6277 |
with contextlib.ExitStack() as stack: |
| 6279 | 6278 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 6280 | 6279 |
stack.enter_context( |
| 6281 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 6280 |
+ pytest_machinery.isolated_vault_config( |
|
| 6282 | 6281 |
monkeypatch=monkeypatch, |
| 6283 | 6282 |
runner=runner, |
| 6284 | 6283 |
vault_config={
|
| ... | ... |
@@ -18,13 +18,11 @@ import pytest |
| 18 | 18 |
from hypothesis import stateful, strategies |
| 19 | 19 |
from typing_extensions import Any, NamedTuple, TypeAlias |
| 20 | 20 |
|
| 21 |
-import tests.data |
|
| 22 |
-import tests.data.callables |
|
| 23 |
-import tests.machinery |
|
| 24 |
-import tests.machinery.hypothesis |
|
| 25 |
-import tests.machinery.pytest |
|
| 26 | 21 |
from derivepassphrase import _types, cli |
| 27 | 22 |
from derivepassphrase._internals import cli_helpers |
| 23 |
+from tests import data, machinery |
|
| 24 |
+from tests.machinery import hypothesis as hypothesis_machinery |
|
| 25 |
+from tests.machinery import pytest as pytest_machinery |
|
| 28 | 26 |
|
| 29 | 27 |
if TYPE_CHECKING: |
| 30 | 28 |
import multiprocessing |
| ... | ... |
@@ -33,9 +31,9 @@ if TYPE_CHECKING: |
| 33 | 31 |
from typing_extensions import Literal |
| 34 | 32 |
|
| 35 | 33 |
# All tests in this module are heavy-duty tests. |
| 36 |
-pytestmark = [tests.machinery.pytest.heavy_duty] |
|
| 34 |
+pytestmark = [pytest_machinery.heavy_duty] |
|
| 37 | 35 |
|
| 38 |
-KNOWN_SERVICES = (tests.data.DUMMY_SERVICE, "email", "bank", "work") |
|
| 36 |
+KNOWN_SERVICES = (data.DUMMY_SERVICE, "email", "bank", "work") |
|
| 39 | 37 |
"""Known service names. Used for the [`ConfigManagementStateMachine`][].""" |
| 40 | 38 |
VALID_PROPERTIES = ( |
| 41 | 39 |
"length", |
| ... | ... |
@@ -71,7 +69,7 @@ def build_reduced_vault_config_settings( |
| 71 | 69 |
|
| 72 | 70 |
SERVICES_STRATEGY = strategies.builds( |
| 73 | 71 |
build_reduced_vault_config_settings, |
| 74 |
- tests.machinery.hypothesis.vault_full_service_config(), |
|
| 72 |
+ hypothesis_machinery.vault_full_service_config(), |
|
| 75 | 73 |
strategies.sets( |
| 76 | 74 |
strategies.sampled_from(VALID_PROPERTIES), |
| 77 | 75 |
max_size=7, |
| ... | ... |
@@ -165,13 +163,13 @@ class ConfigManagementStateMachine(stateful.RuleBasedStateMachine): |
| 165 | 163 |
def __init__(self) -> None: |
| 166 | 164 |
"""Initialize self, set up context managers and enter them.""" |
| 167 | 165 |
super().__init__() |
| 168 |
- self.runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 166 |
+ self.runner = machinery.CliRunner(mix_stderr=False) |
|
| 169 | 167 |
self.exit_stack = contextlib.ExitStack().__enter__() |
| 170 | 168 |
self.monkeypatch = self.exit_stack.enter_context( |
| 171 | 169 |
pytest.MonkeyPatch().context() |
| 172 | 170 |
) |
| 173 | 171 |
self.isolated_config = self.exit_stack.enter_context( |
| 174 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 172 |
+ pytest_machinery.isolated_vault_config( |
|
| 175 | 173 |
monkeypatch=self.monkeypatch, |
| 176 | 174 |
runner=self.runner, |
| 177 | 175 |
vault_config={"services": {}},
|
| ... | ... |
@@ -592,7 +590,7 @@ def run_actions_handler( |
| 592 | 590 |
timeout=timeout, |
| 593 | 591 |
), |
| 594 | 592 |
) |
| 595 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 593 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 596 | 594 |
try: |
| 597 | 595 |
result = runner.invoke( |
| 598 | 596 |
cli.derivepassphrase_vault, |
| ... | ... |
@@ -623,7 +621,7 @@ def run_actions_handler( |
| 623 | 621 |
|
| 624 | 622 |
|
| 625 | 623 |
@hypothesis.settings( |
| 626 |
- stateful_step_count=tests.machinery.hypothesis.get_concurrency_step_count(), |
|
| 624 |
+ stateful_step_count=hypothesis_machinery.get_concurrency_step_count(), |
|
| 627 | 625 |
deadline=None, |
| 628 | 626 |
) |
| 629 | 627 |
class FakeConfigurationMutexStateMachine(stateful.RuleBasedStateMachine): |
| ... | ... |
@@ -805,7 +803,7 @@ class FakeConfigurationMutexStateMachine(stateful.RuleBasedStateMachine): |
| 805 | 803 |
except AttributeError: # pragma: no cover |
| 806 | 804 |
settings = None |
| 807 | 805 |
self.step_count = ( |
| 808 |
- tests.machinery.hypothesis.get_concurrency_step_count(settings) |
|
| 806 |
+ hypothesis_machinery.get_concurrency_step_count(settings) |
|
| 809 | 807 |
) |
| 810 | 808 |
|
| 811 | 809 |
@stateful.initialize( |
| ... | ... |
@@ -1085,7 +1083,7 @@ class FakeConfigurationMutexStateMachine(stateful.RuleBasedStateMachine): |
| 1085 | 1083 |
mp = multiprocessing.get_context() |
| 1086 | 1084 |
# Coverage tracking writes coverage data to the current working |
| 1087 | 1085 |
# directory, but because the subprocesses are spawned within the |
| 1088 |
- # `tests.machinery.pytest.isolated_vault_config` context manager, their starting |
|
| 1086 |
+ # `pytest_machinery.isolated_vault_config` context manager, their starting |
|
| 1089 | 1087 |
# working directory is the isolated one, not the original one. |
| 1090 | 1088 |
orig_cwd = pathlib.Path.cwd() |
| 1091 | 1089 |
|
| ... | ... |
@@ -1104,10 +1102,10 @@ class FakeConfigurationMutexStateMachine(stateful.RuleBasedStateMachine): |
| 1104 | 1102 |
|
| 1105 | 1103 |
stack = contextlib.ExitStack() |
| 1106 | 1104 |
with stack: |
| 1107 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 1105 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 1108 | 1106 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 1109 | 1107 |
stack.enter_context( |
| 1110 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 1108 |
+ pytest_machinery.isolated_vault_config( |
|
| 1111 | 1109 |
monkeypatch=monkeypatch, |
| 1112 | 1110 |
runner=runner, |
| 1113 | 1111 |
vault_config={"services": {}},
|
| ... | ... |
@@ -1128,10 +1126,10 @@ class FakeConfigurationMutexStateMachine(stateful.RuleBasedStateMachine): |
| 1128 | 1126 |
) |
| 1129 | 1127 |
|
| 1130 | 1128 |
with stack: # noqa: PLR1702 |
| 1131 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 1129 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 1132 | 1130 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 1133 | 1131 |
stack.enter_context( |
| 1134 |
- tests.machinery.pytest.isolated_vault_config( |
|
| 1132 |
+ pytest_machinery.isolated_vault_config( |
|
| 1135 | 1133 |
monkeypatch=monkeypatch, |
| 1136 | 1134 |
runner=runner, |
| 1137 | 1135 |
vault_config={"services": {}},
|
| ... | ... |
@@ -1216,7 +1214,7 @@ class FakeConfigurationMutexStateMachine(stateful.RuleBasedStateMachine): |
| 1216 | 1214 |
break |
| 1217 | 1215 |
finally: |
| 1218 | 1216 |
# The subprocesses have this |
| 1219 |
- # `tests.machinery.pytest.isolated_vault_config` directory as their |
|
| 1217 |
+ # `pytest_machinery.isolated_vault_config` directory as their |
|
| 1220 | 1218 |
# startup and working directory, so systems like |
| 1221 | 1219 |
# coverage tracking write their data files to this |
| 1222 | 1220 |
# directory. We need to manually move them back to |
| ... | ... |
@@ -1312,7 +1310,7 @@ class FakeConfigurationMutexStateMachine(stateful.RuleBasedStateMachine): |
| 1312 | 1310 |
|
| 1313 | 1311 |
|
| 1314 | 1312 |
TestFakedConfigurationMutex = ( |
| 1315 |
- tests.machinery.pytest.skip_if_no_multiprocessing_support( |
|
| 1313 |
+ pytest_machinery.skip_if_no_multiprocessing_support( |
|
| 1316 | 1314 |
FakeConfigurationMutexStateMachine.TestCase |
| 1317 | 1315 |
) |
| 1318 | 1316 |
) |
| ... | ... |
@@ -15,11 +15,10 @@ import hypothesis |
| 15 | 15 |
import pytest |
| 16 | 16 |
from hypothesis import strategies |
| 17 | 17 |
|
| 18 |
-import tests.data |
|
| 19 |
-import tests.machinery |
|
| 20 |
-import tests.machinery.pytest |
|
| 21 | 18 |
from derivepassphrase import _types, cli, exporter |
| 22 | 19 |
from derivepassphrase.exporter import storeroom, vault_native |
| 20 |
+from tests import data, machinery |
|
| 21 |
+from tests.machinery import pytest as pytest_machinery |
|
| 23 | 22 |
|
| 24 | 23 |
cryptography = pytest.importorskip("cryptography", minversion="38.0")
|
| 25 | 24 |
|
| ... | ... |
@@ -49,27 +48,27 @@ class Parametrize(types.SimpleNamespace): |
| 49 | 48 |
["config", "format", "config_data"], |
| 50 | 49 |
[ |
| 51 | 50 |
pytest.param( |
| 52 |
- tests.data.VAULT_V02_CONFIG, |
|
| 51 |
+ data.VAULT_V02_CONFIG, |
|
| 53 | 52 |
"v0.2", |
| 54 |
- tests.data.VAULT_V02_CONFIG_DATA, |
|
| 53 |
+ data.VAULT_V02_CONFIG_DATA, |
|
| 55 | 54 |
id="V02_CONFIG-v0.2", |
| 56 | 55 |
), |
| 57 | 56 |
pytest.param( |
| 58 |
- tests.data.VAULT_V02_CONFIG, |
|
| 57 |
+ data.VAULT_V02_CONFIG, |
|
| 59 | 58 |
"v0.3", |
| 60 | 59 |
exporter.NotAVaultConfigError, |
| 61 | 60 |
id="V02_CONFIG-v0.3", |
| 62 | 61 |
), |
| 63 | 62 |
pytest.param( |
| 64 |
- tests.data.VAULT_V03_CONFIG, |
|
| 63 |
+ data.VAULT_V03_CONFIG, |
|
| 65 | 64 |
"v0.2", |
| 66 | 65 |
exporter.NotAVaultConfigError, |
| 67 | 66 |
id="V03_CONFIG-v0.2", |
| 68 | 67 |
), |
| 69 | 68 |
pytest.param( |
| 70 |
- tests.data.VAULT_V03_CONFIG, |
|
| 69 |
+ data.VAULT_V03_CONFIG, |
|
| 71 | 70 |
"v0.3", |
| 72 |
- tests.data.VAULT_V03_CONFIG_DATA, |
|
| 71 |
+ data.VAULT_V03_CONFIG_DATA, |
|
| 73 | 72 |
id="V03_CONFIG-v0.3", |
| 74 | 73 |
), |
| 75 | 74 |
], |
| ... | ... |
@@ -78,39 +77,19 @@ class Parametrize(types.SimpleNamespace): |
| 78 | 77 |
["config", "parser_class", "config_data"], |
| 79 | 78 |
[ |
| 80 | 79 |
pytest.param( |
| 81 |
- tests.data.VAULT_V02_CONFIG, |
|
| 80 |
+ data.VAULT_V02_CONFIG, |
|
| 82 | 81 |
vault_native.VaultNativeV02ConfigParser, |
| 83 |
- tests.data.VAULT_V02_CONFIG_DATA, |
|
| 82 |
+ data.VAULT_V02_CONFIG_DATA, |
|
| 84 | 83 |
id="0.2", |
| 85 | 84 |
), |
| 86 | 85 |
pytest.param( |
| 87 |
- tests.data.VAULT_V03_CONFIG, |
|
| 86 |
+ data.VAULT_V03_CONFIG, |
|
| 88 | 87 |
vault_native.VaultNativeV03ConfigParser, |
| 89 |
- tests.data.VAULT_V03_CONFIG_DATA, |
|
| 88 |
+ data.VAULT_V03_CONFIG_DATA, |
|
| 90 | 89 |
id="0.3", |
| 91 | 90 |
), |
| 92 | 91 |
], |
| 93 | 92 |
) |
| 94 |
- BAD_MASTER_KEYS_DATA = pytest.mark.parametrize( |
|
| 95 |
- ["data", "err_msg"], |
|
| 96 |
- [ |
|
| 97 |
- pytest.param( |
|
| 98 |
- '{"version": 255}',
|
|
| 99 |
- "bad or unsupported keys version header", |
|
| 100 |
- id="v255", |
|
| 101 |
- ), |
|
| 102 |
- pytest.param( |
|
| 103 |
- '{"version": 1}\nAAAA\nAAAA',
|
|
| 104 |
- "trailing data; cannot make sense", |
|
| 105 |
- id="trailing-data", |
|
| 106 |
- ), |
|
| 107 |
- pytest.param( |
|
| 108 |
- '{"version": 1}\nAAAA',
|
|
| 109 |
- "cannot handle version 0 encrypted keys", |
|
| 110 |
- id="v0-keys", |
|
| 111 |
- ), |
|
| 112 |
- ], |
|
| 113 |
- ) |
|
| 114 | 93 |
STOREROOM_HANDLER = pytest.mark.parametrize( |
| 115 | 94 |
"handler", |
| 116 | 95 |
[ |
| ... | ... |
@@ -136,41 +115,61 @@ class Parametrize(types.SimpleNamespace): |
| 136 | 115 |
"key", |
| 137 | 116 |
[ |
| 138 | 117 |
None, |
| 139 |
- pytest.param(tests.data.VAULT_MASTER_KEY, id="str"), |
|
| 118 |
+ pytest.param(data.VAULT_MASTER_KEY, id="str"), |
|
| 140 | 119 |
pytest.param( |
| 141 |
- tests.data.VAULT_MASTER_KEY.encode("ascii"), id="bytes"
|
|
| 120 |
+ data.VAULT_MASTER_KEY.encode("ascii"), id="bytes"
|
|
| 142 | 121 |
), |
| 143 | 122 |
pytest.param( |
| 144 |
- bytearray(tests.data.VAULT_MASTER_KEY.encode("ascii")),
|
|
| 123 |
+ bytearray(data.VAULT_MASTER_KEY.encode("ascii")),
|
|
| 145 | 124 |
id="bytearray", |
| 146 | 125 |
), |
| 147 | 126 |
pytest.param( |
| 148 |
- memoryview(tests.data.VAULT_MASTER_KEY.encode("ascii")),
|
|
| 127 |
+ memoryview(data.VAULT_MASTER_KEY.encode("ascii")),
|
|
| 149 | 128 |
id="memoryview", |
| 150 | 129 |
), |
| 151 | 130 |
], |
| 152 | 131 |
) |
| 132 |
+ BAD_MASTER_KEYS_DATA = pytest.mark.parametrize( |
|
| 133 |
+ ["master_keys_data", "err_msg"], |
|
| 134 |
+ [ |
|
| 135 |
+ pytest.param( |
|
| 136 |
+ '{"version": 255}',
|
|
| 137 |
+ "bad or unsupported keys version header", |
|
| 138 |
+ id="v255", |
|
| 139 |
+ ), |
|
| 140 |
+ pytest.param( |
|
| 141 |
+ '{"version": 1}\nAAAA\nAAAA',
|
|
| 142 |
+ "trailing data; cannot make sense", |
|
| 143 |
+ id="trailing-data", |
|
| 144 |
+ ), |
|
| 145 |
+ pytest.param( |
|
| 146 |
+ '{"version": 1}\nAAAA',
|
|
| 147 |
+ "cannot handle version 0 encrypted keys", |
|
| 148 |
+ id="v0-keys", |
|
| 149 |
+ ), |
|
| 150 |
+ ], |
|
| 151 |
+ ) |
|
| 153 | 152 |
PATH = pytest.mark.parametrize("path", [".vault", None])
|
| 154 | 153 |
BAD_STOREROOM_CONFIG_DATA = pytest.mark.parametrize( |
| 155 | 154 |
["zipped_config", "error_text"], |
| 156 | 155 |
[ |
| 157 | 156 |
pytest.param( |
| 158 |
- tests.data.VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED, |
|
| 157 |
+ data.VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED, |
|
| 159 | 158 |
"Object key mismatch", |
| 160 | 159 |
id="VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED", |
| 161 | 160 |
), |
| 162 | 161 |
pytest.param( |
| 163 |
- tests.data.VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED2, |
|
| 162 |
+ data.VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED2, |
|
| 164 | 163 |
"Directory index is not actually an index", |
| 165 | 164 |
id="VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED2", |
| 166 | 165 |
), |
| 167 | 166 |
pytest.param( |
| 168 |
- tests.data.VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED3, |
|
| 167 |
+ data.VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED3, |
|
| 169 | 168 |
"Directory index is not actually an index", |
| 170 | 169 |
id="VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED3", |
| 171 | 170 |
), |
| 172 | 171 |
pytest.param( |
| 173 |
- tests.data.VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED4, |
|
| 172 |
+ data.VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED4, |
|
| 174 | 173 |
"Object key mismatch", |
| 175 | 174 |
id="VAULT_STOREROOM_BROKEN_DIR_CONFIG_ZIPPED4", |
| 176 | 175 |
), |
| ... | ... |
@@ -189,51 +188,51 @@ class TestCLI: |
| 189 | 188 |
[`exporter.get_vault_path`][] for details. |
| 190 | 189 |
|
| 191 | 190 |
""" |
| 192 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 191 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 193 | 192 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 194 | 193 |
# with-statements. |
| 195 | 194 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 196 | 195 |
with contextlib.ExitStack() as stack: |
| 197 | 196 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 198 | 197 |
stack.enter_context( |
| 199 |
- tests.machinery.pytest.isolated_vault_exporter_config( |
|
| 198 |
+ pytest_machinery.isolated_vault_exporter_config( |
|
| 200 | 199 |
monkeypatch=monkeypatch, |
| 201 | 200 |
runner=runner, |
| 202 |
- vault_config=tests.data.VAULT_V03_CONFIG, |
|
| 203 |
- vault_key=tests.data.VAULT_MASTER_KEY, |
|
| 201 |
+ vault_config=data.VAULT_V03_CONFIG, |
|
| 202 |
+ vault_key=data.VAULT_MASTER_KEY, |
|
| 204 | 203 |
) |
| 205 | 204 |
) |
| 206 |
- monkeypatch.setenv("VAULT_KEY", tests.data.VAULT_MASTER_KEY)
|
|
| 205 |
+ monkeypatch.setenv("VAULT_KEY", data.VAULT_MASTER_KEY)
|
|
| 207 | 206 |
result = runner.invoke( |
| 208 | 207 |
cli.derivepassphrase_export_vault, |
| 209 | 208 |
["VAULT_PATH"], |
| 210 | 209 |
) |
| 211 | 210 |
assert result.clean_exit(empty_stderr=True), "expected clean exit" |
| 212 |
- assert json.loads(result.stdout) == tests.data.VAULT_V03_CONFIG_DATA |
|
| 211 |
+ assert json.loads(result.stdout) == data.VAULT_V03_CONFIG_DATA |
|
| 213 | 212 |
|
| 214 | 213 |
def test_201_key_parameter(self) -> None: |
| 215 | 214 |
"""The `--key` option is supported.""" |
| 216 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 215 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 217 | 216 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 218 | 217 |
# with-statements. |
| 219 | 218 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 220 | 219 |
with contextlib.ExitStack() as stack: |
| 221 | 220 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 222 | 221 |
stack.enter_context( |
| 223 |
- tests.machinery.pytest.isolated_vault_exporter_config( |
|
| 222 |
+ pytest_machinery.isolated_vault_exporter_config( |
|
| 224 | 223 |
monkeypatch=monkeypatch, |
| 225 | 224 |
runner=runner, |
| 226 |
- vault_config=tests.data.VAULT_V03_CONFIG, |
|
| 225 |
+ vault_config=data.VAULT_V03_CONFIG, |
|
| 227 | 226 |
) |
| 228 | 227 |
) |
| 229 | 228 |
result = runner.invoke( |
| 230 | 229 |
cli.derivepassphrase_export_vault, |
| 231 |
- ["-k", tests.data.VAULT_MASTER_KEY, ".vault"], |
|
| 230 |
+ ["-k", data.VAULT_MASTER_KEY, ".vault"], |
|
| 232 | 231 |
) |
| 233 | 232 |
assert result.clean_exit(empty_stderr=True), "expected clean exit" |
| 234 |
- assert json.loads(result.stdout) == tests.data.VAULT_V03_CONFIG_DATA |
|
| 233 |
+ assert json.loads(result.stdout) == data.VAULT_V03_CONFIG_DATA |
|
| 235 | 234 |
|
| 236 |
- @tests.machinery.pytest.Parametrize.VAULT_CONFIG_FORMATS_DATA |
|
| 235 |
+ @pytest_machinery.Parametrize.VAULT_CONFIG_FORMATS_DATA |
|
| 237 | 236 |
def test_210_load_vault_v02_v03_storeroom( |
| 238 | 237 |
self, |
| 239 | 238 |
config: str | bytes, |
| ... | ... |
@@ -246,14 +245,14 @@ class TestCLI: |
| 246 | 245 |
vault` to only attempt decoding in that named format. |
| 247 | 246 |
|
| 248 | 247 |
""" |
| 249 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 248 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 250 | 249 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 251 | 250 |
# with-statements. |
| 252 | 251 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 253 | 252 |
with contextlib.ExitStack() as stack: |
| 254 | 253 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 255 | 254 |
stack.enter_context( |
| 256 |
- tests.machinery.pytest.isolated_vault_exporter_config( |
|
| 255 |
+ pytest_machinery.isolated_vault_exporter_config( |
|
| 257 | 256 |
monkeypatch=monkeypatch, |
| 258 | 257 |
runner=runner, |
| 259 | 258 |
vault_config=config, |
| ... | ... |
@@ -265,7 +264,7 @@ class TestCLI: |
| 265 | 264 |
"-f", |
| 266 | 265 |
format, |
| 267 | 266 |
"-k", |
| 268 |
- tests.data.VAULT_MASTER_KEY, |
|
| 267 |
+ data.VAULT_MASTER_KEY, |
|
| 269 | 268 |
"VAULT_PATH", |
| 270 | 269 |
], |
| 271 | 270 |
) |
| ... | ... |
@@ -280,18 +279,18 @@ class TestCLI: |
| 280 | 279 |
caplog: pytest.LogCaptureFixture, |
| 281 | 280 |
) -> None: |
| 282 | 281 |
"""Fail when trying to decode non-existant files/directories.""" |
| 283 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 282 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 284 | 283 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 285 | 284 |
# with-statements. |
| 286 | 285 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 287 | 286 |
with contextlib.ExitStack() as stack: |
| 288 | 287 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 289 | 288 |
stack.enter_context( |
| 290 |
- tests.machinery.pytest.isolated_vault_exporter_config( |
|
| 289 |
+ pytest_machinery.isolated_vault_exporter_config( |
|
| 291 | 290 |
monkeypatch=monkeypatch, |
| 292 | 291 |
runner=runner, |
| 293 |
- vault_config=tests.data.VAULT_V03_CONFIG, |
|
| 294 |
- vault_key=tests.data.VAULT_MASTER_KEY, |
|
| 292 |
+ vault_config=data.VAULT_V03_CONFIG, |
|
| 293 |
+ vault_key=data.VAULT_MASTER_KEY, |
|
| 295 | 294 |
) |
| 296 | 295 |
) |
| 297 | 296 |
result = runner.invoke( |
| ... | ... |
@@ -305,25 +304,25 @@ class TestCLI: |
| 305 | 304 |
), |
| 306 | 305 |
record_tuples=caplog.record_tuples, |
| 307 | 306 |
), "expected error exit and known error message" |
| 308 |
- assert tests.data.CANNOT_LOAD_CRYPTOGRAPHY not in result.stderr |
|
| 307 |
+ assert data.CANNOT_LOAD_CRYPTOGRAPHY not in result.stderr |
|
| 309 | 308 |
|
| 310 | 309 |
def test_302_vault_config_invalid( |
| 311 | 310 |
self, |
| 312 | 311 |
caplog: pytest.LogCaptureFixture, |
| 313 | 312 |
) -> None: |
| 314 | 313 |
"""Fail to parse invalid vault configurations (files).""" |
| 315 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 314 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 316 | 315 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 317 | 316 |
# with-statements. |
| 318 | 317 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 319 | 318 |
with contextlib.ExitStack() as stack: |
| 320 | 319 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 321 | 320 |
stack.enter_context( |
| 322 |
- tests.machinery.pytest.isolated_vault_exporter_config( |
|
| 321 |
+ pytest_machinery.isolated_vault_exporter_config( |
|
| 323 | 322 |
monkeypatch=monkeypatch, |
| 324 | 323 |
runner=runner, |
| 325 | 324 |
vault_config="", |
| 326 |
- vault_key=tests.data.VAULT_MASTER_KEY, |
|
| 325 |
+ vault_key=data.VAULT_MASTER_KEY, |
|
| 327 | 326 |
) |
| 328 | 327 |
) |
| 329 | 328 |
result = runner.invoke( |
| ... | ... |
@@ -334,25 +333,25 @@ class TestCLI: |
| 334 | 333 |
error="Cannot parse '.vault' as a valid vault-native config", |
| 335 | 334 |
record_tuples=caplog.record_tuples, |
| 336 | 335 |
), "expected error exit and known error message" |
| 337 |
- assert tests.data.CANNOT_LOAD_CRYPTOGRAPHY not in result.stderr |
|
| 336 |
+ assert data.CANNOT_LOAD_CRYPTOGRAPHY not in result.stderr |
|
| 338 | 337 |
|
| 339 | 338 |
def test_302a_vault_config_invalid_just_a_directory( |
| 340 | 339 |
self, |
| 341 | 340 |
caplog: pytest.LogCaptureFixture, |
| 342 | 341 |
) -> None: |
| 343 | 342 |
"""Fail to parse invalid vault configurations (directories).""" |
| 344 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 343 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 345 | 344 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 346 | 345 |
# with-statements. |
| 347 | 346 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 348 | 347 |
with contextlib.ExitStack() as stack: |
| 349 | 348 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 350 | 349 |
stack.enter_context( |
| 351 |
- tests.machinery.pytest.isolated_vault_exporter_config( |
|
| 350 |
+ pytest_machinery.isolated_vault_exporter_config( |
|
| 352 | 351 |
monkeypatch=monkeypatch, |
| 353 | 352 |
runner=runner, |
| 354 | 353 |
vault_config="", |
| 355 |
- vault_key=tests.data.VAULT_MASTER_KEY, |
|
| 354 |
+ vault_key=data.VAULT_MASTER_KEY, |
|
| 356 | 355 |
) |
| 357 | 356 |
) |
| 358 | 357 |
p = pathlib.Path(".vault")
|
| ... | ... |
@@ -366,25 +365,25 @@ class TestCLI: |
| 366 | 365 |
error="Cannot parse '.vault' as a valid vault-native config", |
| 367 | 366 |
record_tuples=caplog.record_tuples, |
| 368 | 367 |
), "expected error exit and known error message" |
| 369 |
- assert tests.data.CANNOT_LOAD_CRYPTOGRAPHY not in result.stderr |
|
| 368 |
+ assert data.CANNOT_LOAD_CRYPTOGRAPHY not in result.stderr |
|
| 370 | 369 |
|
| 371 | 370 |
def test_403_invalid_vault_config_bad_signature( |
| 372 | 371 |
self, |
| 373 | 372 |
caplog: pytest.LogCaptureFixture, |
| 374 | 373 |
) -> None: |
| 375 | 374 |
"""Fail to parse vault configurations with invalid integrity checks.""" |
| 376 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 375 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 377 | 376 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 378 | 377 |
# with-statements. |
| 379 | 378 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 380 | 379 |
with contextlib.ExitStack() as stack: |
| 381 | 380 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 382 | 381 |
stack.enter_context( |
| 383 |
- tests.machinery.pytest.isolated_vault_exporter_config( |
|
| 382 |
+ pytest_machinery.isolated_vault_exporter_config( |
|
| 384 | 383 |
monkeypatch=monkeypatch, |
| 385 | 384 |
runner=runner, |
| 386 |
- vault_config=tests.data.VAULT_V02_CONFIG, |
|
| 387 |
- vault_key=tests.data.VAULT_MASTER_KEY, |
|
| 385 |
+ vault_config=data.VAULT_V02_CONFIG, |
|
| 386 |
+ vault_key=data.VAULT_MASTER_KEY, |
|
| 388 | 387 |
) |
| 389 | 388 |
) |
| 390 | 389 |
result = runner.invoke( |
| ... | ... |
@@ -395,25 +394,25 @@ class TestCLI: |
| 395 | 394 |
error="Cannot parse '.vault' as a valid vault-native config", |
| 396 | 395 |
record_tuples=caplog.record_tuples, |
| 397 | 396 |
), "expected error exit and known error message" |
| 398 |
- assert tests.data.CANNOT_LOAD_CRYPTOGRAPHY not in result.stderr |
|
| 397 |
+ assert data.CANNOT_LOAD_CRYPTOGRAPHY not in result.stderr |
|
| 399 | 398 |
|
| 400 | 399 |
def test_500_vault_config_invalid_internal( |
| 401 | 400 |
self, |
| 402 | 401 |
caplog: pytest.LogCaptureFixture, |
| 403 | 402 |
) -> None: |
| 404 | 403 |
"""The decoded vault configuration data is valid.""" |
| 405 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 404 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 406 | 405 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 407 | 406 |
# with-statements. |
| 408 | 407 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 409 | 408 |
with contextlib.ExitStack() as stack: |
| 410 | 409 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 411 | 410 |
stack.enter_context( |
| 412 |
- tests.machinery.pytest.isolated_vault_exporter_config( |
|
| 411 |
+ pytest_machinery.isolated_vault_exporter_config( |
|
| 413 | 412 |
monkeypatch=monkeypatch, |
| 414 | 413 |
runner=runner, |
| 415 |
- vault_config=tests.data.VAULT_V03_CONFIG, |
|
| 416 |
- vault_key=tests.data.VAULT_MASTER_KEY, |
|
| 414 |
+ vault_config=data.VAULT_V03_CONFIG, |
|
| 415 |
+ vault_key=data.VAULT_MASTER_KEY, |
|
| 417 | 416 |
) |
| 418 | 417 |
) |
| 419 | 418 |
|
| ... | ... |
@@ -433,7 +432,7 @@ class TestCLI: |
| 433 | 432 |
error="Invalid vault config: ", |
| 434 | 433 |
record_tuples=caplog.record_tuples, |
| 435 | 434 |
), "expected error exit and known error message" |
| 436 |
- assert tests.data.CANNOT_LOAD_CRYPTOGRAPHY not in result.stderr |
|
| 435 |
+ assert data.CANNOT_LOAD_CRYPTOGRAPHY not in result.stderr |
|
| 437 | 436 |
|
| 438 | 437 |
|
| 439 | 438 |
class TestStoreroom: |
| ... | ... |
@@ -454,23 +453,23 @@ class TestStoreroom: |
| 454 | 453 |
them as well. |
| 455 | 454 |
|
| 456 | 455 |
""" |
| 457 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 456 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 458 | 457 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 459 | 458 |
# with-statements. |
| 460 | 459 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 461 | 460 |
with contextlib.ExitStack() as stack: |
| 462 | 461 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 463 | 462 |
stack.enter_context( |
| 464 |
- tests.machinery.pytest.isolated_vault_exporter_config( |
|
| 463 |
+ pytest_machinery.isolated_vault_exporter_config( |
|
| 465 | 464 |
monkeypatch=monkeypatch, |
| 466 | 465 |
runner=runner, |
| 467 |
- vault_config=tests.data.VAULT_STOREROOM_CONFIG_ZIPPED, |
|
| 468 |
- vault_key=tests.data.VAULT_MASTER_KEY, |
|
| 466 |
+ vault_config=data.VAULT_STOREROOM_CONFIG_ZIPPED, |
|
| 467 |
+ vault_key=data.VAULT_MASTER_KEY, |
|
| 469 | 468 |
) |
| 470 | 469 |
) |
| 471 | 470 |
assert ( |
| 472 | 471 |
handler(path, key, format="storeroom") |
| 473 |
- == tests.data.VAULT_STOREROOM_CONFIG_DATA |
|
| 472 |
+ == data.VAULT_STOREROOM_CONFIG_DATA |
|
| 474 | 473 |
) |
| 475 | 474 |
|
| 476 | 475 |
def test_400_decrypt_bucket_item_unknown_version(self) -> None: |
| ... | ... |
@@ -497,7 +496,7 @@ class TestStoreroom: |
| 497 | 496 |
wrong shape. |
| 498 | 497 |
|
| 499 | 498 |
""" |
| 500 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 499 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 501 | 500 |
master_keys = _types.StoreroomMasterKeys( |
| 502 | 501 |
encryption_key=bytes(storeroom.KEY_SIZE), |
| 503 | 502 |
signing_key=bytes(storeroom.KEY_SIZE), |
| ... | ... |
@@ -509,10 +508,10 @@ class TestStoreroom: |
| 509 | 508 |
with contextlib.ExitStack() as stack: |
| 510 | 509 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 511 | 510 |
stack.enter_context( |
| 512 |
- tests.machinery.pytest.isolated_vault_exporter_config( |
|
| 511 |
+ pytest_machinery.isolated_vault_exporter_config( |
|
| 513 | 512 |
monkeypatch=monkeypatch, |
| 514 | 513 |
runner=runner, |
| 515 |
- vault_config=tests.data.VAULT_STOREROOM_CONFIG_ZIPPED, |
|
| 514 |
+ vault_config=data.VAULT_STOREROOM_CONFIG_ZIPPED, |
|
| 516 | 515 |
) |
| 517 | 516 |
) |
| 518 | 517 |
p = pathlib.Path(".vault", "20")
|
| ... | ... |
@@ -525,7 +524,7 @@ class TestStoreroom: |
| 525 | 524 |
@Parametrize.STOREROOM_HANDLER |
| 526 | 525 |
def test_402_export_storeroom_data_bad_master_keys_file( |
| 527 | 526 |
self, |
| 528 |
- data: str, |
|
| 527 |
+ master_keys_data: str, |
|
| 529 | 528 |
err_msg: str, |
| 530 | 529 |
handler: exporter.ExportVaultConfigDataFunction, |
| 531 | 530 |
) -> None: |
| ... | ... |
@@ -534,23 +533,23 @@ class TestStoreroom: |
| 534 | 533 |
These include unknown versions, and data of the wrong shape. |
| 535 | 534 |
|
| 536 | 535 |
""" |
| 537 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 536 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 538 | 537 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 539 | 538 |
# with-statements. |
| 540 | 539 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 541 | 540 |
with contextlib.ExitStack() as stack: |
| 542 | 541 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 543 | 542 |
stack.enter_context( |
| 544 |
- tests.machinery.pytest.isolated_vault_exporter_config( |
|
| 543 |
+ pytest_machinery.isolated_vault_exporter_config( |
|
| 545 | 544 |
monkeypatch=monkeypatch, |
| 546 | 545 |
runner=runner, |
| 547 |
- vault_config=tests.data.VAULT_STOREROOM_CONFIG_ZIPPED, |
|
| 548 |
- vault_key=tests.data.VAULT_MASTER_KEY, |
|
| 546 |
+ vault_config=data.VAULT_STOREROOM_CONFIG_ZIPPED, |
|
| 547 |
+ vault_key=data.VAULT_MASTER_KEY, |
|
| 549 | 548 |
) |
| 550 | 549 |
) |
| 551 | 550 |
p = pathlib.Path(".vault", ".keys")
|
| 552 | 551 |
with p.open("w", encoding="UTF-8") as outfile:
|
| 553 |
- print(data, file=outfile) |
|
| 552 |
+ print(master_keys_data, file=outfile) |
|
| 554 | 553 |
with pytest.raises(RuntimeError, match=err_msg): |
| 555 | 554 |
handler(format="storeroom") |
| 556 | 555 |
|
| ... | ... |
@@ -576,18 +575,18 @@ class TestStoreroom: |
| 576 | 575 |
subdirectories. |
| 577 | 576 |
|
| 578 | 577 |
""" |
| 579 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 578 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 580 | 579 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 581 | 580 |
# with-statements. |
| 582 | 581 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 583 | 582 |
with contextlib.ExitStack() as stack: |
| 584 | 583 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 585 | 584 |
stack.enter_context( |
| 586 |
- tests.machinery.pytest.isolated_vault_exporter_config( |
|
| 585 |
+ pytest_machinery.isolated_vault_exporter_config( |
|
| 587 | 586 |
monkeypatch=monkeypatch, |
| 588 | 587 |
runner=runner, |
| 589 | 588 |
vault_config=zipped_config, |
| 590 |
- vault_key=tests.data.VAULT_MASTER_KEY, |
|
| 589 |
+ vault_key=data.VAULT_MASTER_KEY, |
|
| 591 | 590 |
) |
| 592 | 591 |
) |
| 593 | 592 |
stack.enter_context(pytest.raises(RuntimeError, match=error_text)) |
| ... | ... |
@@ -678,7 +677,7 @@ class TestVaultNativeConfig: |
| 678 | 677 |
"""The PBKDF2 helper function works.""" |
| 679 | 678 |
assert ( |
| 680 | 679 |
vault_native.VaultNativeConfigParser._pbkdf2( |
| 681 |
- tests.data.VAULT_MASTER_KEY.encode("utf-8"), 32, iterations
|
|
| 680 |
+ data.VAULT_MASTER_KEY.encode("utf-8"), 32, iterations
|
|
| 682 | 681 |
) |
| 683 | 682 |
== result |
| 684 | 683 |
) |
| ... | ... |
@@ -702,18 +701,18 @@ class TestVaultNativeConfig: |
| 702 | 701 |
no longer does. |
| 703 | 702 |
|
| 704 | 703 |
""" |
| 705 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 704 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 706 | 705 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 707 | 706 |
# with-statements. |
| 708 | 707 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 709 | 708 |
with contextlib.ExitStack() as stack: |
| 710 | 709 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 711 | 710 |
stack.enter_context( |
| 712 |
- tests.machinery.pytest.isolated_vault_exporter_config( |
|
| 711 |
+ pytest_machinery.isolated_vault_exporter_config( |
|
| 713 | 712 |
monkeypatch=monkeypatch, |
| 714 | 713 |
runner=runner, |
| 715 | 714 |
vault_config=config, |
| 716 |
- vault_key=tests.data.VAULT_MASTER_KEY, |
|
| 715 |
+ vault_key=data.VAULT_MASTER_KEY, |
|
| 717 | 716 |
) |
| 718 | 717 |
) |
| 719 | 718 |
if isinstance(config_data, type): |
| ... | ... |
@@ -738,23 +737,23 @@ class TestVaultNativeConfig: |
| 738 | 737 |
them as well. |
| 739 | 738 |
|
| 740 | 739 |
""" |
| 741 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 740 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 742 | 741 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 743 | 742 |
# with-statements. |
| 744 | 743 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 745 | 744 |
with contextlib.ExitStack() as stack: |
| 746 | 745 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 747 | 746 |
stack.enter_context( |
| 748 |
- tests.machinery.pytest.isolated_vault_exporter_config( |
|
| 747 |
+ pytest_machinery.isolated_vault_exporter_config( |
|
| 749 | 748 |
monkeypatch=monkeypatch, |
| 750 | 749 |
runner=runner, |
| 751 |
- vault_config=tests.data.VAULT_V03_CONFIG, |
|
| 752 |
- vault_key=tests.data.VAULT_MASTER_KEY, |
|
| 750 |
+ vault_config=data.VAULT_V03_CONFIG, |
|
| 751 |
+ vault_key=data.VAULT_MASTER_KEY, |
|
| 753 | 752 |
) |
| 754 | 753 |
) |
| 755 | 754 |
assert ( |
| 756 | 755 |
handler(path, key, format="v0.3") |
| 757 |
- == tests.data.VAULT_V03_CONFIG_DATA |
|
| 756 |
+ == data.VAULT_V03_CONFIG_DATA |
|
| 758 | 757 |
) |
| 759 | 758 |
|
| 760 | 759 |
@Parametrize.VAULT_NATIVE_PARSER_CLASS_DATA |
| ... | ... |
@@ -773,21 +772,21 @@ class TestVaultNativeConfig: |
| 773 | 772 |
|
| 774 | 773 |
return func |
| 775 | 774 |
|
| 776 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 775 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 777 | 776 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 778 | 777 |
# with-statements. |
| 779 | 778 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 780 | 779 |
with contextlib.ExitStack() as stack: |
| 781 | 780 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 782 | 781 |
stack.enter_context( |
| 783 |
- tests.machinery.pytest.isolated_vault_exporter_config( |
|
| 782 |
+ pytest_machinery.isolated_vault_exporter_config( |
|
| 784 | 783 |
monkeypatch=monkeypatch, |
| 785 | 784 |
runner=runner, |
| 786 | 785 |
vault_config=config, |
| 787 | 786 |
) |
| 788 | 787 |
) |
| 789 | 788 |
parser = parser_class( |
| 790 |
- base64.b64decode(config), tests.data.VAULT_MASTER_KEY |
|
| 789 |
+ base64.b64decode(config), data.VAULT_MASTER_KEY |
|
| 791 | 790 |
) |
| 792 | 791 |
assert parser() == config_data |
| 793 | 792 |
# Now stub out all functions used to calculate the above result. |
| ... | ... |
@@ -16,10 +16,9 @@ import hypothesis |
| 16 | 16 |
import pytest |
| 17 | 17 |
from hypothesis import strategies |
| 18 | 18 |
|
| 19 |
-import tests.data |
|
| 20 |
-import tests.machinery |
|
| 21 |
-import tests.machinery.pytest |
|
| 22 | 19 |
from derivepassphrase import cli, exporter |
| 20 |
+from tests import data, machinery |
|
| 21 |
+from tests.machinery import pytest as pytest_machinery |
|
| 23 | 22 |
|
| 24 | 23 |
if TYPE_CHECKING: |
| 25 | 24 |
from typing_extensions import Buffer |
| ... | ... |
@@ -207,14 +206,14 @@ class Test001ExporterUtils: |
| 207 | 206 |
("USER", user),
|
| 208 | 207 |
("USERNAME", username),
|
| 209 | 208 |
] |
| 210 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 209 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 211 | 210 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 212 | 211 |
# with-statements. |
| 213 | 212 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 214 | 213 |
with contextlib.ExitStack() as stack: |
| 215 | 214 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 216 | 215 |
stack.enter_context( |
| 217 |
- tests.machinery.pytest.isolated_vault_exporter_config( |
|
| 216 |
+ pytest_machinery.isolated_vault_exporter_config( |
|
| 218 | 217 |
monkeypatch=monkeypatch, runner=runner |
| 219 | 218 |
) |
| 220 | 219 |
) |
| ... | ... |
@@ -234,14 +233,14 @@ class Test001ExporterUtils: |
| 234 | 233 |
Handle relative paths, absolute paths, and missing paths. |
| 235 | 234 |
|
| 236 | 235 |
""" |
| 237 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 236 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 238 | 237 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 239 | 238 |
# with-statements. |
| 240 | 239 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 241 | 240 |
with contextlib.ExitStack() as stack: |
| 242 | 241 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 243 | 242 |
stack.enter_context( |
| 244 |
- tests.machinery.pytest.isolated_vault_exporter_config( |
|
| 243 |
+ pytest_machinery.isolated_vault_exporter_config( |
|
| 245 | 244 |
monkeypatch=monkeypatch, runner=runner |
| 246 | 245 |
) |
| 247 | 246 |
) |
| ... | ... |
@@ -379,18 +378,18 @@ class Test002CLI: |
| 379 | 378 |
|
| 380 | 379 |
def test_300_invalid_format(self) -> None: |
| 381 | 380 |
"""Reject invalid vault configuration format names.""" |
| 382 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 381 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 383 | 382 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 384 | 383 |
# with-statements. |
| 385 | 384 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 386 | 385 |
with contextlib.ExitStack() as stack: |
| 387 | 386 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 388 | 387 |
stack.enter_context( |
| 389 |
- tests.machinery.pytest.isolated_vault_exporter_config( |
|
| 388 |
+ pytest_machinery.isolated_vault_exporter_config( |
|
| 390 | 389 |
monkeypatch=monkeypatch, |
| 391 | 390 |
runner=runner, |
| 392 |
- vault_config=tests.data.VAULT_V03_CONFIG, |
|
| 393 |
- vault_key=tests.data.VAULT_MASTER_KEY, |
|
| 391 |
+ vault_config=data.VAULT_V03_CONFIG, |
|
| 392 |
+ vault_key=data.VAULT_MASTER_KEY, |
|
| 394 | 393 |
) |
| 395 | 394 |
) |
| 396 | 395 |
result = runner.invoke( |
| ... | ... |
@@ -403,8 +402,8 @@ class Test002CLI: |
| 403 | 402 |
"expected error exit and known error message" |
| 404 | 403 |
) |
| 405 | 404 |
|
| 406 |
- @tests.machinery.pytest.skip_if_cryptography_support |
|
| 407 |
- @tests.machinery.pytest.Parametrize.VAULT_CONFIG_FORMATS_DATA |
|
| 405 |
+ @pytest_machinery.skip_if_cryptography_support |
|
| 406 |
+ @pytest_machinery.Parametrize.VAULT_CONFIG_FORMATS_DATA |
|
| 408 | 407 |
def test_999_no_cryptography_error_message( |
| 409 | 408 |
self, |
| 410 | 409 |
caplog: pytest.LogCaptureFixture, |
| ... | ... |
@@ -414,18 +413,18 @@ class Test002CLI: |
| 414 | 413 |
) -> None: |
| 415 | 414 |
"""Abort export call if no cryptography is available.""" |
| 416 | 415 |
del config_data |
| 417 |
- runner = tests.machinery.CliRunner(mix_stderr=False) |
|
| 416 |
+ runner = machinery.CliRunner(mix_stderr=False) |
|
| 418 | 417 |
# TODO(the-13th-letter): Rewrite using parenthesized |
| 419 | 418 |
# with-statements. |
| 420 | 419 |
# https://the13thletter.info/derivepassphrase/latest/pycompatibility/#after-eol-py3.9 |
| 421 | 420 |
with contextlib.ExitStack() as stack: |
| 422 | 421 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 423 | 422 |
stack.enter_context( |
| 424 |
- tests.machinery.pytest.isolated_vault_exporter_config( |
|
| 423 |
+ pytest_machinery.isolated_vault_exporter_config( |
|
| 425 | 424 |
monkeypatch=monkeypatch, |
| 426 | 425 |
runner=runner, |
| 427 | 426 |
vault_config=config, |
| 428 |
- vault_key=tests.data.VAULT_MASTER_KEY, |
|
| 427 |
+ vault_key=data.VAULT_MASTER_KEY, |
|
| 429 | 428 |
) |
| 430 | 429 |
) |
| 431 | 430 |
result = runner.invoke( |
| ... | ... |
@@ -434,6 +433,6 @@ class Test002CLI: |
| 434 | 433 |
catch_exceptions=False, |
| 435 | 434 |
) |
| 436 | 435 |
assert result.error_exit( |
| 437 |
- error=tests.data.CANNOT_LOAD_CRYPTOGRAPHY, |
|
| 436 |
+ error=data.CANNOT_LOAD_CRYPTOGRAPHY, |
|
| 438 | 437 |
record_tuples=caplog.record_tuples, |
| 439 | 438 |
), "expected error exit and known error message" |
| ... | ... |
@@ -25,14 +25,12 @@ import hypothesis |
| 25 | 25 |
import pytest |
| 26 | 26 |
from hypothesis import strategies |
| 27 | 27 |
|
| 28 |
-import tests.data |
|
| 29 |
-import tests.data.callables |
|
| 30 |
-import tests.machinery |
|
| 31 |
-import tests.machinery.hypothesis |
|
| 32 |
-import tests.machinery.pytest |
|
| 33 | 28 |
from derivepassphrase import _types, ssh_agent, vault |
| 34 | 29 |
from derivepassphrase._internals import cli_helpers |
| 35 | 30 |
from derivepassphrase.ssh_agent import socketprovider |
| 31 |
+from tests import data, machinery |
|
| 32 |
+from tests.data import callables |
|
| 33 |
+from tests.machinery import pytest as pytest_machinery |
|
| 36 | 34 |
|
| 37 | 35 |
if TYPE_CHECKING: |
| 38 | 36 |
from collections.abc import Iterable |
| ... | ... |
@@ -50,7 +48,7 @@ class Parametrize(types.SimpleNamespace): |
| 50 | 48 |
pytest.param( |
| 51 | 49 |
[ |
| 52 | 50 |
importlib.metadata.EntryPoint( |
| 53 |
- name=tests.data.faulty_entry_callable.key, |
|
| 51 |
+ name=data.faulty_entry_callable.key, |
|
| 54 | 52 |
group=socketprovider.SocketProvider.ENTRY_POINT_GROUP_NAME, |
| 55 | 53 |
value="tests.data: faulty_entry_callable", |
| 56 | 54 |
), |
| ... | ... |
@@ -60,7 +58,7 @@ class Parametrize(types.SimpleNamespace): |
| 60 | 58 |
pytest.param( |
| 61 | 59 |
[ |
| 62 | 60 |
importlib.metadata.EntryPoint( |
| 63 |
- name=tests.data.faulty_entry_name_exists.key, |
|
| 61 |
+ name=data.faulty_entry_name_exists.key, |
|
| 64 | 62 |
group=socketprovider.SocketProvider.ENTRY_POINT_GROUP_NAME, |
| 65 | 63 |
value="tests.data: faulty_entry_name_exists", |
| 66 | 64 |
), |
| ... | ... |
@@ -70,7 +68,7 @@ class Parametrize(types.SimpleNamespace): |
| 70 | 68 |
pytest.param( |
| 71 | 69 |
[ |
| 72 | 70 |
importlib.metadata.EntryPoint( |
| 73 |
- name=tests.data.faulty_entry_alias_exists.key, |
|
| 71 |
+ name=data.faulty_entry_alias_exists.key, |
|
| 74 | 72 |
group=socketprovider.SocketProvider.ENTRY_POINT_GROUP_NAME, |
| 75 | 73 |
value="tests.data: faulty_entry_alias_exists", |
| 76 | 74 |
), |
| ... | ... |
@@ -85,12 +83,12 @@ class Parametrize(types.SimpleNamespace): |
| 85 | 83 |
pytest.param( |
| 86 | 84 |
[ |
| 87 | 85 |
importlib.metadata.EntryPoint( |
| 88 |
- name=tests.data.posix_entry.key, |
|
| 86 |
+ name=data.posix_entry.key, |
|
| 89 | 87 |
group=socketprovider.SocketProvider.ENTRY_POINT_GROUP_NAME, |
| 90 | 88 |
value="tests.data: posix_entry", |
| 91 | 89 |
), |
| 92 | 90 |
importlib.metadata.EntryPoint( |
| 93 |
- name=tests.data.the_annoying_os_entry.key, |
|
| 91 |
+ name=data.the_annoying_os_entry.key, |
|
| 94 | 92 |
group=socketprovider.SocketProvider.ENTRY_POINT_GROUP_NAME, |
| 95 | 93 |
value="tests.data: the_annoying_os_entry", |
| 96 | 94 |
), |
| ... | ... |
@@ -100,12 +98,12 @@ class Parametrize(types.SimpleNamespace): |
| 100 | 98 |
pytest.param( |
| 101 | 99 |
[ |
| 102 | 100 |
importlib.metadata.EntryPoint( |
| 103 |
- name=tests.data.callables.provider_entry1.key, |
|
| 101 |
+ name=callables.provider_entry1.key, |
|
| 104 | 102 |
group=socketprovider.SocketProvider.ENTRY_POINT_GROUP_NAME, |
| 105 | 103 |
value="tests.data.callables: provider_entry1", |
| 106 | 104 |
), |
| 107 | 105 |
importlib.metadata.EntryPoint( |
| 108 |
- name=tests.data.callables.provider_entry2.key, |
|
| 106 |
+ name=callables.provider_entry2.key, |
|
| 109 | 107 |
group=socketprovider.SocketProvider.ENTRY_POINT_GROUP_NAME, |
| 110 | 108 |
value="tests.data.callables: provider_entry2", |
| 111 | 109 |
), |
| ... | ... |
@@ -257,7 +255,7 @@ class Parametrize(types.SimpleNamespace): |
| 257 | 255 |
id="key-not-loaded", |
| 258 | 256 |
), |
| 259 | 257 |
pytest.param( |
| 260 |
- tests.data.SUPPORTED_KEYS["ed25519"].public_key_data, |
|
| 258 |
+ data.SUPPORTED_KEYS["ed25519"].public_key_data, |
|
| 261 | 259 |
True, |
| 262 | 260 |
_types.SSH_AGENT.FAILURE, |
| 263 | 261 |
b"", |
| ... | ... |
@@ -271,10 +269,10 @@ class Parametrize(types.SimpleNamespace): |
| 271 | 269 |
["key", "single"], |
| 272 | 270 |
[ |
| 273 | 271 |
(value.public_key_data, False) |
| 274 |
- for value in tests.data.SUPPORTED_KEYS.values() |
|
| 272 |
+ for value in data.SUPPORTED_KEYS.values() |
|
| 275 | 273 |
] |
| 276 |
- + [(tests.data.callables.list_keys_singleton()[0].key, True)], |
|
| 277 |
- ids=[*tests.data.SUPPORTED_KEYS.keys(), "singleton"], |
|
| 274 |
+ + [(callables.list_keys_singleton()[0].key, True)], |
|
| 275 |
+ ids=[*data.SUPPORTED_KEYS.keys(), "singleton"], |
|
| 278 | 276 |
) |
| 279 | 277 |
SH_EXPORT_LINES = pytest.mark.parametrize( |
| 280 | 278 |
["line", "env_name", "value"], |
| ... | ... |
@@ -370,7 +368,7 @@ class Parametrize(types.SimpleNamespace): |
| 370 | 368 |
b"".join([ |
| 371 | 369 |
b"\x0d", |
| 372 | 370 |
ssh_agent.SSHAgentClient.string( |
| 373 |
- tests.data.ALL_KEYS["rsa"].public_key_data |
|
| 371 |
+ data.ALL_KEYS["rsa"].public_key_data |
|
| 374 | 372 |
), |
| 375 | 373 |
ssh_agent.SSHAgentClient.string(vault.Vault.UUID), |
| 376 | 374 |
b"\x00\x00\x00\x02", |
| ... | ... |
@@ -383,7 +381,7 @@ class Parametrize(types.SimpleNamespace): |
| 383 | 381 |
b"".join([ |
| 384 | 382 |
b"\x0d", |
| 385 | 383 |
ssh_agent.SSHAgentClient.string( |
| 386 |
- tests.data.ALL_KEYS["ed25519"].public_key_data |
|
| 384 |
+ data.ALL_KEYS["ed25519"].public_key_data |
|
| 387 | 385 |
), |
| 388 | 386 |
b"\x00\x00\x00\x08\x00\x01\x02\x03\x04\x05\x06\x07", |
| 389 | 387 |
b"\x00\x00\x00\x00", |
| ... | ... |
@@ -396,7 +394,7 @@ class Parametrize(types.SimpleNamespace): |
| 396 | 394 |
b"".join([ |
| 397 | 395 |
b"\x0d", |
| 398 | 396 |
ssh_agent.SSHAgentClient.string( |
| 399 |
- tests.data.ALL_KEYS["dsa1024"].public_key_data |
|
| 397 |
+ data.ALL_KEYS["dsa1024"].public_key_data |
|
| 400 | 398 |
), |
| 401 | 399 |
ssh_agent.SSHAgentClient.string(vault.Vault.UUID), |
| 402 | 400 |
b"\x00\x00\x00\x00", |
| ... | ... |
@@ -419,8 +417,8 @@ class Parametrize(types.SimpleNamespace): |
| 419 | 417 |
) |
| 420 | 418 |
PUBLIC_KEY_DATA = pytest.mark.parametrize( |
| 421 | 419 |
"public_key_struct", |
| 422 |
- list(tests.data.SUPPORTED_KEYS.values()), |
|
| 423 |
- ids=list(tests.data.SUPPORTED_KEYS.keys()), |
|
| 420 |
+ list(data.SUPPORTED_KEYS.values()), |
|
| 421 |
+ ids=list(data.SUPPORTED_KEYS.keys()), |
|
| 424 | 422 |
) |
| 425 | 423 |
REQUEST_ERROR_RESPONSES = pytest.mark.parametrize( |
| 426 | 424 |
["request_code", "response_code", "exc_type", "exc_pattern"], |
| ... | ... |
@@ -488,13 +486,13 @@ class Parametrize(types.SimpleNamespace): |
| 488 | 486 |
) |
| 489 | 487 |
SUPPORTED_SSH_TEST_KEYS = pytest.mark.parametrize( |
| 490 | 488 |
["ssh_test_key_type", "ssh_test_key"], |
| 491 |
- list(tests.data.SUPPORTED_KEYS.items()), |
|
| 492 |
- ids=tests.data.SUPPORTED_KEYS.keys(), |
|
| 489 |
+ list(data.SUPPORTED_KEYS.items()), |
|
| 490 |
+ ids=data.SUPPORTED_KEYS.keys(), |
|
| 493 | 491 |
) |
| 494 | 492 |
UNSUITABLE_SSH_TEST_KEYS = pytest.mark.parametrize( |
| 495 | 493 |
["ssh_test_key_type", "ssh_test_key"], |
| 496 |
- list(tests.data.UNSUITABLE_KEYS.items()), |
|
| 497 |
- ids=tests.data.UNSUITABLE_KEYS.keys(), |
|
| 494 |
+ list(data.UNSUITABLE_KEYS.items()), |
|
| 495 |
+ ids=data.UNSUITABLE_KEYS.keys(), |
|
| 498 | 496 |
) |
| 499 | 497 |
RESOLVE_CHAINS = pytest.mark.parametrize( |
| 500 | 498 |
["terminal", "chain"], |
| ... | ... |
@@ -518,10 +516,10 @@ class TestTestingMachineryStubbedSSHAgentSocket: |
| 518 | 516 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 519 | 517 |
monkeypatch.setenv( |
| 520 | 518 |
"SSH_AUTH_SOCK", |
| 521 |
- tests.machinery.StubbedSSHAgentSocketWithAddress.ADDRESS, |
|
| 519 |
+ machinery.StubbedSSHAgentSocketWithAddress.ADDRESS, |
|
| 522 | 520 |
) |
| 523 | 521 |
agent = stack.enter_context( |
| 524 |
- tests.machinery.StubbedSSHAgentSocketWithAddress() |
|
| 522 |
+ machinery.StubbedSSHAgentSocketWithAddress() |
|
| 525 | 523 |
) |
| 526 | 524 |
assert "query" not in agent.enabled_extensions |
| 527 | 525 |
query_request = ( |
| ... | ... |
@@ -547,10 +545,10 @@ class TestTestingMachineryStubbedSSHAgentSocket: |
| 547 | 545 |
monkeypatch = stack.enter_context(pytest.MonkeyPatch.context()) |
| 548 | 546 |
monkeypatch.setenv( |
| 549 | 547 |
"SSH_AUTH_SOCK", |
| 550 |
- tests.machinery.StubbedSSHAgentSocketWithAddress.ADDRESS, |
|
| 548 |
+ machinery.StubbedSSHAgentSocketWithAddress.ADDRESS, |
|
| 551 | 549 |
) |
| 552 | 550 |
agent = stack.enter_context( |
| 553 |
- tests.machinery.StubbedSSHAgentSocketWithAddressAndDeterministicDSA() |
|
| 551 |
+ machinery.StubbedSSHAgentSocketWithAddressAndDeterministicDSA() |
|
| 554 | 552 |
) |
| 555 | 553 |
assert "query" in agent.enabled_extensions |
| 556 | 554 |
query_request = ( |
| ... | ... |
@@ -580,7 +578,7 @@ class TestTestingMachineryStubbedSSHAgentSocket: |
| 580 | 578 |
def test_101_request_identities(self) -> None: |
| 581 | 579 |
"""The agent implements a known list of identities.""" |
| 582 | 580 |
unstring_prefix = ssh_agent.SSHAgentClient.unstring_prefix |
| 583 |
- with tests.machinery.StubbedSSHAgentSocket() as agent: |
|
| 581 |
+ with machinery.StubbedSSHAgentSocket() as agent: |
|
| 584 | 582 |
query_request = ( |
| 585 | 583 |
# SSH string header |
| 586 | 584 |
b"\x00\x00\x00\x01" |
| ... | ... |
@@ -603,7 +601,7 @@ class TestTestingMachineryStubbedSSHAgentSocket: |
| 603 | 601 |
_comment, message = unstring_prefix(message) |
| 604 | 602 |
assert key |
| 605 | 603 |
assert key in {
|
| 606 |
- k.public_key_data for k in tests.data.ALL_KEYS.values() |
|
| 604 |
+ k.public_key_data for k in data.ALL_KEYS.values() |
|
| 607 | 605 |
} |
| 608 | 606 |
assert not message |
| 609 | 607 |
|
| ... | ... |
@@ -611,11 +609,11 @@ class TestTestingMachineryStubbedSSHAgentSocket: |
| 611 | 609 |
def test_102_sign( |
| 612 | 610 |
self, |
| 613 | 611 |
ssh_test_key_type: str, |
| 614 |
- ssh_test_key: tests.data.SSHTestKey, |
|
| 612 |
+ ssh_test_key: data.SSHTestKey, |
|
| 615 | 613 |
) -> None: |
| 616 | 614 |
"""The agent signs known key/message pairs.""" |
| 617 | 615 |
del ssh_test_key_type |
| 618 |
- spec = tests.data.SSHTestKeyDeterministicSignatureClass.SPEC |
|
| 616 |
+ spec = data.SSHTestKeyDeterministicSignatureClass.SPEC |
|
| 619 | 617 |
assert ssh_test_key.expected_signatures[spec].signature is not None |
| 620 | 618 |
string = ssh_agent.SSHAgentClient.string |
| 621 | 619 |
query_request = string( |
| ... | ... |
@@ -634,21 +632,21 @@ class TestTestingMachineryStubbedSSHAgentSocket: |
| 634 | 632 |
# expected payload: the binary signature as recorded in the test key data structure |
| 635 | 633 |
+ string(ssh_test_key.expected_signatures[spec].signature) |
| 636 | 634 |
) |
| 637 |
- with tests.machinery.StubbedSSHAgentSocket() as agent: |
|
| 635 |
+ with machinery.StubbedSSHAgentSocket() as agent: |
|
| 638 | 636 |
agent.sendall(query_request) |
| 639 | 637 |
assert agent.recv(1000) == query_response |
| 640 | 638 |
|
| 641 | 639 |
def test_120_close_multiple(self) -> None: |
| 642 | 640 |
"""The agent can be closed repeatedly.""" |
| 643 |
- with tests.machinery.StubbedSSHAgentSocket() as agent: |
|
| 641 |
+ with machinery.StubbedSSHAgentSocket() as agent: |
|
| 644 | 642 |
pass |
| 645 |
- with tests.machinery.StubbedSSHAgentSocket() as agent: |
|
| 643 |
+ with machinery.StubbedSSHAgentSocket() as agent: |
|
| 646 | 644 |
pass |
| 647 | 645 |
del agent |
| 648 | 646 |
|
| 649 | 647 |
def test_121_closed_agents_cannot_be_interacted_with(self) -> None: |
| 650 | 648 |
"""The agent can be closed repeatedly.""" |
| 651 |
- with tests.machinery.StubbedSSHAgentSocket() as agent: |
|
| 649 |
+ with machinery.StubbedSSHAgentSocket() as agent: |
|
| 652 | 650 |
pass |
| 653 | 651 |
query_request = ( |
| 654 | 652 |
# SSH string header |
| ... | ... |
@@ -662,7 +660,7 @@ class TestTestingMachineryStubbedSSHAgentSocket: |
| 662 | 660 |
with pytest.raises( |
| 663 | 661 |
ValueError, |
| 664 | 662 |
match=re.escape( |
| 665 |
- tests.machinery.StubbedSSHAgentSocket._SOCKET_IS_CLOSED |
|
| 663 |
+ machinery.StubbedSSHAgentSocket._SOCKET_IS_CLOSED |
|
| 666 | 664 |
), |
| 667 | 665 |
): |
| 668 | 666 |
agent.sendall(query_request) |
| ... | ... |
@@ -670,11 +668,11 @@ class TestTestingMachineryStubbedSSHAgentSocket: |
| 670 | 668 |
|
| 671 | 669 |
def test_122_no_recv_without_sendall(self) -> None: |
| 672 | 670 |
"""The agent requires a message before sending a response.""" |
| 673 |
- with tests.machinery.StubbedSSHAgentSocket() as agent: # noqa: SIM117 |
|
| 671 |
+ with machinery.StubbedSSHAgentSocket() as agent: # noqa: SIM117 |
|
| 674 | 672 |
with pytest.raises( |
| 675 | 673 |
AssertionError, |
| 676 | 674 |
match=re.escape( |
| 677 |
- tests.machinery.StubbedSSHAgentSocket._PROTOCOL_VIOLATION |
|
| 675 |
+ machinery.StubbedSSHAgentSocket._PROTOCOL_VIOLATION |
|
| 678 | 676 |
), |
| 679 | 677 |
): |
| 680 | 678 |
agent.recv(100) |
| ... | ... |
@@ -691,7 +689,7 @@ class TestTestingMachineryStubbedSSHAgentSocket: |
| 691 | 689 |
# response code: SSH_AGENT_FAILURE |
| 692 | 690 |
b"\x05" |
| 693 | 691 |
) |
| 694 |
- with tests.machinery.StubbedSSHAgentSocket() as agent: |
|
| 692 |
+ with machinery.StubbedSSHAgentSocket() as agent: |
|
| 695 | 693 |
agent.sendall(message) |
| 696 | 694 |
assert agent.recv(100) == query_response |
| 697 | 695 |
|
| ... | ... |
@@ -707,7 +705,7 @@ class TestTestingMachineryStubbedSSHAgentSocket: |
| 707 | 705 |
# response code: SSH_AGENT_FAILURE |
| 708 | 706 |
b"\x05" |
| 709 | 707 |
) |
| 710 |
- with tests.machinery.StubbedSSHAgentSocket() as agent: |
|
| 708 |
+ with machinery.StubbedSSHAgentSocket() as agent: |
|
| 711 | 709 |
agent.sendall(message) |
| 712 | 710 |
assert agent.recv(100) == query_response |
| 713 | 711 |
|
| ... | ... |
@@ -729,7 +727,7 @@ class TestTestingMachineryStubbedSSHAgentSocket: |
| 729 | 727 |
stack.enter_context( |
| 730 | 728 |
pytest.raises(exception, match=re.escape(match)) |
| 731 | 729 |
) |
| 732 |
- tests.machinery.StubbedSSHAgentSocketWithAddress() |
|
| 730 |
+ machinery.StubbedSSHAgentSocketWithAddress() |
|
| 733 | 731 |
|
| 734 | 732 |
|
| 735 | 733 |
class TestStaticFunctionality: |
| ... | ... |
@@ -785,7 +783,7 @@ class TestStaticFunctionality: |
| 785 | 783 |
@Parametrize.PUBLIC_KEY_DATA |
| 786 | 784 |
def test_100_key_decoding( |
| 787 | 785 |
self, |
| 788 |
- public_key_struct: tests.data.SSHTestKey, |
|
| 786 |
+ public_key_struct: data.SSHTestKey, |
|
| 789 | 787 |
) -> None: |
| 790 | 788 |
"""The [`tests.ALL_KEYS`][] public key data looks sane.""" |
| 791 | 789 |
keydata = base64.b64decode( |
| ... | ... |
@@ -802,14 +800,14 @@ class TestStaticFunctionality: |
| 802 | 800 |
"""[`tests.parse_sh_export_line`][] works.""" |
| 803 | 801 |
if value is not None: |
| 804 | 802 |
assert ( |
| 805 |
- tests.data.callables.parse_sh_export_line( |
|
| 803 |
+ callables.parse_sh_export_line( |
|
| 806 | 804 |
line, env_name=env_name |
| 807 | 805 |
) |
| 808 | 806 |
== value |
| 809 | 807 |
) |
| 810 | 808 |
else: |
| 811 | 809 |
with pytest.raises(ValueError, match="Cannot parse sh line:"): |
| 812 |
- tests.data.callables.parse_sh_export_line( |
|
| 810 |
+ callables.parse_sh_export_line( |
|
| 813 | 811 |
line, env_name=env_name |
| 814 | 812 |
) |
| 815 | 813 |
|
| ... | ... |
@@ -1056,14 +1054,14 @@ class TestStaticFunctionality: |
| 1056 | 1054 |
"""Finding all SSH agent socket providers works.""" |
| 1057 | 1055 |
resolve = socketprovider.SocketProvider.resolve |
| 1058 | 1056 |
old_registry = socketprovider.SocketProvider.registry |
| 1059 |
- with tests.machinery.pytest.faked_entry_point_list( |
|
| 1057 |
+ with pytest_machinery.faked_entry_point_list( |
|
| 1060 | 1058 |
additional_entry_points, remove_conflicting_entries=False |
| 1061 | 1059 |
) as names: |
| 1062 | 1060 |
socketprovider.SocketProvider._find_all_ssh_agent_socket_providers() |
| 1063 | 1061 |
for name in names: |
| 1064 | 1062 |
assert name in socketprovider.SocketProvider.registry |
| 1065 | 1063 |
assert resolve(name) in {
|
| 1066 |
- tests.data.callables.provider_entry_provider, |
|
| 1064 |
+ callables.provider_entry_provider, |
|
| 1067 | 1065 |
*old_registry.values(), |
| 1068 | 1066 |
} |
| 1069 | 1067 |
|
| ... | ... |
@@ -1075,7 +1073,7 @@ class TestStaticFunctionality: |
| 1075 | 1073 |
"""Finding faulty SSH agent socket providers raises errors.""" |
| 1076 | 1074 |
with contextlib.ExitStack() as stack: |
| 1077 | 1075 |
stack.enter_context( |
| 1078 |
- tests.machinery.pytest.faked_entry_point_list( |
|
| 1076 |
+ pytest_machinery.faked_entry_point_list( |
|
| 1079 | 1077 |
additional_entry_points, remove_conflicting_entries=False |
| 1080 | 1078 |
) |
| 1081 | 1079 |
) |
| ... | ... |
@@ -1246,7 +1244,7 @@ class TestAgentInteraction: |
| 1246 | 1244 |
self, |
| 1247 | 1245 |
ssh_agent_client_with_test_keys_loaded: ssh_agent.SSHAgentClient, |
| 1248 | 1246 |
ssh_test_key_type: str, |
| 1249 |
- ssh_test_key: tests.data.SSHTestKey, |
|
| 1247 |
+ ssh_test_key: data.SSHTestKey, |
|
| 1250 | 1248 |
) -> None: |
| 1251 | 1249 |
"""Signing data with specific SSH keys works. |
| 1252 | 1250 |
|
| ... | ... |
@@ -1259,11 +1257,11 @@ class TestAgentInteraction: |
| 1259 | 1257 |
key_comment_pairs = {bytes(k): bytes(c) for k, c in client.list_keys()}
|
| 1260 | 1258 |
public_key_data = ssh_test_key.public_key_data |
| 1261 | 1259 |
assert ( |
| 1262 |
- tests.data.SSHTestKeyDeterministicSignatureClass.SPEC |
|
| 1260 |
+ data.SSHTestKeyDeterministicSignatureClass.SPEC |
|
| 1263 | 1261 |
in ssh_test_key.expected_signatures |
| 1264 | 1262 |
) |
| 1265 | 1263 |
sig = ssh_test_key.expected_signatures[ |
| 1266 |
- tests.data.SSHTestKeyDeterministicSignatureClass.SPEC |
|
| 1264 |
+ data.SSHTestKeyDeterministicSignatureClass.SPEC |
|
| 1267 | 1265 |
] |
| 1268 | 1266 |
expected_signature = sig.signature |
| 1269 | 1267 |
derived_passphrase = sig.derived_passphrase |
| ... | ... |
@@ -1291,7 +1289,7 @@ class TestAgentInteraction: |
| 1291 | 1289 |
self, |
| 1292 | 1290 |
ssh_agent_client_with_test_keys_loaded: ssh_agent.SSHAgentClient, |
| 1293 | 1291 |
ssh_test_key_type: str, |
| 1294 |
- ssh_test_key: tests.data.SSHTestKey, |
|
| 1292 |
+ ssh_test_key: data.SSHTestKey, |
|
| 1295 | 1293 |
) -> None: |
| 1296 | 1294 |
"""Using an unsuitable key with [`vault.Vault`][] fails. |
| 1297 | 1295 |
|
| ... | ... |
@@ -1336,11 +1334,11 @@ class TestAgentInteraction: |
| 1336 | 1334 |
def key_is_suitable(key: bytes) -> bool: |
| 1337 | 1335 |
"""Stub out [`vault.Vault.key_is_suitable`][].""" |
| 1338 | 1336 |
always = {
|
| 1339 |
- v.public_key_data for v in tests.data.SUPPORTED_KEYS.values() |
|
| 1337 |
+ v.public_key_data for v in data.SUPPORTED_KEYS.values() |
|
| 1340 | 1338 |
} |
| 1341 | 1339 |
dsa = {
|
| 1342 | 1340 |
v.public_key_data |
| 1343 |
- for k, v in tests.data.UNSUITABLE_KEYS.items() |
|
| 1341 |
+ for k, v in data.UNSUITABLE_KEYS.items() |
|
| 1344 | 1342 |
if k.startswith(("dsa", "ecdsa"))
|
| 1345 | 1343 |
} |
| 1346 | 1344 |
return key in always or ( |
| ... | ... |
@@ -1356,11 +1354,11 @@ class TestAgentInteraction: |
| 1356 | 1354 |
monkeypatch.setattr( |
| 1357 | 1355 |
ssh_agent.SSHAgentClient, |
| 1358 | 1356 |
"list_keys", |
| 1359 |
- tests.data.callables.list_keys_singleton, |
|
| 1357 |
+ callables.list_keys_singleton, |
|
| 1360 | 1358 |
) |
| 1361 | 1359 |
keys = [ |
| 1362 | 1360 |
pair.key |
| 1363 |
- for pair in tests.data.callables.list_keys_singleton() |
|
| 1361 |
+ for pair in callables.list_keys_singleton() |
|
| 1364 | 1362 |
if key_is_suitable(pair.key) |
| 1365 | 1363 |
] |
| 1366 | 1364 |
index = "1" |
| ... | ... |
@@ -1369,11 +1367,11 @@ class TestAgentInteraction: |
| 1369 | 1367 |
monkeypatch.setattr( |
| 1370 | 1368 |
ssh_agent.SSHAgentClient, |
| 1371 | 1369 |
"list_keys", |
| 1372 |
- tests.data.callables.list_keys, |
|
| 1370 |
+ callables.list_keys, |
|
| 1373 | 1371 |
) |
| 1374 | 1372 |
keys = [ |
| 1375 | 1373 |
pair.key |
| 1376 |
- for pair in tests.data.callables.list_keys() |
|
| 1374 |
+ for pair in callables.list_keys() |
|
| 1377 | 1375 |
if key_is_suitable(pair.key) |
| 1378 | 1376 |
] |
| 1379 | 1377 |
index = str(1 + keys.index(key)) |
| ... | ... |
@@ -1389,7 +1387,7 @@ class TestAgentInteraction: |
| 1389 | 1387 |
|
| 1390 | 1388 |
# TODO(the-13th-letter): (Continued from above.) Update input |
| 1391 | 1389 |
# data to use `index`/`input` directly and unconditionally. |
| 1392 |
- runner = tests.machinery.CliRunner(mix_stderr=True) |
|
| 1390 |
+ runner = machinery.CliRunner(mix_stderr=True) |
|
| 1393 | 1391 |
result = runner.invoke( |
| 1394 | 1392 |
driver, |
| 1395 | 1393 |
[], |
| ... | ... |
@@ -1401,7 +1399,7 @@ class TestAgentInteraction: |
| 1401 | 1399 |
|
| 1402 | 1400 |
def test_300_constructor_bad_running_agent( |
| 1403 | 1401 |
self, |
| 1404 |
- running_ssh_agent: tests.data.RunningSSHAgentInfo, |
|
| 1402 |
+ running_ssh_agent: data.RunningSSHAgentInfo, |
|
| 1405 | 1403 |
) -> None: |
| 1406 | 1404 |
"""Fail if the agent address is invalid.""" |
| 1407 | 1405 |
with pytest.MonkeyPatch.context() as monkeypatch: |
| ... | ... |
@@ -1445,7 +1443,7 @@ class TestAgentInteraction: |
| 1445 | 1443 |
|
| 1446 | 1444 |
def test_303_explicit_socket( |
| 1447 | 1445 |
self, |
| 1448 |
- spawn_ssh_agent: tests.data.SpawnedSSHAgentInfo, |
|
| 1446 |
+ spawn_ssh_agent: data.SpawnedSSHAgentInfo, |
|
| 1449 | 1447 |
) -> None: |
| 1450 | 1448 |
conn = spawn_ssh_agent.client._connection |
| 1451 | 1449 |
ssh_agent.SSHAgentClient(socket=conn) |
| ... | ... |
@@ -1453,7 +1451,7 @@ class TestAgentInteraction: |
| 1453 | 1451 |
@Parametrize.TRUNCATED_AGENT_RESPONSES |
| 1454 | 1452 |
def test_310_truncated_server_response( |
| 1455 | 1453 |
self, |
| 1456 |
- running_ssh_agent: tests.data.RunningSSHAgentInfo, |
|
| 1454 |
+ running_ssh_agent: data.RunningSSHAgentInfo, |
|
| 1457 | 1455 |
response: bytes, |
| 1458 | 1456 |
) -> None: |
| 1459 | 1457 |
"""Fail on truncated responses from the SSH agent.""" |
| ... | ... |
@@ -1477,7 +1475,7 @@ class TestAgentInteraction: |
| 1477 | 1475 |
@Parametrize.LIST_KEYS_ERROR_RESPONSES |
| 1478 | 1476 |
def test_320_list_keys_error_responses( |
| 1479 | 1477 |
self, |
| 1480 |
- running_ssh_agent: tests.data.RunningSSHAgentInfo, |
|
| 1478 |
+ running_ssh_agent: data.RunningSSHAgentInfo, |
|
| 1481 | 1479 |
response_code: _types.SSH_AGENT, |
| 1482 | 1480 |
response: bytes | bytearray, |
| 1483 | 1481 |
exc_type: type[Exception], |
| ... | ... |
@@ -1537,7 +1535,7 @@ class TestAgentInteraction: |
| 1537 | 1535 |
@Parametrize.SIGN_ERROR_RESPONSES |
| 1538 | 1536 |
def test_330_sign_error_responses( |
| 1539 | 1537 |
self, |
| 1540 |
- running_ssh_agent: tests.data.RunningSSHAgentInfo, |
|
| 1538 |
+ running_ssh_agent: data.RunningSSHAgentInfo, |
|
| 1541 | 1539 |
key: bytes | bytearray, |
| 1542 | 1540 |
check: bool, |
| 1543 | 1541 |
response_code: _types.SSH_AGENT, |
| ... | ... |
@@ -1597,7 +1595,7 @@ class TestAgentInteraction: |
| 1597 | 1595 |
com = b"no comment" |
| 1598 | 1596 |
loaded_keys = [ |
| 1599 | 1597 |
Pair(v.public_key_data, com).toreadonly() |
| 1600 |
- for v in tests.data.SUPPORTED_KEYS.values() |
|
| 1598 |
+ for v in data.SUPPORTED_KEYS.values() |
|
| 1601 | 1599 |
] |
| 1602 | 1600 |
monkeypatch.setattr(client, "list_keys", lambda: loaded_keys) |
| 1603 | 1601 |
with pytest.raises(exc_type, match=exc_pattern): |
| ... | ... |
@@ -1606,7 +1604,7 @@ class TestAgentInteraction: |
| 1606 | 1604 |
@Parametrize.REQUEST_ERROR_RESPONSES |
| 1607 | 1605 |
def test_340_request_error_responses( |
| 1608 | 1606 |
self, |
| 1609 |
- running_ssh_agent: tests.data.RunningSSHAgentInfo, |
|
| 1607 |
+ running_ssh_agent: data.RunningSSHAgentInfo, |
|
| 1610 | 1608 |
request_code: _types.SSH_AGENTC, |
| 1611 | 1609 |
response_code: _types.SSH_AGENT, |
| 1612 | 1610 |
exc_type: type[Exception], |
| ... | ... |
@@ -1635,7 +1633,7 @@ class TestAgentInteraction: |
| 1635 | 1633 |
def test_350_query_extensions_malformed_responses( |
| 1636 | 1634 |
self, |
| 1637 | 1635 |
monkeypatch: pytest.MonkeyPatch, |
| 1638 |
- running_ssh_agent: tests.data.RunningSSHAgentInfo, |
|
| 1636 |
+ running_ssh_agent: data.RunningSSHAgentInfo, |
|
| 1639 | 1637 |
response_data: bytes, |
| 1640 | 1638 |
) -> None: |
| 1641 | 1639 |
"""Fail on malformed responses while querying extensions.""" |
| ... | ... |
@@ -12,14 +12,14 @@ from typing import TYPE_CHECKING |
| 12 | 12 |
import pytest |
| 13 | 13 |
from hypothesis import stateful, strategies |
| 14 | 14 |
|
| 15 |
-import tests.machinery.pytest |
|
| 16 | 15 |
from derivepassphrase.ssh_agent import socketprovider |
| 16 |
+from tests.machinery import pytest as pytest_machinery |
|
| 17 | 17 |
|
| 18 | 18 |
if TYPE_CHECKING: |
| 19 | 19 |
from derivepassphrase import _types |
| 20 | 20 |
|
| 21 | 21 |
# All tests in this module are heavy-duty tests. |
| 22 |
-pytestmark = [tests.machinery.pytest.heavy_duty] |
|
| 22 |
+pytestmark = [pytest_machinery.heavy_duty] |
|
| 23 | 23 |
|
| 24 | 24 |
|
| 25 | 25 |
@strategies.composite |
| ... | ... |
@@ -11,10 +11,9 @@ import hypothesis |
| 11 | 11 |
import pytest |
| 12 | 12 |
from hypothesis import strategies |
| 13 | 13 |
|
| 14 |
-import tests.data |
|
| 15 |
-import tests.data.callables |
|
| 16 |
-import tests.machinery.hypothesis |
|
| 17 | 14 |
from derivepassphrase import _types |
| 15 |
+from tests import data |
|
| 16 |
+from tests.machinery import hypothesis as hypothesis_machinery |
|
| 18 | 17 |
|
| 19 | 18 |
|
| 20 | 19 |
class Parametrize(types.SimpleNamespace): |
| ... | ... |
@@ -22,20 +21,20 @@ class Parametrize(types.SimpleNamespace): |
| 22 | 21 |
"test_config", |
| 23 | 22 |
[ |
| 24 | 23 |
conf |
| 25 |
- for conf in tests.data.TEST_CONFIGS |
|
| 24 |
+ for conf in data.TEST_CONFIGS |
|
| 26 | 25 |
if conf.validation_settings in {None, (True,)}
|
| 27 | 26 |
], |
| 28 |
- ids=tests.data.VaultTestConfig._test_id, |
|
| 27 |
+ ids=data.VaultTestConfig._test_id, |
|
| 29 | 28 |
) |
| 30 | 29 |
VAULT_TEST_CONFIGS = pytest.mark.parametrize( |
| 31 | 30 |
"test_config", |
| 32 |
- tests.data.TEST_CONFIGS, |
|
| 33 |
- ids=tests.data.VaultTestConfig._test_id, |
|
| 31 |
+ data.TEST_CONFIGS, |
|
| 32 |
+ ids=data.VaultTestConfig._test_id, |
|
| 34 | 33 |
) |
| 35 | 34 |
|
| 36 | 35 |
|
| 37 | 36 |
@Parametrize.VALID_VAULT_TEST_CONFIGS |
| 38 |
-def test_200_is_vault_config(test_config: tests.data.VaultTestConfig) -> None: |
|
| 37 |
+def test_200_is_vault_config(test_config: data.VaultTestConfig) -> None: |
|
| 39 | 38 |
"""Is this vault configuration recognized as valid/invalid? |
| 40 | 39 |
|
| 41 | 40 |
Check all test configurations that do not need custom validation |
| ... | ... |
@@ -56,14 +55,14 @@ def test_200_is_vault_config(test_config: tests.data.VaultTestConfig) -> None: |
| 56 | 55 |
|
| 57 | 56 |
|
| 58 | 57 |
@hypothesis.given( |
| 59 |
- test_config=tests.machinery.hypothesis.smudged_vault_test_config( |
|
| 58 |
+ test_config=hypothesis_machinery.smudged_vault_test_config( |
|
| 60 | 59 |
config=strategies.sampled_from([ |
| 61 |
- conf for conf in tests.data.TEST_CONFIGS if conf.is_valid() |
|
| 60 |
+ conf for conf in data.TEST_CONFIGS if conf.is_valid() |
|
| 62 | 61 |
]) |
| 63 | 62 |
) |
| 64 | 63 |
) |
| 65 | 64 |
def test_200a_is_vault_config_smudged( |
| 66 |
- test_config: tests.data.VaultTestConfig, |
|
| 65 |
+ test_config: data.VaultTestConfig, |
|
| 67 | 66 |
) -> None: |
| 68 | 67 |
"""Is this vault configuration recognized as valid/invalid? |
| 69 | 68 |
|
| ... | ... |
@@ -89,7 +88,7 @@ def test_200a_is_vault_config_smudged( |
| 89 | 88 |
|
| 90 | 89 |
@Parametrize.VAULT_TEST_CONFIGS |
| 91 | 90 |
def test_400_validate_vault_config( |
| 92 |
- test_config: tests.data.VaultTestConfig, |
|
| 91 |
+ test_config: data.VaultTestConfig, |
|
| 93 | 92 |
) -> None: |
| 94 | 93 |
"""Validate this vault configuration. |
| 95 | 94 |
|
| ... | ... |
@@ -121,14 +120,14 @@ def test_400_validate_vault_config( |
| 121 | 120 |
|
| 122 | 121 |
|
| 123 | 122 |
@hypothesis.given( |
| 124 |
- test_config=tests.machinery.hypothesis.smudged_vault_test_config( |
|
| 123 |
+ test_config=hypothesis_machinery.smudged_vault_test_config( |
|
| 125 | 124 |
config=strategies.sampled_from([ |
| 126 |
- conf for conf in tests.data.TEST_CONFIGS if conf.is_smudgable() |
|
| 125 |
+ conf for conf in data.TEST_CONFIGS if conf.is_smudgable() |
|
| 127 | 126 |
]) |
| 128 | 127 |
) |
| 129 | 128 |
) |
| 130 | 129 |
def test_400a_validate_vault_config_smudged( |
| 131 |
- test_config: tests.data.VaultTestConfig, |
|
| 130 |
+ test_config: data.VaultTestConfig, |
|
| 132 | 131 |
) -> None: |
| 133 | 132 |
"""Validate this vault configuration. |
| 134 | 133 |
|
| ... | ... |
@@ -10,11 +10,11 @@ import hypothesis |
| 10 | 10 |
from hypothesis import strategies |
| 11 | 11 |
from typing_extensions import Any |
| 12 | 12 |
|
| 13 |
-import tests.machinery.pytest |
|
| 14 | 13 |
from derivepassphrase import _types |
| 14 |
+from tests.machinery import pytest as pytest_machinery |
|
| 15 | 15 |
|
| 16 | 16 |
# All tests in this module are heavy-duty tests. |
| 17 |
-pytestmark = [tests.machinery.pytest.heavy_duty] |
|
| 17 |
+pytestmark = [pytest_machinery.heavy_duty] |
|
| 18 | 18 |
|
| 19 | 19 |
|
| 20 | 20 |
@strategies.composite |
| ... | ... |
@@ -17,8 +17,8 @@ import pytest |
| 17 | 17 |
from hypothesis import strategies |
| 18 | 18 |
from typing_extensions import TypeVar |
| 19 | 19 |
|
| 20 |
-import tests.machinery.hypothesis |
|
| 21 | 20 |
from derivepassphrase import vault |
| 21 |
+from tests.machinery import hypothesis as hypothesis_machinery |
|
| 22 | 22 |
|
| 23 | 23 |
if TYPE_CHECKING: |
| 24 | 24 |
from collections.abc import Callable, Iterator |
| ... | ... |
@@ -503,7 +503,7 @@ class TestVault: |
| 503 | 503 |
min_size=1, |
| 504 | 504 |
max_size=32, |
| 505 | 505 |
), |
| 506 |
- config=tests.machinery.hypothesis.vault_full_service_config(), |
|
| 506 |
+ config=hypothesis_machinery.vault_full_service_config(), |
|
| 507 | 507 |
services=strategies.lists( |
| 508 | 508 |
strategies.binary(min_size=1, max_size=32), |
| 509 | 509 |
min_size=2, |
| ... | ... |
@@ -629,7 +629,7 @@ class TestVault: |
| 629 | 629 |
phrase=strategies.one_of( |
| 630 | 630 |
strategies.binary(min_size=1), strategies.text(min_size=1) |
| 631 | 631 |
), |
| 632 |
- config=tests.machinery.hypothesis.vault_full_service_config(), |
|
| 632 |
+ config=hypothesis_machinery.vault_full_service_config(), |
|
| 633 | 633 |
service=strategies.text(min_size=1), |
| 634 | 634 |
) |
| 635 | 635 |
@hypothesis.example( |
| 636 | 636 |