Small issue with nosetests

Hi, I have been working my way through the Learn python 3 the hard way books recently and am nearly at the end of the first book. I have been having and issue when using nose to do automated testing and it appears to be related to the file structure listed in the book. In the book we list the file structure as

ex48\
    bin\
    docs\
    ex48\
        __init__.py
        lexicon.py
        parser.py
    tests\
        __init__.py
        lexicon_tests.py
    setup.py

I have copied this file structure exactly as in the book. If I run ls an ls -r this is the output.

The issue I am having is that when I run nose test with this file structure, the output is 0 test ran, I have found a work around to this problem by moving my test file to the root directory so it reflects as so:

ex48\
    bin\
    docs\
    ex48\
        __init__.py
        lexicon.py
        parser.py
    tests\
        __init__.py
    lexicon_tests.py
    setup.py

As far as I can tell this resolves the issue, but I am not sure why exactly it does not work as shown in the book. I have continued to work through the book using this workaround method, but was curious to find out what reason might be causing it not to work properly. For reference I am running python 3.10.2. I have more screenshots I was going to attach but was only able to do one in this post.

Don’t was your time with nosetest. Switch to pytest. If you search this forum, you’ll find plenty of posts about this.

1 Like

thanks for the reply, I will look into pytest when I get home from work tonight.

A free service run by Zed A. Shaw for learncodethehardway.org.