For now I’d like to stick with the book as-written. I’ll tackle unittest, Pytest, and whatever else is new and different, later.
So how do I fix this?
I made an addition to the code I posted above. I had “dumb_tests.py” print what it thinks the “path” is before attempting to import module “dumb.” To wit:
from os import sys
from nose.tools import *
When I run this revised version of “dumb_tests.py”, it looks like this:
PS C:\Users\WinTenProBox\Google Drive\Python\test_directory\projects\DumbProject> python .\tests\dumb_tests.py
['C:\\Users\\WinTenProBox\\Google Drive\\Python\\test_directory\\projects\\DumbProject\\tests', 'C:\\Windows\\SYSTEM32\\python27.zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', 'C:\\Python27\\lib\\plat-win', 'C:\\Python27\\lib\\lib-tk', 'C:\\Python27', 'C:\\Users\\WinTenProBox\\AppData\\Roaming\\Python\\Python27\\site-packages', 'C:\\Python27\\lib\\site-packages']
Traceback (most recent call last):
File ".\tests\dumb_tests.py", line 5, in <module>
ImportError: No module named dumb
For some reason Python has the \tests subdirectory of my project in sys.path, but not the \dumb subdirectory. I guess that’s where the problem lies.
I think I found at least a temporary fix. If I add the following to “dumb_tests.py” before attempting to import module “dumb”:
then “dumb_tests.py” completes successfully. Not sure whether this is the “textbook” answer but it seems to work.
I am having other difficulties with “setup.py” - it thinks one of my /bin scripts isn’t there. Another path problem I expect.