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 -0600
Wingware Support's avatar
4.2k
Wingware Support
updated 2024-07-03 08:51:58 -0600
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

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.2k
Wingware Support
answered 2024-06-03 11:45:49 -0600
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 -0600) 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 -0600) 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 -0600) 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 -0600) 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 -0600) edit
add a comment see more comments
0

I think at the moment (Wing 10.0.5) the only answer 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. I'm leaving the other earlier answer in case it's useful at some point, but I think the idea of having other copies of manage.py won't work because of how the Django test runner for Wing is currently designed.

Wingware Support's avatar
4.2k
Wingware Support
answered 2024-08-16 08:27:57 -0600
edit flag offensive 0 remove flag delete link

Comments

Hello I do not understand your statement. I have several applications in the same project and have not encountered difficulties as long as they are coherent with the standard file hierarchy structure.

piscvau's avatar piscvau (2024-08-17 02:53:51 -0600) edit

I'm continuing this discussion via email since it's too confusing to have it half here and half on email. I should note, though, that Wing 10.0.4.4 fixed a problem with running Django tests when setting initial directory in Project Properties, which may be part of the issue that led to this ticket. I'll update this if/when there is more information that might help others.

Wingware Support's avatar Wingware Support (2024-08-17 08:19:34 -0600) 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