Skip to main content

Posts

Showing posts from April, 2019

Return of Python Unittests

I got into the habit of using Python unit tests in a job a few about a year ago. I eventually created the jsonhunt.py unit test in my Toys repository but it stopped working. I haven't even used the jsonhunt script in a while and am no longer certain of its usefulness but I don't like the idea of not being able to do unit tests if I wanted to. Simple working example So I sat down and got a simple unit test working. Here's the test script: Notes I wish I had found a way to see options or arguments in the test but I couldn't find a way to do that. I had to settle for an environment variable to control the logging level. From the job I mentioned, I remembered we had a way of specifying the log level through some sort of option but I couldn't find a opportunity to get such an option, even through the superclass. At first I was trying to use a zero-argument constructor method but that wasn't working so I added *args, **vargs . From the command line...