Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to run a single unit test in Django

I run my tests with command "python3 manage.py test" it works fine, but it run all tests. When I try to run test by pushing a button "Run Test"(green triangle) there is an error:

Error
ImportError: Failed to import test module: app_shop
Traceback (most recent call last):
  File "/usr/lib/python3.8/unittest/loader.py", line 154, in loadTestsFromName
    module = __import__(module_name)
ModuleNotFoundError: No module named 'djcaching.app_shop'

How can I solve this problem?

My structure:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

djcaching
  app_shop
    tests
  app_users
    tests
  djcaching
    settings

>Solution :

to run single unit test run below command:

manage.py test <appname>.tests.<Testcasename>

you can also check the official documentation of unit test here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading