-
-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I tell django-nose where my tests are? #34
Comments
Do you have an |
Yes I do. All directories in my project have an |
Interestingly the following line works. I don't know why this works and the other command doesn't. I guess this is sufficient though. There's nothing you can do by specifying the module path that you cannot do by specifying the directory path right? |
nose behaves a bit diferent than Django. It doesn't know about INSTALLED_APPS, it just knows about the python import path. If it's possible for you to do |
We work with hekevintran together, and this command still doesn't work:
although there are |
@jbalogh is this still the case?
|
Has this been resolved? This is an issue for a coworker (but not me). The only way he can execute tests is via:
or
When we turn on -v, it doesn't find any other tests (in fact, it executes none). @culebron, did you guys ever find a solution for this problem? Thanks |
For anyone else who was trying to figure out how to do this, this is what I came up with. You can create a new python file, import the NoseTestSuiteRunner and any other django apps you need. You can also subclass the NoseTestSuiteRunner and provide a default list of apps to test when you run bin/django test. You could also set the import path here if needed. In the example below running bin/django test is equivalent to running bin/django test my_django_app Hope this helps. from django_nose import NoseTestSuiteRunner
from some.path import my_django_app
class MyNoseTestSuiteRunner(NoseTestSuiteRunner):
def run_tests(self, test_labels, *args, **kwargs):
"""
Django nose does not allow us to specify a default app to test, so
we can subclass to tell django nose to run the specified app if we
do not specifically provide one on the command line.
"""
if len(test_labels) == 0:
test_labels = ('my_django_app',)
return super(NoseTestSuiteRunner, self).run_tests(test_labels, *args,
**kwargs) |
I would love if somebody could post a reduction of this—a teeny example project where django_nose doesn't find stuff. Sounds like something I'd like to fix (or at least make less surprising). |
I had a similar issue. The django nose runner was not finding tests unless given the full path to the tests in just one directory (valid python package). Running tests -v3, I noticed the following: nose.selector: INFO: /home/path/to/tests.py is executable; skipped When I changed the file permissions on those tests everything worked fine. Hope that helps someone. |
It is worth trying setting the environment variable NOSE_INCLUDE_EXE to a non-empty string. While (at least currently) this is set by default on win32 and cli, and on *nix systems the tests.py file should get made without execute permissions, it is possible that if a site were created on a Windows box and copied to something else, you could wind up with the execute bits set (I've seen that - don't remember the details). Setting execute permissions on tests.py on a linux system certainly prevents the test from running, and using: export NOSE_INCLUDE_EXE=1 makes it run again. If the OP is still having the problem, could he please try this? |
Thanks everyone |
Yes! This is what I was looking for! I run Ubuntu but the disk partition I'm working on is shared with Windows (NTFS), so al files are 'executable' (so as to say). Thank you very much for the help. |
This worked for me also by placing it in settings, thanks! I'm using Ubuntu. |
This could be turned into a documentation hint. |
I have been looking all over the internets on how to fix this! |
Fun story, we use Docker across window and linux and mac, our test suite worked on Mac and Linux but not windows... in the same linux docker container... BLAH. @ke1g saved the day. Adding that fixes everything for the windows user. |
I have my tests for a Django application in a tests directory:
The Django test runner requires that I put a suite() function in the
__init__.py
file of my application's tests directory. That function returns the test cases that will run when I do$ python manage.py test my_app
I installed django-nose. When I try to run the tests with django-nose, 0 tests are run:
$ python manage.py test my_app
If I point directly at the test module, the tests are run:
$ python manage.py test my_project.apps.my_app.tests.storage_tests
Why does django-nose's test runner not find my tests? What must I do?
The text was updated successfully, but these errors were encountered: