Coding 2021-08-15

By Max Woerner Chase

Okay, I'm starting on this entry a little earlier than usual, because I couldn't think of a reason not to. Here's what running MOTR with its repository's prototype file gives me:

AttributeError: module 'motr.api' has no attribute 'Input'

Let's start dealing with these errors.

/api\.Input

[1/14]

Okay...

AttributeError: module 'motr.api' has no attribute 'add_target'

Uh-huh...

/add_target

[1/8]

Cool...

TypeError: mkdir() missing 1 required positional argument: 'name'

Okay, I'm going to need to refresh my memory on that...

Okay, yeah, I just completely blanked on that part of the API while I was drafting this.

TypeError: expected str, bytes or os.PathLike object, not Input

Wait, is that... is that a bug? The error message is kind of vague...

python -m pdb -m motr

That wasn't the right command.

python -m pdb (pyenv which motr)

c

That's better. Except not much better, because it's not post-mortem-ing when I expect. So, instead, let's put a breakpoint in the config file (!!!) and run normally...

Okay, let's see... from experimentation, I see that it's only hitting the breakpoint once, so I just need to inspect the first invocation of this function. I'm not seeing anything too crazy from poking around, it's probably super obvious... But anyway, let's see how many times we go through the cmd iterator.

> /home/maxchase/Documents/synched/motr/motr/motrfile.py(111)run_pytest()
-> api.cmd(
(Pdb) n
> /home/maxchase/Documents/synched/motr/motr/motrfile.py(112)run_pytest()
-> runner + pytest_suffix(junit_file),
(Pdb) n
> /home/maxchase/Documents/synched/motr/motr/motrfile.py(113)run_pytest()
-> f"pytest-{env_name}",
(Pdb) n
> /home/maxchase/Documents/synched/motr/motr/motrfile.py(114)run_pytest()
-> report_dir,
(Pdb) n
> /home/maxchase/Documents/synched/motr/motr/motrfile.py(111)run_pytest()
-> api.cmd(
(Pdb) n
> /home/maxchase/Documents/synched/motr/motr/motrfile.py(115)run_pytest()
-> *test_extra_inputs,
(Pdb) n
> /home/maxchase/Documents/synched/motr/motr/motrfile.py(111)run_pytest()
-> api.cmd(
(Pdb) n
> /home/maxchase/Documents/synched/motr/motr/motrfile.py(116)run_pytest()
-> allowed_codes=[1],
(Pdb) n
> /home/maxchase/Documents/synched/motr/motr/motrfile.py(111)run_pytest()
-> api.cmd(
(Pdb) n
> /home/maxchase/Documents/synched/motr/motr/motrfile.py(110)run_pytest()
-> yield from (
(Pdb) n
TypeError: expected str, bytes or os.PathLike object, not Input

All right, let's do that again...

After far too much effort, I have isolated the value that it's choking on: Input(path=PosixPath('reports/pytest'))

Which allows me to finally narrow it down to an argument type error in the motrfile. That could have definitely signalled things to me better. I think my best bet is to wrap the error in the coercion function. I should probably also have error checking at the top-level code that users are supposed to invoke.

And, running it again, I got the same error, but from a different line of the config file.

And, fixing that, I find... this looks like an actual bug. Got all the way through config, and then something acted up in the Cmd class. Looks like I forgot to make some of the required directories exist.

So, I fixed that bug, and I'll bundle that into the 0.1.1 release. Next issues: failed to set up dependencies in the motrfile, and then fixing that broke something else... Or maybe I didn't fix it... This is confusing.

: No module named venv

... What.

Okay, let's rewrite the references to python to sys.executable.

All right, that worked. Ish.

Then, I had to add a message to one of the exceptions I was raising. I'm not sure what happened in the run after that, I think it might have run into synchronization issues because I never disabled synching on the directory, so, I'll do that in a sec.

And now it... um... after I fixed a frankly embarrassing bug in uncovered code, now it is... sometimes... failing... because paths to pip are sometimes paths to ~ip.

I'd love to know which ghost I angered to make that happen.

But anyway, it runs, sometimes. Unless it does

ERROR: Could not install packages due to an OSError: [('/home/maxchase/Documents/synched/motr/motr/.coverage', '/tmp/pip-req-build-oeiz90rh/.coverage', "[Errno 2] No such file or directory: '/home/maxchase/Documents/synched/motr/motr/.coverage'")]

That.

Why is it trying to install the coverage data file?

Actually, I think I understand, but... really, I don't deserve this synchronization issue.

Anyway, when it... works, it says it runs sub-20 seconds. Now, I'm sure it can do better performance-wise, but first it needs to do better correctness-wise.

But, I'm not going to figure that out tonight. However, the code technically can run at this point, at least on my machine, so I pushed out a new version. Now everyone gets to sort of, sometimes, run this thing's tests against itself.

I don't want to think about this any more tonight.

Good night.