Nose and django-nose not finding the right tests cases

162 views
Skip to first unread message

Berk Birand

unread,
Aug 8, 2013, 1:04:02 PM8/8/13
to nose-...@googlegroups.com
Hi,

I've been trying to fix this issue for several hours now, and I think it would be best if I asked for help. I'm setting up a directory structure for my Django app to separate functional and unit tests.

At the root of the project, I have a folder called "tests" that has this structure:

tests
├── __init__.py
├── functional
│   ├── __init__.py
└── unit
    ├── __init__.py
    ├── data.py
    ├── tests.py


If I want to run just the unit tests, should I not be able to use:
$ nosetests tests.unit

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK

However, when I run:
$ nosetests tests/unit/
E
# .. Expected errors because project settings are not initialized
-----------------
Ran 1 test in 0.001s

FAILED (errors=1)

What am I missing? I also have a setup function in tests.unit.__init__.py that's not getting called.

Thanks,
 bB

Andres Riancho

unread,
Aug 8, 2013, 2:38:52 PM8/8/13
to nose-users
When in a django project using django-nose, you need to use: python
manage.py test
Not doing so will end up with that Expected errors because project
settings are not initialized message.
> --
> You received this message because you are subscribed to the Google Groups
> "nose-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nose-users+...@googlegroups.com.
> To post to this group, send email to nose-...@googlegroups.com.
> Visit this group at http://groups.google.com/group/nose-users.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
Andrés Riancho
Project Leader at w3af - http://w3af.org/
Web Application Attack and Audit Framework
Twitter: @w3af
GPG: 0x93C344F3

Berk Birand

unread,
Aug 9, 2013, 1:04:26 AM8/9/13
to nose-...@googlegroups.com
Thanks for your reply! Yes, what I meant by "Expected" errors is that I was expecting them due to the absence of loaded settings. My question how to get the nosetest test runner to discover the tests when I run it by calling it as a module. So the example in which I *don't* get the Expected error is the question.
Reply all
Reply to author
Forward
0 new messages