Hello all, this is my first time posting and I need some help.
I have tried this exercise a few times. I have not had any other trouble in the book that I haven’t been able to research and figure out. I browsed the forum/internet before asking, but here it goes.
I go through ex 46 and follow the directions.
I have installed pip, virtualenv, nose, and setuptools.
Here is my directory structure.
I created the init.py files for the tests and NAME directories.
The set up file and the NAME_tests.py file were copied by hand from the book and saved.
Just as a side not I added these files to their respective directories as well as the book describes.
I then start the virtual environment in Powershell with ..venvs\lpthw\Scripts\activate and get into the virtual environment that was created, cd to the skeleton directory, then try and run nosetests.
I cannot seem to get any other result than “Ran 0 tests in 0.008s.”
I am really struggling to see where I went wrong. Is it the new version of python I am using?
Did I make a glaring mistake?
I just want to figure out what i have messed up so I can move forward in the book and start reading the second book. I’m a huge fan of this book and Zed. If I left anything out and this post needs more detail please let me know. I appreciate any feedback I can get.
I checked the init file names for tests/names and they both have the double underscore.
I am trying to run nosetests from skeleton where all the other directories are located.
I think the NAME_tests.py file is correct. Here is a screenshot of my code.
Nosetests is so frustrating. Looking at your code vs. mine it looks the same, and mine runs, so here’s where the code is:
The only thing I can see if you might have a stale __pycache__ directory in tests/ so try deleting that. Then see if you can get my code and see if there’s a difference that I’m not seeing.
Last thing, did you save your NAME_tests.py file? Sometimes that’s it. It’s in your editor and looks fine, but on the disk it’s empty. Try this:
So I tried all this and doesn’t seem like it wants to work. I made sure the NAME_tests.py file was saved, deleted those pycaches and made sure it wasn’t empty. Still getting that 0 tests ran message. I talked to a developer at my job and he went through the project with me and wasn’t able to determine what was wrong either so I am just going to try Pytest and move forward. Thanks for your help and suggestions!
Hello all, Hello Zed ,this is my first posting, too. I have tiried ex46 a few times , too. But I have the same trouble.I sure that i have checked all details. I have read this book by myself and overcomed all difficulties except ex46.
The only difference is my windows version .It is windows 7.
What should I do?
Hello all, Hello Zed ,this is my first posting, too. I have tiried ex46 a few times , too. But I have the same trouble.I sure that i have checked all details. I have read this book by myself and overcomed all difficulties except ex46.
The only difference is my windows version .It is windows 7.
What should I do?
Look up pytest?
I don’t know if you already solved this but just to add extra comments on the issue:
I had the same problem as everyone where I run nosetests and it always says 0 Tests run.
I tried several variations on how the files were created or how the files are structured and I’m not sure why, but it works in the following way:
If I run it outside the virtual enviroment it always works with Zed’s structure.
If I run it within the virtualenv it doesn’t work if I have the init.py file in the tests folder. If I remove it it works perfect within the virtualenv, but I am not sure why this happens.
Hey @martincormack, I’m curious about when you say “works within the virtualenv”.
Do you mean you do something like this:
cd .venvs/myproject
And then work inside the virtual environment? Or, do you just mean that you activate the virtual environment, but your code lives in a totally different directory?