First time here? Check out the FAQ!
1

Difficulties with django tests

I have a very very hard time using Wing testing tool to run django tests. My django project has several apps and only one manage.py file. The different applications are not entirely independant. Sometimes I need to run tests only for one application and somtimes I need to run test for all applications. According to the wing documentation, parameters to the run tests command should be entered as file properties for manage.py. This means I have to change the file properties of the manage.py file each time I want to test only one application. This is very cumbersome and unpractical. Is there any other solution?

piscvau's avatar
526
piscvau
asked 2024-06-02 14:36:02 -0500
Wingware Support's avatar
4.1k
Wingware Support
updated 2024-07-03 08:51:58 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

One idea is to have separate Wing projects for each app. You can easily switch from the Project > Recent menu and it makes some sense to separate those.

Alternatively, you could possibly make multiple copies of manage.py and add those to the Testing tool, each with properties set for the one app.

Wingware Support's avatar
4.1k
Wingware Support
answered 2024-06-03 11:45:49 -0500
edit flag offensive 0 remove flag delete link

Comments

May be I missed something but I do not see how I could have multiple copies of manage.py in the same directory. They would have to be renamed and I do not understand how this would work. Wing documentation does say that the file must be named manage.py

piscvau's avatar piscvau (2024-06-03 13:01:55 -0500) edit

The complete solution seems to create manage2.py file with a different name and create a named entry point for this manage2.py file.

piscvau's avatar piscvau (2024-06-04 05:38:15 -0500) edit

Yes, that's what I meant. Is that working for you? You may not need a named entry point if you just set its file properties, and that's needed in any case for the Testing tool to handle it right.

Wingware Support's avatar Wingware Support (2024-06-04 09:17:06 -0500) edit

Yes it does work with a named entry point . This allows to debug a subset of tests from the debug named entry point menu. However these tests do no run within the testing tool. These tests must be unittest.TestCase because they use the schema_editor. in the testing tool, it shows output no test run.

I really wish the handling of the django tests by the wing testing tool be clarified in the wing documentation.

piscvau's avatar piscvau (2024-06-05 00:25:32 -0500) edit

I wasn't talking about running manage2.py in the debugger using a named entry point. That certainly would work but doesn't address the issue of running the tests in the Testing tool. Can you please try using Testing > Add Current File menu item to add manage2.py to the Testing tool, then right-click on the manage2.py editor, select the Testing tab and choose Django Tests for the Test Framework, then select any other environment needed also under the Testing tab, and submit the dialog with OK. Then click on manage2.py in the Testing tool and press the Run or Debug Button... this should work to run or debug the tests using the Django test framework.

All that said, if your tests are not run by manage.py then this isn't the right approach and you would instead add the specific test files to the Testing tool and set their Test Framework to ... (more)

Wingware Support's avatar Wingware Support (2024-06-05 06:31:12 -0500) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer