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?

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
piscvau's avatar
611
piscvau
asked 1 year ago
Wingware Support's avatar
4.3k
Wingware Support
updated Jul 3

Comments

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.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Wingware Support's avatar
4.3k
Wingware Support
answered 1 year ago
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 (1 year ago)

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 (1 year ago)

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 (1 year ago)

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 (1 year ago)

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 (1 year ago)
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.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Wingware Support's avatar
4.3k
Wingware Support
answered Aug 16
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 (Aug 17)

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 (Aug 17)
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

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)