https://git.schokokeks.org/derivepassphrase.git/tree/fdef62d81b60bf2188f957874775500abc1f5a36 Recent commits to derivepassphrase.git (fdef62d81b60bf2188f957874775500abc1f5a36) 2024-12-09T11:30:59+01:00 tag:gitlist.org,2012:commit/fdef62d81b60bf2188f957874775500abc1f5a36 Explicitly support Pageant 0.82 in the test suite 2024-12-09T11:30:59+01:00 Marco Ricci software@the13thletter.info <pre>Pageant 0.82, released two weeks ago, supports both proper output buffer flushing and a "foreground" mode. Foreground mode is used to correctly isolate a spawned Pageant instance in the test suite. The test for Pageant's suitability can now be simplified to whether it is at least version 0.82, or not. Furthermore, because no published version of Pageant supports only proper output buffer flushing but not foreground mode, it is no longer necessary to arrange for debug output to be silently discarded. This further simplifies SSH agent handling considerably. Finally, we fix various mistakes in the documentation of the testing machinery. &lt;/pre&gt; tag:gitlist.org,2012:commit/b9dd956b59b6f53a572076fea6d686f1626eeba8 Clean up "docs" hatch environment, also subsuming "release" 2024-12-08T19:06:33+01:00 Marco Ricci software@the13thletter.info <pre>&lt;/pre&gt; tag:gitlist.org,2012:commit/d4a0d475385ea6bd9d559eb1cd23f2f98a259cf9 Merge topic branch 'logging' into master 2024-12-08T19:03:08+01:00 Marco Ricci software@the13thletter.info <pre>* t/logging: Document the switch to the logging and warning systems in the changelog &lt;/pre&gt; tag:gitlist.org,2012:commit/ad0fe1ec36de50d886fc4b0ed988203bc557c90f Document the switch to the logging and warning systems in the changelog 2024-12-08T19:02:03+01:00 Marco Ricci software@the13thletter.info <pre>&lt;/pre&gt; tag:gitlist.org,2012:commit/1ec3538850a7af2723f17b8ca8dfe93158b421cb Refactor code to run under Python 3.9's LL(1) parser 2024-12-08T17:44:25+01:00 Marco Ricci software@the13thletter.info <pre>Though it does not do so by default, Python 3.9 can run with the old LL(1) parser instead of the PEG-based parser. Most importantly, the LL(1) parser does not support parenthesized context manager expressions, and this is why they have only become officially supported in Python 3.10, once the PEG-based parser became mandatory. Therefore, for compatibility, we replace every "proper" parenthesized context manager expression with equivalent explicit use of a `contextlib.ExitStack`, and every degenerate such expression by removing the parentheses. We now also explicitly test `derivepassphrase` with the LL(1) parser, for as long as Python 3.9 remains supported. While the use of a `contextlib.ExitStack` comes with additional runtime cost, by a lucky coincidence, all such proper usage of parenthesized context manager expressions is confined to the test suite, where we really don't care too much about slightly higher runtimes if it buys us more clarity, correctness and compatibility instead. &lt;/pre&gt; tag:gitlist.org,2012:commit/c60c4077952fd420bc5ba0e86174e27289d96e2e Merge topic branch 'logging' into master 2024-12-08T12:36:36+01:00 Marco Ricci software@the13thletter.info <pre>* t/logging: Adapt the test suite to use the logging system properly Emit new info messages and better debug messages in the exporter modules Use the logging system to emit warnings and error messages Shift option parsing and grouping machinery to a separate section Reimplement deprecated subcommands, properly, in `click` &lt;/pre&gt; tag:gitlist.org,2012:commit/e1017eeffe4f16747629724b8f48ba298508ba80 Adapt the test suite to use the logging system properly 2024-12-07T09:30:38+01:00 Marco Ricci software@the13thletter.info <pre>Given the previous changes to warning and error reporting, the test suite needs new helper code to deal with them. Again, the changes to mosts tests are straight-forward (the location and formatting of messages changes slightly), but the new logging machinery itself now also needs to be tested... particularly the code that hooks into Python's logging system, into Python's warning system, and between those two. `pytest` actually includes test fixtures to capture and interact with warnings and logging calls, but these work on the library level: warnings are captured as warnings, logging calls are captured as log records. To be useful to application testing, it is necessary to inspect and assert both the low-level warnings/log records as well as the standard error output they ultimately translate to. The `hypothesis`-based tests need particular (manual) care, because `hypothesis` rejects tests using function-scoped `pytest` fixtures. &lt;/pre&gt; tag:gitlist.org,2012:commit/5f2870876eb2317c57560fbbda87ed8f80917f97 Emit new info messages and better debug messages in the exporter modules 2024-12-07T09:30:38+01:00 Marco Ricci software@the13thletter.info <pre>&lt;/pre&gt; tag:gitlist.org,2012:commit/aa248f1632393352772ba4d8969f6e983dc1a47b Use the logging system to emit warnings and error messages 2024-12-07T09:30:38+01:00 Marco Ricci software@the13thletter.info <pre>Employ the Python standard library module `logging` to issue warning and error messages, as well as (partially new) debug messages. Operational warning messages and operational deprecation messages are handled via the `derivepassphrase` and `derivepassphrase.deprecation` loggers with a custom handler that prints the resulting formatted message to standard error. (Errors, info and debug messages use the same system, but differ slightly in the formatting.) Most of the rewriting of warnings and error messages to fit this new machinery is pretty straight-forward. The messy parts are the integration of the `logging` machinery and the `warnings` machinery into `click`, which isn't really designed with this in mind. Concretely, this entails writing a custom logging handler that uses `click.echo`, a custom formatter that prefixes messages with the program name (and "warning", "deprecation warning" or "debug" as necessary), a singleton configuration of this handler and formatter, various wrappers around standard `click` infrastructure to ensure that this integration code actually runs during normal operation, and finally, new command-line options to control the level of output on standard error. &lt;/pre&gt; tag:gitlist.org,2012:commit/6e2d2728b76c22a0d2280c34a55dba45885084cb Shift option parsing and grouping machinery to a separate section 2024-12-07T08:50:03+01:00 Marco Ricci software@the13thletter.info <pre>We expect to add new option categories that apply to multiple super- and subcommands, not just the "vault" subcommand. &lt;/pre&gt;