pythondjangowebtestdjango-webtest

Executing a single test case with django_webtest


In my config/advertiser/tests/test_advertiser_web.py:

from django_webtest import WebTest
...
class AdvertiserView(WebTest):
...
    def test_add_note(self):
...

I'd like to just run the test_add_note case. Is that possible? I can't seem to figure out how to run either the individual test case or just that file.

./manage.py test config.advertiser.tests.AdvertiserView
AttributeError: 'module' object has no attribute 'AdvertiserView'

./manage.py test config/advertiser/tests/test_advertiser_web.py
ImportError: Start directory is not importable: 'config/advertiser/tests/test_advertiser_web.py'

Running the whole dir seems to work just fine:

./manage.py test config/advertiser/tests/
Creating test database....

Solution

  • You forgot to add module name between tests and AdvertiserView:

    ./manage.py test config.advertiser.tests.test_advertiser_web.AdvertiserView