Summary: After moving a file with a TestCase class in it (using refactor), tests are no longer executed at all.
I have a class startupTests.py that has:
import unittest
import logging
logging.basicConfig(level=logging.ERROR)
if __name__ == '__main__':
unittest.main()
in it. I have a testcase class on the same level with multiple test. In the past I could simply run this startupTests.py class to execute all tests (including tests in other files on the same level). Here is another example file test_example.py with tests that were executed when I called startupTests.py
from unittest import TestCase
class TestValidateConfiguration(TestCase):
def test_example(self):
self.assertTrue(True)
I knew that I would write quite a few tests, so I decided to move test_example.py into another folder. I noticed that this somehow broke the connection between startupTests.py and test_example.py. The TestCases in startupTests.py were no longer executed when running startupTest.py
I can still execute the tests in test_example.py using the green arrow next to the code in the GUI. But they are no longer executed when running startupTests.py. I would like to - again - execute all tests in all test_files when running my main in startupTests.py
What I have tried
- I moved the file back into the same folder, but still they are not executed. Therefore it is not the "you need an init.py file to discover" problem.
- I created a second file with a TestCase, in order to see if the connection was just broken to the old file. Tests in the new file are also not executed.
- I explicitly set PythonIntegratedTools>Testing>Default test runner to Unittests
- I looked for visual changes in the code, but found none.