Django test runner using nose

jazzband, updated 🕥 2022-12-26 20:29:09

=========== django-nose ===========

.. image:: https://img.shields.io/pypi/v/django-nose.svg :alt: The PyPI package :target: https://pypi.python.org/pypi/django-nose

.. image:: https://github.com/jazzband/django-nose/workflows/Test/badge.svg :target: https://github.com/jazzband/django-nose/actions :alt: GitHub Actions

.. image:: https://codecov.io/gh/jazzband/django-nose/branch/master/graph/badge.svg :alt: Coverage :target: https://codecov.io/gh/jazzband/django-nose

.. image:: https://jazzband.co/static/img/badge.svg :alt: Jazzband :target: https://jazzband.co/

.. Omit badges from docs

django-nose provides all the goodness of nose_ in your Django tests, like:

  • Testing just your apps by default, not all the standard ones that happen to be in INSTALLED_APPS
  • Running the tests in one or more specific modules (or apps, or classes, or folders, or just running a specific test)
  • Obviating the need to import all your tests into tests/__init__.py. This not only saves busy-work but also eliminates the possibility of accidentally shadowing test classes.
  • Taking advantage of all the useful nose plugins_

.. _nose: https://nose.readthedocs.io/en/latest/ .. _nose plugins: http://nose-plugins.jottit.com/

It also provides:

  • Fixture bundling, an optional feature which speeds up your fixture-based tests by a factor of 4
  • Reuse of previously created test DBs, cutting 10 seconds off startup time
  • Hygienic TransactionTestCases, which can save you a DB flush per test
  • Support for various databases. Tested with MySQL, PostgreSQL, and SQLite. Others should work as well.

django-nose requires nose 1.2.1 or later, and the latest release is recommended. It follows the Django's support policy, supporting:

  • Django 1.8 (LTS) with Python 3.5
  • Django 1.9 with Python 3.5
  • Django 1.10 with Python 3.5
  • Django 1.11 (LTS) with Python 3.5 or 3.6
  • Django 2.0 with Python 3.5, 3.6, or 3.7
  • Django 2.1 with Python 3.5, 3.6, or 3.7
  • Django 2.2 with Python 3.5, 3.6, or 3.7

.. _latest release: https://pypi.python.org/pypi/nose .. _Django's support policy: https://docs.djangoproject.com/en/1.8/internals/release-process/#supported-versions

Note to users

nose has been in maintenance mode since at least 2015. django-nose is in maintenance mode as well, and the sole maintainer is no longer an active user. See Jazzband.co to learn how django-nose is maintained and how you can help. New projects should consider using pytest, or unittest with the Django testing framework_.

.. _Jazzband.co: https://jazzband.co .. _pytest: https://docs.pytest.org/en/stable/ .. _unittest: https://docs.python.org/3/library/unittest.html .. _Django testing framework: https://docs.djangoproject.com/en/3.1/topics/testing/

Installation

You can get django-nose from PyPI with... :

.. code-block:: shell

$ pip install django-nose

The development version can be installed with... :

.. code-block:: shell

$ pip install -e git://github.com/jazzband/django-nose.git#egg=django-nose

Since django-nose extends Django's built-in test command, you should add it to your INSTALLED_APPS in settings.py:

.. code-block:: python

INSTALLED_APPS = (
    ...
    'django_nose',
    ...
)

Then set TEST_RUNNER in settings.py:

.. code-block:: python

TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'

Development

:Code: https://github.com/jazzband/django-nose :Issues: https://github.com/jazzband/django-nose/issues?state=open :Docs: https://django-nose.readthedocs.io

Issues

Bump wheel from 0.29.0 to 0.38.1

opened on 2022-12-26 20:29:08 by dependabot[bot]

Bumps wheel from 0.29.0 to 0.38.1.

Changelog

Sourced from wheel's changelog.

Release Notes

UNRELEASED

  • Updated vendored packaging to 22.0

0.38.4 (2022-11-09)

  • Fixed PKG-INFO conversion in bdist_wheel mangling UTF-8 header values in METADATA (PR by Anderson Bravalheri)

0.38.3 (2022-11-08)

  • Fixed install failure when used with --no-binary, reported on Ubuntu 20.04, by removing setup_requires from setup.cfg

