[TIP] running nosetests automatically in the background?
andrzejkrzywda at gmail.com
Sun Mar 25 14:02:19 PDT 2007
> I haven't used nosy, but I tried autotest. For a day. Yeah, it was
> enough to annoy me. ;) After testing it myself I admit I don't really
> like the idea of running certain tests automatically on every file
I also tried autotest with one of my rails applications. I found it
very useful. As long as your unit tests are fast enough autotest
shouldn't disturb you. It is simply a faster feedback on the changes
you make in your code.
> For starters: test choice heuristics aren't perfect and never
> will be - an application would not only have to understand the code
> and tests but read my mind as well - who knows what intention I have
> in changing certain lines of code?
Fully agree here. I prefer simple solutions - running a single unit
test for the class you are currently working on should be enough.
Autotest result is only a partial feedback - after you finish
refactoring you should (as you mentioned) run all of your tests.
I was missing autotest so much in my daily python work that I decided
to simulate it with Eclipse and PyDev (tools that I use with
You can enable 'automatic build' in Eclipse project. Then you set your
'project builder'. It can be a simple python script that tries to
locate a unit test for a file that is passed as an argument.
Now, whenever I save a file the unit test runs in a console view. It's
invoked on a different thread, so I can carry on with my work.
When I work on a functional test (which is slower) I temporarily
disable the automatic build feature.
It seems to work fine. I've been trying it with the colleague that I
was pair-programming with and we didn't have any complaints.
More information about the testing-in-python