{"id":14530,"library":"django-nose","title":"django-nose","description":"django-nose is a Django test runner that integrates the capabilities of the Nose testing framework into Django's test suite. It provides features like testing only specified apps, running specific test modules/classes/tests, simplifying test discovery by obviating the need for `tests/__init__.py`, and leveraging Nose's plugin ecosystem. Additionally, it offers optional performance enhancements such as fixture bundling, reuse of test databases, and hygienic TransactionTestCases. The library is currently in maintenance mode (version 1.4.7) and was last updated in 2020. For new projects, the maintainers recommend considering `pytest` or `unittest` with Django's native testing framework.","status":"maintenance","version":"1.4.7","language":"en","source_language":"en","source_url":"http://github.com/jazzband/django-nose","tags":["Django","testing","nose","test runner","maintenance"],"install":[{"cmd":"pip install django-nose","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core testing framework integrated by django-nose.","package":"nose","optional":false},{"reason":"Requires a Django project to integrate as a test runner. Supports Django up to 2.2.","package":"Django","optional":false}],"imports":[{"note":"The `django_nose.run_tests` runner was deprecated and removed for Django versions 1.2+; `NoseTestSuiteRunner` is the correct class-based runner.","wrong":"TEST_RUNNER = 'django_nose.run_tests'","symbol":"NoseTestSuiteRunner","correct":"TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'"}],"quickstart":{"code":"import os\n\n# settings.py\n\nINSTALLED_APPS = [\n    # ... other apps\n    'django_nose',\n    # ... your project apps\n]\n\nTEST_RUNNER = 'django_nose.NoseTestSuiteRunner'\n\n# Optional: Configure Nose arguments (example with coverage)\nNOSE_ARGS = [\n    '--with-coverage',\n    '--cover-package=your_app_name',\n    '--cover-html-dir=coverage_report'\n]\n\n# Run tests from your project root:\n# python manage.py test\n# Or with specific app:\n# python manage.py test your_app_name","lang":"python","description":"To quickly integrate `django-nose`, add `django_nose` to your `INSTALLED_APPS` and set `TEST_RUNNER` in your Django `settings.py` file. You can then run tests using `python manage.py test`. Additional Nose arguments can be specified via the `NOSE_ARGS` setting."},"warnings":[{"fix":"For new projects, consider `pytest` (e.g., `pytest-django`) or Django's `unittest` framework. For existing projects, evaluate migration or proceed with caution, acknowledging limited future support.","message":"The `nose` project, on which `django-nose` relies, has been in maintenance mode since at least 2015. `django-nose` itself is also in maintenance mode, and its maintainer is no longer an active user. New projects are strongly advised to use `pytest` or Django's built-in `unittest` framework instead.","severity":"deprecated","affected_versions":"All versions"},{"fix":"Upgrade Django and Python to supported versions (e.g., Django 2.2, Python 3.7) or pin `django-nose` to an older version compatible with your environment.","message":"Versions 1.4.4 and newer dropped support for Django 1.4-1.7 and Python 2.6. South support was also dropped in 1.4.4. Ensure your Django and Python versions are compatible with `django-nose` 1.4.7, which supports Django up to 2.2 and Python up to 3.7.","severity":"breaking","affected_versions":">=1.4.4"},{"fix":"Use `REUSE_DB=1` with extreme caution. Ensure your `TransactionTestCases` are 'hygienic' (clean up database changes). Always run tests without `REUSE_DB=1` after schema migrations to reinitialize the database.","message":"The `REUSE_DB=1` feature for reusing test databases has several open issues, including reports of data loss, and is not compatible with `TransactionTestCases` that do not clean up after themselves. It also requires manual disabling whenever your database schema changes to ensure reinitialization.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If experiencing failures with `--with-fixture-bundling`, consider disabling it or subclassing `django_nose.FastFixtureTestCase` only for tests that are confirmed to have no order dependencies. Ensure `setUp` and `tearDown` methods clear any non-database state.","message":"The `--with-fixture-bundling` option can cause test failures due to hidden order dependencies between tests or state leakage (e.g., locale activation, `memcached` contents) if not properly reset between tests. Post-save signal handlers creating additional data during fixture loading can also cause issues.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"For Django 1.4+ projects, remove the `__init__.py` file from the project's root directory. Ensure any Python files previously in the root are moved to an appropriate application or configuration directory.","cause":"When upgrading Django projects from <=1.3 to >=1.4, if a `__init__.py` file exists in the project's root directory (making it a Python package), `django-nose` might incorrectly try to load URL configurations from `my_project.my_project.urls`.","error":"ImportError: No module named urls"},{"fix":"Avoid importing models or admin classes directly within `__init__.py` files. Instead, import them within the `ready()` method of your `AppConfig` (e.g., `from django.apps import AppConfig; class WorldConfig(AppConfig): name = 'world'; def ready(self): from .admin import countries`). Alternatively, ensure explicit `app_label` is set for models not within an `INSTALLED_APPS` defined application structure.","cause":"This error, or an `AlreadyRegistered` exception, can occur if models or admin classes are imported directly in an app's `__init__.py` file, confusing Django's test runner during app loading.","error":"RuntimeError: Model class app.world.models.country.Country doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS"},{"fix":"Explicitly define a `TEST_NAME` in your database settings to use a file-based SQLite database for testing instead of an in-memory one. For example: `DATABASES = {'default': {'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3', 'TEST': {'NAME': BASE_DIR / 'test_sqlite.db'}}}`.","cause":"When using SQLite3 for testing, especially with plugins like `django-nose-selenium` (which builds on `django-nose`), the default in-memory SQLite database can lead to these errors because it's not persistent across certain test processes.","error":"DatabaseError: no such table: django_site (or similar 'no such table' errors)"}],"ecosystem":"pypi"}