0.38.2 (2022-11-05)

  • Fixed regression introduced in v0.38.1 which broke parsing of wheel file names with multiple platform tags

0.38.1 (2022-11-04)

  • Removed install dependency on setuptools
  • The future-proof fix in 0.36.0 for converting PyPy's SOABI into a abi tag was faulty. Fixed so that future changes in the SOABI will not change the tag.

0.38.0 (2022-10-21)

  • Dropped support for Python < 3.7
  • Updated vendored packaging to 21.3
  • Replaced all uses of distutils with setuptools
  • The handling of license_files (including glob patterns and default values) is now delegated to setuptools>=57.0.0 (#466). The package dependencies were updated to reflect this change.
  • Fixed potential DoS attack via the WHEEL_INFO_RE regular expression
  • Fixed ValueError: ZIP does not support timestamps before 1980 when using SOURCE_DATE_EPOCH=0 or when on-disk timestamps are earlier than 1980-01-01. Such timestamps are now changed to the minimum value before packaging.

0.37.1 (2021-12-22)

  • Fixed wheel pack duplicating the WHEEL contents when the build number has changed (#415)
  • Fixed parsing of file names containing commas in RECORD (PR by Hood Chatham)

0.37.0 (2021-08-09)

  • Added official Python 3.10 support
  • Updated vendored packaging library to v20.9

... (truncated)

Commits
  • 6f1608d Created a new release
  • cf8f5ef Moved news item from PR #484 to its proper place
  • 9ec2016 Removed install dependency on setuptools (#483)
  • 747e1f6 Fixed PyPy SOABI parsing (#484)
  • 7627548 [pre-commit.ci] pre-commit autoupdate (#480)
  • 7b9e8e1 Test on Python 3.11 final
  • a04dfef Updated the pypi-publish action
  • 94bb62c Fixed docs not building due to code style changes
  • d635664 Updated the codecov action to the latest version
  • fcb94cd Updated version to match the release
  • Additional commits viewable in compare view


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/jazzband/django-nose/network/alerts).

Maintainers Needed

opened on 2022-11-18 16:40:57 by jwhitlock

This project continues to have active users, but it does not have active maintainers. If you are a user of this project, please consider becoming a maintainer. It is a natural extension of maintaining your own projects, you'll ensure your own tool is up-to-date now and in the future, and you'll gain skills that will help for future open- and closed-source work.

I expect to have some free time in the next two months, until the second week of January 2023. If someone (ideally two or more people) want to learn project maintenance, I'll be available to mentor and assist during this period. Some of my goals are:

  • A 2.0 release, as specified on #311
  • Adopting Jazzband release standards, like setuptools_scm and auto-releases
  • Expanding the tests to look more like the Django test suite, with multiple projects focused on different feature sets.

If you are interested, let me know in the comments, and read the guides at jazzband.co.

Python 3.11 support

opened on 2022-11-11 21:58:16 by radzhome

I had to patch nose for django 2.2 on python 3.11 - ```

patch for nose (django-nose) for py3.11

import collections collections.Callable = collections.abc.Callable

End of patch

``` collections.Callable has a new location.

Django 3.1: TypeError: sql_flush() takes 3 positional arguments but 4 were given

opened on 2022-07-06 12:14:54 by jklemm

Hi!

After upgrade from Django 3.0 to 3.1, running my tests using django-nose gives me this exception:

``` REUSE_DB=1 nosetests mypackage --with-fixture-bundling --with-parallel --with-xunit --verbosity=1

File "~/.virtualenvs/web-django31/lib/python3.9/site-packages/django/core/management/commands/test.py", line 53, in handle failures = test_runner.run_tests(test_labels) File "~/.virtualenvs/web-django31/lib/python3.9/site-packages/django_nose/runner.py", line 308, in run_tests result = self.run_suite(nose_argv) File "~/Repos/myrepo/test_utils/nose/init.py", line 52, in run_suite return super(MyNoseRunner, self).run_suite(nose_argv) File "~/.virtualenvs/web-django31/lib/python3.9/site-packages/django_nose/runner.py", line 244, in run_suite nose.core.TestProgram(argv=nose_argv, exit=False, File "~/.virtualenvs/web-django31/lib/python3.9/site-packages/nose/core.py", line 118, in init unittest.TestProgram.init( File "~/.pyenv/versions/3.9.11/lib/python3.9/unittest/main.py", line 101, in init self.runTests() File "~/.virtualenvs/web-django31/lib/python3.9/site-packages/nose/core.py", line 207, in runTests result = self.testRunner.run(self.test) File "~/.virtualenvs/web-django31/lib/python3.9/site-packages/nose/core.py", line 50, in run wrapper = self.config.plugins.prepareTest(test) File "~/.virtualenvs/web-django31/lib/python3.9/site-packages/nose/plugins/manager.py", line 99, in call return self.call(arg, kw) File "~/.virtualenvs/web-django31/lib/python3.9/site-packages/nose/plugins/manager.py", line 167, in simple result = meth(arg, **kw) File "~/.virtualenvs/web-django31/lib/python3.9/site-packages/django_nose/plugin.py", line 82, in prepareTest self.old_names = self.runner.setup_databases() File "~/.virtualenvs/web-django31/lib/python3.9/site-packages/django_nose/runner.py", line 466, in setup_databases reset_statements = _mysql_reset_sequences( File "~/.virtualenvs/web-django31/lib/python3.9/site-packages/django_nose/runner.py", line 405, in _mysql_reset_sequences flush_statements = connection.ops.sql_flush( TypeError: sql_flush() takes 3 positional arguments but 4 were given ```

The implementation of MyNoseRunner:

```python import re from django_nose import NoseTestSuiteRunner

class MyNoseRunner(NoseTestSuiteRunner): def run_suite(self, nose_argv): stack = traceback.extract_stack() running_with_pycharm = any([re.findall('[Pp]y[cC]harm|pydev', str(item)) for item in stack])

    if running_with_pycharm:
        print('Apply PyCharm fix...\n')
        nose_argv[1] = convert_test_uri_to_nose_pattern(nose_argv[1])

    return super(MyNoseRunner, self).run_suite(nose_argv)

```

The versions of my local environment: ```

macOS Monterey 12.4 Apple M1

Python 3.9.11

Django==3.1.14 django-nose==1.4.7 nose==1.3.7 nose-parallel==0.4.0 ```

I've found an issue on other repo and there is: ``` probably because the signature for sql_flush has changed (also in https://docs.djangoproject.com/en/3.1/releases/3.1/#backwards-incompatible-changes-in-3-1).

Compare https://github.com/django/django/blob/3.0.9/django/db/backends/base/operations.py#L384 vs https://github.com/django/django/blob/3.1/django/db/backends/base/operations.py#L392 ```

Thanks.

Bump ipython from 5.4.1 to 7.16.3

opened on 2022-01-21 19:42:50 by dependabot[bot]

Bumps ipython from 5.4.1 to 7.16.3.

Commits


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/jazzband/django-nose/network/alerts).

Why still maintain this package?

opened on 2021-10-01 06:51:13 by guettli

Why still maintain this package?

Why not tell people that this package is dead, and people should switch to pytest?

Releases

v1.4.7 2020-08-20 02:19:34

v1.4.7

v1.4.6 2018-10-03 21:26:20

  • Document Django 2.0 and 2.1 support, no changes needed
  • Document Python 3.7 support

v1.4.5 2017-08-22 19:26:56

  • Add Django 1.11 support

v1.4.4 2016-06-27 13:29:35

  • Add Django 1.10 support
  • Drop Django 1.4, 1.7, and Python 2.6 support
  • Drop South support

v1.4.3 2015-12-28 22:46:53

  • Add Django 1.9 support
  • Support long options without equals signs, such as "--attr selected"
  • Support nose plugins using callback options
  • Support nose options without default values (@jsatt)
  • Remove Django from install dependencies, to avoid accidental upgrades (@jsocol, @willkg)
  • Setting REUSE_DB to an empty value now disables REUSE_DB, instead of enabling it (@wdoekes)

2015-10-07 15:20:35

  • Warn against using REUSE_DB=1 and FastFixtureTestCase in docs
  • REUSE_DB=1 uses new transaction management in Django 1.7, 1.8 (@scottsexton)
  • Try to avoid accidentally using production database with REUSE_DB=1 (@alexjg, @eroninjapan)
  • Supported Django versions limited to current supported Django version 1.4, 1.7, and 1.8, as well as relevant Python versions.
Jazzband

We are all part of this

GitHub Repository Homepage