-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Added support for Django unittests #20675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
to set `DJANGO_SETTINGS_MODULE` and call `django.setup()` so to be able to execute django unittests as well
@microsoft-github-policy-service agree |
Thanks for the PR. We are investigating what is minimally needed to get this working, and how to expose that to user in a way that it does not interfere with other scenarios. We will consider the approach taken here. |
I have another Idea, when I click the test button on the side menu in vacode, for the first time it will ask to set a python unittest or pytest and so on, also some dropdown menus are there to select more options in order to initiate the test environment. it would be very helpful and more reliable if such an option be available for |
Hello @mh-firouzjah, thank you for this PR. Could you just explain with this PR what outcome you get for the testing interface? For example, once this is run is it possible for the support we already have in the extension for unittest to work and find/run the django tesets? Does this populate the text explorer or handle run tests? I am not as familiar with the |
hello @eleanorjboyd normally your extension as it's current state is not aware about django. it could not recognize if a test is subclass of TestCase and it will not setup django, so in a workspace of a django project it would not see(locate/recognize,...) all (django) tests and of it does see a test it can not run that test because neither DJANGO_SETTINGS_MODULE is not set and django.setup is not called. if you don't want to added this piece of code. it would be an alternative way to ask the user if it's a django project and if it is, where is the settings file located. |
Hello! I am going to go ahead and close this PR. We are just now finishing up our testing rewrite and therefore our testing infrastructure looks different. Although we can't take this fix as is we look forward to working together to get django support working in vscode! |
it would check to see if there is a
manage.py
in the root folder and then checks inside that file to see if it is generated by django and also checks ifast.literal_eval
has no exception due to execution of the line which would setDJANGO_SETTINGS_MODULE
and then calldjango.setup
to load all django apps and prepare to run the tests.