django-nose

Nose doesn't find Django tests

守給你的承諾、 提交于 2020-01-03 07:06:24
问题 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 go on: I know there are a ton of similar questions on Stackoverflow, like for instance this one: How do I tell Django-nose where my tests are? But after Googling around, reading blog posts and StackOverflow answers I still couldn't get it running.

Nose doesn't find Django tests

半城伤御伤魂 提交于 2020-01-03 07:06:08
问题 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 go on: I know there are a ton of similar questions on Stackoverflow, like for instance this one: How do I tell Django-nose where my tests are? But after Googling around, reading blog posts and StackOverflow answers I still couldn't get it running.

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

放肆的年华 提交于 2019-12-29 11:45:42
问题 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 remotely close to test driven development (maybe my expectations are too high), so I want to see if I can fix this once and for all. When a run a test, there is a 70 to 80sec delay between the start and the actual beginning of the test. For example, if I

Django test coverage vs code coverage

人走茶凉 提交于 2019-12-20 10:33:28
问题 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 code. My only question is -- what now? What I'm envisioning is being able to import all the python modules and "settle down" before executing any tests, and directly communicating with coverage saying "Ok, start counting reached code here." Ideally

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

社会主义新天地 提交于 2019-12-18 04:28:07
问题 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, django-nose doesn't appear to support anything beyond testing a specific app. How do I replicate the last two behaviors? 回答1: Nose supports the following syntax (note : between test script name and test class name): ./manage.py test myapp.tests.test_script

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

风流意气都作罢 提交于 2019-12-13 12:56:50
问题 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 = 'django_nose.NoseTestSuiteRunner' for django-nose and: TEST_RUNNER = 'djcelery.contrib.test_runner.CeleryTestSuiteRunner' for django-celery. How should I handle this so that I can use both packages? 回答1: I found that the best way to handle this is to skip the Celery test

Django (nose) test speeding up with reuse_db not working

荒凉一梦 提交于 2019-12-12 12:17:50
问题 I am using django-nose to run my unit tests in django (1.4). TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' Creating the database takes a long time. So I found out putting this in settings.py: os.environ['REUSE_DB'] = "1" should do the trick. actually django itsellve gives this suggestion: To reuse old database "<path not very interesting>/var/sqlite/unittest.db" for speed, set env var REUSE_DB=1. of course you need to run it once (or after every database change) with this flag =0 However,

python - Nose not discovering package level tests in Django

拟墨画扇 提交于 2019-12-11 01:45:52
问题 I'm setting up a directory structure for my Django app to separate functional and unit tests. I am using nose as the test runner for my Django project. At the root of the Django 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 the following from the project root: $ nosetests tests.unit -----------------------

How to get django-nose installed correctly?

亡梦爱人 提交于 2019-12-10 13:13:50
问题 I'm having trouble getting django-nose running. Per the installation instructions, I installed by: Running pip install django-nose Adding 'django_nose' to INSTALLED_APPS in settings.py (including at as the very last app, in case of possible app order issues) Adding TEST_RUNNER = 'django_nose.NoseTestSuiteRunner' to settings.py When I run a test i.e. manage.py test , I get: django.db.utils.DatabaseError: no such table: django_content_type I figured I need to sync the database. I am using South

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

孤街浪徒 提交于 2019-12-04 08:07:35
问题 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 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 I installed django-nose. When I try to run the tests with django-nose, 0