Django 1.6.10 cannot find test modules located outside my apps when running any of these code (ref: https://docs.djangoproject.com/en/1.6/topics/testing/overview/#running-tests)
./manage.py test tests/app1/
./manage.py test tests/app1/test_views
I keep getting these errors
django.core.exceptions.ImproperlyConfigured: App with label tests/app1/ could not be found
django.core.exceptions.ImproperlyConfigured: App with label tests/app1/test_views could not be found
Here is my project structure:
- project
- app1
- __init__.py
- models.py
- views.py
- forms.py
- admins.py
- app2
- ..as per above
- tests
- __init__.py (blank)
- app1
- __init__.py (blank)
- test_views.py
- test_forms.py
- app2
- __init__.py (blank)
- test_views.py
- test_walkthrough.py
I read Django Discovery runner a few times and still cannot find out where did I go wrong. Any help please - what do I miss
Replacing / with . gives the same error however when execute
./manage.py test tests.app1.test_views.MyTestCase
./manage.py test tests.app1.test_views.MyTestCase.test_mymethod
I get ValueError.
ValueError: Test label 'tests.app1.test_views.MyTestCase.test_mymethod' should be of the form app.TestCase or app.TestCase.test_method
Further update: I finally got it to work when adding --testrunner='django.test.runner.DiscoverRunner' to the command line. As per Django doc, any of these patterns works now (using / is a way of providing a path to a directory to discover tests below that directory):.
./manage.py test --testrunner='django.test.runner.DiscoverRunner' tests.app1
./manage.py test --testrunner='django.test.runner.DiscoverRunner' tests.app1.test_views.MyTestCase
./manage.py test --testrunner='django.test.runner.DiscoverRunner' tests/app1/
Still do not know why I have to provide --testrunner value. I am using Mezzanine in my code too and have double confirmed that settings.TEST_RUNNER is pointing to django.test.runner.DiscoverRunner
Can anyone help explaining why do I need --testrunner flag in django 1.6? Thank you in advance.