This is my first project in Python and I have just learnt the unittest
framework. The test module runs well when I do python test_module.py
but when I want to execute a certain class or a method as said in the documentation using:
python -m unittest test_module.TestClass.test_method # or even just test_module
I get the following error:
AttributeError: 'module' object has no attribute 'test_module'
The directory where I run the command contains graphm_test.py
(I also tried to change the name to test_graphm.py
), with class graphm_test(unittest.TestCase):
and methods all starting with test_*
and here is the command I run on the terminal:
python -m unittest test_graphm.py
I could not find a similar problem to this anywhere, it would be great to know the reason behind the error and how to run a certain class inside the module or a certain method