So i am facing a problem with nosetests, it shows that there was 0 tests ran and there should be 3.
my directory is exactly the way it should be, and both ex47_tests and game .py files are written with 0 errors. I’m not sure what other information might be needed to resolve the issue, so ask if you need to know something else!
are the init.py files supposed to be empty, or am i missing something?
also, visual studio code does not detect any problems (except for unused imports, if i change from nose.tools import * -> from nose.tools import assert_equal those “warnings” dissappear, but wont make a difference in nosetests results)
Did pytest also not run any tests or did it report any errors?
Dumb question: You are running the test from the root folder, not from the tests folder, right?
I think we won’t be able to help any further without seeing the files and the folder structure.
I have a strong feeling it doesn’t work because of something i might have done wrong during ex46, at first i got some error message in text editor for assert_equal, but i installed nose again and that seemed to fix things (tests i ran back then did not report any errors, outcome was the same as it is in the screenshot i attached here).
Since i am very very new to programming, i dont really know that much of it except for lpthw and lsthw (i did pick up some reading on programming, since i really dont learn things by memory, but through understanding) i did try to change import nose.tests → import pytest, and i tried running pytest with commands pytest and py.test, none of those actions made a difference in results.
You can’t use the assert functions from nose.tools with Pytest. Get rid of the nose import and transform every call to assert_equal to a plain assert statement, e.g. assert_equal(gold.name, "GoldRoom") becomes assert gold.name == "GoldRoom".
Pytest doesn’t recognize the filename suffix _tests. Rename the test file to either ex47_test.py or test_ex47.py.
Let me know if this helps!
I recommend that you read up a bit on Pytest here and particularly about the test discovery rules here.
I get “Missing expression after ‘.’ in the element of the pipeline.”
By the way I solved the “script not on PATH” problems reinstalling python via the python.org installer.
Installing Python directly via the Windows app store had caused problems because all the new packages I had installed were not on PATH. I had used “python setup.py install” command to make nose work.
Only remaining problem now being that I can run tests by placing the test file above “tests” folder.
Thanks Zed for all the advice.
I really appreciate.