Coding 2022-03-27
This pace feels a little frustrating, but whatever. Before I can write tests, I need to expose the modules through the public interface to MOTR, and I want the way I expose them to make sense.
The idea I currently have in mind is to expose the contents of the motr._api.cli package under motr.api.cli, but doing that means making sure that all of the contents of motr._api.cli make sense to export. So, let's take a look at that.
- cli.coverage contains modules for each coverage subcommand. I think I want cli.coverage to contain helper functions, and this be called something like cli.coverage_commands; it can re-export the modules as well for convenience.
- cli.junitparser contains modules for the only junitparser subcommand. I'll probably do something similar to coverage, above.
- cli.build is needed to build the wheels that will be tested. I seem to have not hooked this up to anything, but it's going to be needed in order to set up the constraints files that will power everything. I'm not sure if it's necessary to expose it to the API, but I might as well.
- flake8, junit2html, limit_coverage, mypy are all straightforward and should stay as-is.
- cli.pip, while it does wrap a command-line utility, does so in a more restricted way because it's part of the basis of the other wrappers. It should be moved to motr._api.installers.pip.
- pyinstrument and pytest should stay as-is. As should python.
- cli.python_helpers should be moved to something like motr._api.helpers.python_helpers.
- cli.types should be moved to motr._api.cli_types.not_output.
Let's see about making these changes...
Well, before I touched anything, I discovered that flake8-html, or at least my fork, got broken. On further investigation, it's my fork. Let's see about fixing this up...
It was a little unfortunate that "flake8 crashed because of your hacked-up plugin" apparently has the same exit code as "the code had issues". But that was a pretty straightforward fix, thanks upstream.
Okay, let's actually start rearranging this...
Okay, done moving the files. Let's see how many Mypy errors this gives me. Huh. Only 8.
I addressed those and some other issues, then worked on exporting the CLI interfaces. There were... some issues, but it looks like the situation is improving...
Anyway, with all of that, I've got much better coverage numbers now. Still not ready, but the only file only non-executed lines in it...
Is my experimental generic protocol for replacing the registries.
Oh boy.
I really don't want to throw that away, so I guess I'm going to have to write mypy tests for that so I can qualify it enough to feel safe using it in the rest of the app.
It's getting late, so I'm going to publish this post now, and work on adding mypy tests the next time I pick this code up.
Good night.