Questions tagged [django-nose]

Django test runner that uses nose.

django-nose is a Django test runner that uses nose.

It extends Django's built-in test command allowing to use all nose features and introduces more.

81 questions
60
votes
6 answers

Django Unit Testing taking a very long time to create test database

For some time now, my unit testing has been taking a longer than expected time. I have tried to debug it a couple of times without much success, as the delays are before my tests even begin to run. This has affected my ability to do anything…
dkarchmer
  • 5,434
  • 4
  • 24
  • 37
37
votes
2 answers

How to run a single test or single TestCase with django-nose?

With Django's normal test runner, you can drill down to run tests in a specific app, a specific subclass of TestCase, or a specific test within a specific subclass of TestCase. E.g.: ./manage.py test myapp.MyTestCase.test_something However,…
GDorn
  • 8,511
  • 6
  • 38
  • 37
36
votes
4 answers

Django test coverage vs code coverage

I've successfully installed and configured django-nose with coverage Problem is that if I just run coverage for ./manage.py shell and exit out of that shell - it shows me 37% code coverage. I fully understand that executed code doesn't mean tested…
Mikhail
  • 8,692
  • 8
  • 56
  • 82
17
votes
5 answers

How to test coverage properly with Django + Nose

Currently have a project configured to run coverage via Django's manage command like so: ./manage.py test --with-coverage --cover-package=notify --cover-branches --cover-inclusive --cover-erase This results in a report like the following: Name …
kaptainlange
  • 245
  • 3
  • 8
15
votes
5 answers

How do I tell django-nose where my tests are?

I have my tests for a Django application in a tests directory: my_project/apps/my_app/ ├── __init__.py ├── tests │ ├── __init__.py │ ├── field_tests.py │ └── storage_tests.py ├── urls.py ├── utils.py └── views.py The Django test runner…
hekevintran
  • 22,822
  • 32
  • 111
  • 180
15
votes
2 answers

Django ORM - mock values().filter() chain

I am trying to mock a chained call on the Djangos model.Manager() class. For now I want to mock the values() and filter() method. To test that I created a little test project: Create a virtual environment Run pip install django mock mock-django…
Jens
  • 20,533
  • 11
  • 60
  • 86
14
votes
2 answers

Nose doesn't find Django tests

I am trying to use Django-nose in my current project, but I can't figure out how to get nose to run my tests. So I started a simple Django 1.4.1 project to get to know nose. But not even on this simple test project I could get it running. Before I…
Jens
  • 20,533
  • 11
  • 60
  • 86
11
votes
1 answer

Django override_settings won't work for running multiple tests

I am getting a bit odd behavior using the override_settings decorator. It basically works when I run the test alone, but won't work if I run the whole testing suite. In this test I am changing the REST_FRAMEWORK options, because when running this…
9
votes
2 answers

Run Django tests with nosetests

My python apps testing is performed on the remote server with command nosetests. I cannot modify the way tests are started nor can I add options to it. I have Django app with tests, but tests are not working properly. My project…
miloserdow
  • 1,051
  • 1
  • 7
  • 27
9
votes
2 answers

How do I disable django migration debug logging?

Very similar to lafagundes question about south migration debug logging, except I'm not using south - I'm using plain Django 1.7 migrations. I'm also using django-nose test runner. When I run manage.py test, there is no debug logging output…
groovecoder
  • 1,551
  • 1
  • 17
  • 27
9
votes
3 answers

Using django-nose and django-celery together -- unit testing

I have a django project that used django-nose. I'd like to add django-celery to the project. I use unit tests. Both django-nose and django-celery need a TEST_RUNNER setting in my settings.py file. Specifically: TEST_RUNNER =…
Erik
  • 7,479
  • 8
  • 62
  • 99
8
votes
0 answers

Django nose coverage vs manage.py test gives differing CLI order-dependent results

I am running simple nose tests on a Django website (code available here). Depending on the order that the CLI commands are issued, I get vastly different results! Looking at many posts, it seems related to when coverage started with respect to the…
ChrisFreeman
  • 5,831
  • 4
  • 20
  • 32
8
votes
0 answers

Mock class not being injected when running all django-nose tests together

I'm running into a strange problem that seems to come about from how python unit tests manage their imports and how this relates to the mock package. This is for a django project, using django-nose/nose for unit test running and mock for mocking. I…
8
votes
2 answers

Django-nose not creating test-only models during test runs

I have django-nose 1.0 installed as the test runner for a Django 1.3.1 project. I'm following the instructions on the pypi page regarding test-only models. Here is my settings.py testrunner config: TEST_RUNNER =…
Jay
  • 291
  • 1
  • 2
  • 6
6
votes
2 answers

Code reusability in unit tests?

I keep hearing people say about how tests should be simple, maintainable, straightforward, but what happens with code re-usability in unit testing? Let's take for example: def test_some_1(): ...some code def test_some_2(): ...code repeated…
andreihondrari
  • 5,743
  • 5
  • 30
  • 59
1
2 3 4 5 6