django testing keeps adding 'unittest', fails to find some tests
My Django unit tests are in 'tests' subdirectory under the project. There are two files in this subdirectory - tests.py and test_auth.py. There is an __init__.py in this subdirectory also. I can directly execute 'python manage.py test tests' just fine.
I have configured Project -> Testing for 'Django Tests'. I have tried with and without 'Test file patterns' set with a glob to the testing subdirectory.
In all cases when I 'Run Tests' the tests in tests.py are executed. The tests in test_auth.py are not executed. In addition there is an error shown "ImportError: Failed to import test module: tests.test_auth".
My configuration seems pretty straightforward, are there any examples how to get this to work? For example, how to configure the equivalent of " $ python manage.py test tests.test_auth" ?
Thanks.
Comments
In the Testing tool in Wing, are you seeing manage.py or something else? Also, did you use Project > Extensions > Configure Project for Django or Start Django Project or did you set up the project entirely manually?
The project is configured for Django, I can execute the app inside WingIDE (Debug I/O below). Its just the testing that doesnt work. I dont see manage.py in the Testing Tool (I see nothing there).
Thanks!
INFO 2019-12-04 15:05:39,192 autoreload 63773 4452783552 Watching for file changes with StatReloader INFO 2019-12-04 15:05:39,192 autoreload 63773 4452783552 Watching for file changes with StatReloader Performing system checks...
System check identified no issues (0 silenced). December 04, 2019 - 15:05:39 Django version 2.2.2, using settings 'cfgsvc.settings' Starting development server at <body>link awaiting moderation</body> Quit the server with CONTROL-C.
The automated project setup process should add manage.py as a testing file. You can do this manually with the Testing > Add Single File or Add Current File menu item. Once that's done and it's showing up in the Testing too, click on it and press Run Tests. This should run all the tests that would be run from manage.py on the command line.
What exactly do i type in the 'Add Single File'? Should I also enter something in Testing -> Test file patterns? I have a tests subdirectory off the project directory, there are two python files in that subdirectory. Thanks.