Skip to content
This repository has been archived by the owner on Jan 20, 2019. It is now read-only.

Some syntax doesn't work when running a single test class or a single test #13

Open
aaronlelevier opened this issue Oct 11, 2017 · 1 comment

Comments

@aaronlelevier
Copy link

The following examples are with nose in Django. With the nose test runner, usually all 3 examples below work, but with this package, only one of them works. I'd like to continue to use this package because I like the idea, but the inability to run single tests (as far as I know, correct me if I'm wrong) is a current limitation of this package. Also, it only accepts 1 type of below syntax for running a test class.

This works:

# run a test class with "nose
./manage.py test location.tests.test_views:LocationLevelTests

These do not work:

# run a test class with "nose
./manage.py test location.tests.test_views.LocationLevelTests

# run a single test with "nose"
./manage.py test location.tests.test_views:LocationLevelTests.test_create__name_unique_by_tenant

They result in the following error:

======================================================================
ERROR: Failure: ModuleNotFoundError (No module named 'LocationLevelTests')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/alelevier/Documents/bsrs/bsrs-django/venv/lib/python3.6/site-packages/nose/failure.py", line 39, in runTest
    raise self.exc_val.with_traceback(self.tb)
  File "/Users/alelevier/Documents/bsrs/bsrs-django/venv/lib/python3.6/site-packages/nose/loader.py", line 552, in _makeTest
    return self.suiteClass(plug_tests)
  File "/Users/alelevier/Documents/bsrs/bsrs-django/venv/lib/python3.6/site-packages/nose/suite.py", line 425, in __call__
    context = self.findContext(tests)
  File "/Users/alelevier/Documents/bsrs/bsrs-django/venv/lib/python3.6/site-packages/nose/suite.py", line 463, in findContext
    ctx = getattr(test, 'context', None)
  File "/Users/alelevier/Documents/bsrs/bsrs-django/venv/lib/python3.6/site-packages/nose/case.py", line 101, in _context
    return self.test.context
  File "/Users/alelevier/Documents/bsrs/bsrs-django/venv/lib/python3.6/site-packages/nose/case.py", line 257, in _context
    return resolve_name(self.test.__module__)
  File "/Users/alelevier/Documents/bsrs/bsrs-django/venv/lib/python3.6/site-packages/nose/util.py", line 312, in resolve_name
    module = __import__('.'.join(parts_copy))
ModuleNotFoundError: No module named 'LocationLevelTests'
@nloadholtes
Copy link
Owner

Thanks bringing this up, I will look into it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants