Ask Your Question

django testing keeps adding 'unittest', fails to find some tests

asked 2019-12-04 08:14:05 -0500

pymike gravatar image

updated 2019-12-04 08:33:51 -0500

My Django unit tests are in 'tests' subdirectory under the project. There are two files in this subdirectory - and There is an in this subdirectory also. I can directly execute 'python 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 are executed. The tests in 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 test tests.test_auth" ?


edit retag flag offensive close merge delete


In the Testing tool in Wing, are you seeing 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?

Wingware Support gravatar image Wingware Support  ( 2019-12-04 08:35:53 -0500 )edit

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 in the Testing Tool (I see nothing there).


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.

pymike gravatar image pymike  ( 2019-12-04 09:07:24 -0500 )edit

The automated project setup process should add 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 on the command line.

Wingware Support gravatar image Wingware Support  ( 2019-12-04 09:13:35 -0500 )edit

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.

pymike gravatar image pymike  ( 2019-12-04 09:34:44 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-12-04 09:57:56 -0500

You want to select as the testing file. Testing > Add Single File should be showing a file open dialog. Is it showing something else? You could also open in the editor and then do Testing > Add Current File. You don't need to set any Test File Patterns in the project in this case since with Django there is just the one test file ( That's a way to add many files as test files at once for projects that use other testing frameworks.

You may also want to right click on, select Properties, and make sure that Test Framework under the Testing tab is showing Django. I think it should if you set that at the project level but worth checking.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2019-12-04 08:14:05 -0500

Seen: 538 times

Last updated: Dec 04 '19