Recent commits to derivepassphrase.git (79e5c37b8eac357c6b5afb6fdcd5e70c0ee3dd43) https://git.schokokeks.org/derivepassphrase.git/tree/79e5c37b8eac357c6b5afb6fdcd5e70c0ee3dd43 Recent commits feed provided by GitList. Regroup the CLI and SSH agent tests into smaller groups Beyond the five main groups that reflect the original five test classes for the command-line interface, introduce further classes/groupings for related tests, and trim the test names appropriately. In particular, remove the ordinal in the test name until the new order (due to the new class names and trimmed test names) sufficiently settles. Do the same for the SSH agent tests. (This could have been done for all tests, but with diminishing returns.) The grouping currently (mostly) reflects thematic similarity, but in the long run, we intend for it to reflect both thematic similarity and common test environments, with respect to setup and teardown: tests of the same group should look similar to each other too, and common code among tests of the same group should be factored out if possible. The grouping is inserted, syntactically, between the existing test functions. In particular, to keep the diff readable, we do not relocate or reorder any test functions yet in this commit. We add some TODOs to indicate where further reordering or rewriting is necessary, beyond just introducing new groups. The intended (but not yet implemented) sharing of test setup and teardown code will probably entail using fixtures, pytest's preferred mechanism for shared setup and teardown. However, as of this writing, it is still an open question how to deal with `hypothesis`-based tests in this scenario: they do not work well together with per-function test fixtures, but we also do *not* want to have to (re-)implement all setup/teardown pairs once as a fixture and once as a context manager. https://git.schokokeks.org/derivepassphrase.git/commit/79e5c37b8eac357c6b5afb6fdcd5e70c0ee3dd43 software@the13thletter.info (Marco Ricci) Mon, 11 Aug 2025 21:50:42 +0200 79e5c37b8eac357c6b5afb6fdcd5e70c0ee3dd43 Remove outdated test for CLI program name and version number The more exhaustive `--version` output parsing tests already assert that the program name and version number match their expected values. There is no point in separately testing this. https://git.schokokeks.org/derivepassphrase.git/commit/b5da8fcc777a208d6763a37524e08402e47cf79a software@the13thletter.info (Marco Ricci) Sat, 09 Aug 2025 19:04:38 +0200 b5da8fcc777a208d6763a37524e08402e47cf79a Ensure that `pytest` picks up the newly-split test modules again If a test module is merely converted to a package, then `pytest` will no longer pick it up, because the name `__init__.py` does not match the test module name pattern anymore. So, rename them. Also set the `pytest` import mode to `importlib`, as per the documentation's suggestion. I haven't had any trouble with this *yet*, but now I have similarly named modules, so this might otherwise crop up in the future. https://git.schokokeks.org/derivepassphrase.git/commit/f3bcf5b55a4aa19b733a1d1fa9562ff201f06adf software@the13thletter.info (Marco Ricci) Sat, 09 Aug 2025 18:49:50 +0200 f3bcf5b55a4aa19b733a1d1fa9562ff201f06adf Split the CLI tests into one file per class/group The CLI tests, already loosely grouped through the use of classes, are now distributed to different files, one file per test class. This is mostly an attempt to keep the file size managable. Navigating in a multi-thousand-line Python file with very similar looking tests gets disorienting very quickly. https://git.schokokeks.org/derivepassphrase.git/commit/9ad57b1f6bde28fb9da3f0a3bd2fd4188455dd2a software@the13thletter.info (Marco Ricci) Sat, 09 Aug 2025 16:22:42 +0200 9ad57b1f6bde28fb9da3f0a3bd2fd4188455dd2a Format and lint all test files https://git.schokokeks.org/derivepassphrase.git/commit/d4cd8ce103374859a324c50deab8954a08c4626d software@the13thletter.info (Marco Ricci) Sat, 09 Aug 2025 15:19:17 +0200 d4cd8ce103374859a324c50deab8954a08c4626d Use leaf module imports in all test modules 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.) https://git.schokokeks.org/derivepassphrase.git/commit/a5135873c0ebd313b0272b449b620a10115511f3 software@the13thletter.info (Marco Ricci) Sat, 09 Aug 2025 15:12:40 +0200 a5135873c0ebd313b0272b449b620a10115511f3 Split off "heavy duty" tests from the respective test file Split off the slow, `hypothesis`-based integration tests (the "heavy duty" tests) from the `test_derivepassphrase_cli`, `test_derivepassphrase_ssh_agent` and `test_derivepassphrase_types` modules into separate submodules named `heavy_duty`. Additionally, mark the contents of these `heavy_duty` submodules with the `heavy_duty` `pytest` mark. We do this both because the integration tests are slow and because they are relatively large per test: you typically write a whole new class plus support code per test, plus you reexport one of the class's attributes as a top-level, auto-discoverable test. Though specifically marked, the tests are still run by default. https://git.schokokeks.org/derivepassphrase.git/commit/493fe930240feade37cec6aef097a9740cea550e software@the13thletter.info (Marco Ricci) Sat, 09 Aug 2025 14:44:43 +0200 493fe930240feade37cec6aef097a9740cea550e Turn the `vault` test config functions into methods Turn the `is_valid_test_config`, `is_smudgable_vault_test_config` and `_test_config_ids` functions into methods of the `VaultTestConfig` class: `is_valid`, `is_smudgable` and `_test_id`. This fits the overall intent of only providing types and some simple predicates or transformations, and it reads much nicer if a short method name is used instead of an explicit function name. (And if a one-argument function is required, it can be obtained, as a bound method, from the class.) https://git.schokokeks.org/derivepassphrase.git/commit/4b8ef3e200e3de1167e073c9163be34cd77205fa software@the13thletter.info (Marco Ricci) Fri, 08 Aug 2025 23:09:22 +0200 4b8ef3e200e3de1167e073c9163be34cd77205fa Reformat tests after refactoring https://git.schokokeks.org/derivepassphrase.git/commit/9216af9db7d5575dda22b5a5f5bffc028a446cd3 software@the13thletter.info (Marco Ricci) Fri, 08 Aug 2025 22:58:55 +0200 9216af9db7d5575dda22b5a5f5bffc028a446cd3 Split the top-level `tests` module into subpackages Split the top-level `tests` module into a pair of subpackages `tests.data` and `tests.machinery`, grouping them by import requirements. This "stratifies" the data, and (in some cases) reduces the amount of necessary support code while also (always) forcing us to carefully consider the scope and the prerequisites of every test support datum or function. As a practical example of the benefits of this stratification, the `test_key_signatures_and_outputs.py` script can get away with importing only the lowest stratum `tests.data`, and thus does not need `pytest` or `hypothesis` installed to run. There are five strata, defined by the five subordinate modules in the `tests` package: `tests.data`, `tests.data.callables`, `tests.machinery`, `tests.machinery.pytest` and `tests.machinery.hypothesis`. Each module may import from modules earlier in the list, but not later. The `tests.data.callables` submodule and the `tests.machinery` subpackage differ in that the `test.data.callables` are still expected to be functional and useful even without a testing system, the latter not necessarily. https://git.schokokeks.org/derivepassphrase.git/commit/f2b427b0887e6b0b4184cfb6353faf4d66cbe4de software@the13thletter.info (Marco Ricci) Fri, 08 Aug 2025 22:58:18 +0200 f2b427b0887e6b0b4184cfb6353faf4d66cbe4de