I’m trying to not only use Django but also understand the code of the framework. Usually, when I’m with a codebase that I don’t know, I run the tests, change things to see what happen and put a breakpoint and inspect the variables, … I use Pycharm to do that. But one problem I have with the Django code is that I don’t know how to configure Pycharm to run the tests.
I suppose the problem is related to the fact that Django tests are run through the script
runtests.py . Has anyone run the Django tests with Pycharm? I’m mean to run the tests of the Django framework itself, I’m able to run the tests of projects that use Django without a problem.
If you are using the paid for version of Pycharm, then you can use it’s Django functionality to create run configurations.
Here is an example of mine whereby I’m specifically testing a single app, in my case,
If you’re using the community edition, then you can create a regular Python run configuration. Here is one that I just tested successfully. Do note that I am running this in Docker, hence my Python interpreter looks a bit funny. I can’t see why it wouldn’t work with a local Python interpreter.
If you want to test only a single app, then you can include the apps test as an argument like this:
python manage.py test my_app.tests
In this instance your app is called
my_app and within your app you have a file called
Thanks for the response but I think I expressed myself wrong. I can run tests with Pycharm for a project y create using Django (where I add apps, models, …). But I can not configure Pycharm to run the tests of the Django project, for example, these https://github.com/django/django/blob/master/tests/asgi/tests.py
My purpose is to debug the tests, change the code to see what happens …