Just this one thing…

Volume 19, Issue 4; 18 Mar 2016

It’s always just one thing after another.

Weeks of programming can save you hours of planning.

This morning, I thought I'd spend a short while getting setup to write some tests. I've got a library that needs writing and it's going to need unit tests. [All modules need unit tests –ed]

The environment in which I need to do this is complicated and mostly designed for some front end work in the browser. (The npm install command downloads how much stuff? [Nevermind, not your problem —ed]) But that's ok, I can use an eval method for short term gain. I'd like to write some tests and make progress on the module today, getting integrated properly can wait.

Except that running the eval endpoint is odd for perfectly legitimate reasons that aren't important now. But that's ok because I can write a little Python script to do the eval.

Except it turns out that I need a library module that's not accessible from the context where I'm going to write the tests. But that's ok, I can just move it.

Except that not everyone thinks that's a good idea. But that's ok, I can work around it by installing the module locally when I run the tests.

Except that that's going to mean enhancing my little Python test runner. But that's ok, I can pretty easily enhance it to install the module.

Except that it doesn't do any good to install it in the server's modules directory because that's not where the eval endpoint looks for code. But that's ok, because where it does need to be installed is actually convenient from one perspective.

Except that all the other modules will need to be installed there too. But that's ok, because I can just enhance my Python script a litle more.

Except that when I run the tests they don't work. But that's ok, that's why I wrote tests.

Except that debugging tests by looking at the output from eval is a real PITA. That's not really OK, … [Nevermind! Another day! Just get them running! —ed]

Except that the results are really weird. But that's ok, because that must be about a transaction boundary. I can fix that.

Except that that turns out to require more refactoring of my Python script. But that's ok.

Except that it still doesn't work. But that's ok, it's obviously something simple because it's still really weird. But that’s ok, because, no, wait, what!?

Turns out I'm running the tests as the wrong user. It follows, I think, that maybe I was wrong about the transaction boundary problem. I should take that code out and test again…

Right, so by days end, I have a running test. Good thing I allocated an hour to get this setup.

Moral: once you start to go off into the weeds, it’s always just this one thing to get back out again.