Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Nose2 plugin to run django tests through nose2 instead of the django test runner.
A plugin pair for nose2 that runs your django (>=1.4) tests through the nose2 command and also supports django-configurations_ settings management. It lets django initialise the test environment and setup the order of the test suite, but nose2/unittest2 handles the test discovery and execution.
There is another project called |django-nose2|_ which is authored by one of the nose2 devs. It uses the standard django approach of setting an alternative test runner and running via manage.py. I was interested with the move to shift setup.py configuration into setup.cfg and wanted to try that pattern for running tests rather that wrapping configuration into a custom test runner. Modern django has refactored the way a project is initialised which means there is less dependency on using manage.py and django-admin.py as the only possible entry points into your django project.
.. code-block:: bash
$ pip install nose2django
Create a nose2.cfg file in your project's root directory (where manage.py is) and register the plugins in the correct order::
[unittest]
plugins = nose2django.config
nose2django.nose2django
[django-config]
always-on = True
# optional settings
settings = yourproject.settings
configuration = YourTestConfiguration
[django-runner]
always-on = True
You can optionally set the settings
and configuration
to a django settings module and a django-configurations configuration. It takes precedence over any existing environment.
As per nose2, optionally with either of the django-runner options.
.. code-block:: bash
$ nose2 --settings=example.settings.test --configuration=TestSettings
For django app test driven development of apps you want only as much django settings as required. Create a tests folder in your top level directory (avoid using the name tests - use something like test_yourapp to avoid name clashes), and put a minimal settings file in there and an __init__.py
file to make it importable. Something like:
.. code-block:: python
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3' }
}
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'yourapp',
)
ROOT_URLCONF='yourapp.urls', # if you have urls
SECRET_KEY = '1234'
nose2django re-uses parts of the existing django test runner code as licensed by django_.
.. _django-configurations: https://github.com/jezdez/django-configurations .. _django-nose2: https://github.com/jpellerin/django-nose2 .. _django: https://raw.github.com/django/django/master/LICENSE
.. |django-nose2| replace:: django-nose
.. :changelog:
v0.1.2 (2013-4-13) ^^^^^^^^^^^^^^^^^^^^
v0.1.1 (2013-4-6) ^^^^^^^^^^^^^^^^^^^^
v0.1 (2013-03-29) ^^^^^^^^^^^^^^^^^^^^
FAQs
Nose2 plugin to run django tests through nose2 instead of the django test runner.
We found that nose2django demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.