[CentralOH] Expert Python Programming Chapter 6
mark at microenh.com
Sat Jun 11 13:18:53 CEST 2011
On Jun 10, 2011, at 8:59 PM, Mark Erbaugh wrote:
> Has anyone been able to get the Atomisator packages set up and running nosetests as per the book? I've tried with Python2.5, 2.6 and 2.7 on the Mac and Python 2.6 on Ubuntu Linux. I've tried using the template creating package (pbp.skels) described in the book (0.1.0) as well as a newer one (0.2.40) downloaded from the web (easy_install pbp.skels)
> I can create the atomisator.parser package following the instructions but can't get nosetest to run the doctest in the README.txt file.
> Here's the output of pip freeze showing the libraries and versions installed in the virtualenv:
> When doing python setup.py develop to install the atomisator.parser package, I notice a warning that test_requires (mentioned in setup.py) is an uknown distribution option.
Well, I've figured part of this out. In the book, the command to run the nosetests is:
But I found that to get it to run the doctest, I had to include --with-doctest on the command line as well.
There are also a couple of discrepancies in the test runner output that I get versus what's in the book:
1) The doctest given has several lines, all of which will fail initially. In the book, the test runner output only reports the first failure. On my machine, all the failures are reported. I tried using the nosetest -x option that stops after the error or failure, but that doesn't seem to change my output.
2) The doctest uses the ellipsis (...) to match some ignored output. When I run the test, the output isn't ignored and the test runner reports a failure to match the output. I've not worked with doctests before, but it looks like the doctest.ELLIPSIS option needs to be specified. When using nose as a test runner, where does one specify doctest options?
Could some of the discrepancies I've seen be related to me using a newer version of nose (the book was published in 2009)?
More information about the CentralOH