Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xdist disable suffix #98

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .Python

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ _build
/include/
/lib/
/src/
/share/
.cache
.Python
53 changes: 37 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,43 @@

# Use container-based environment (faster startup, allows caches).
sudo: false
language: python
python:
- "3.3"
- "3.4"
env:
- TESTENV=pypy-master-sqlite
- TESTENV=python2.6-1.6-sqlite
- TESTENV=python2.7-1.3-sqlite
- TESTENV=python2.7-1.4-sqlite
- TESTENV=python2.7-master-mysql_innodb
- TESTENV=python2.7-master-mysql_myisam
- TESTENV=python2.7-master-sqlite
- TESTENV=python3.2-master-sqlite
- TESTENV=python3.3-master-sqlite
- TESTENV=python3.4-1.5-sqlite
- TESTENV=python3.4-1.6-sqlite
- TESTENV=python3.4-1.7-sqlite
- TESTENV=python3.4-master-postgres
- TESTENV=python2.6-1.6-sqlite_file
- TESTENV=python2.7-1.3-sqlite_file
- TESTENV=python2.7-1.4-sqlite_file
- TESTENV=python2.7-1.5-sqlite_file
- TESTENV=python2.7-1.6-sqlite_file
- TESTENV=python2.7-1.7-sqlite_file
- TESTENV=python2.7-1.8-sqlite_file
- TESTENV=python2.7-master-sqlite_file
- TESTENV=python3.4-1.5-sqlite_file
- TESTENV=python3.4-1.6-sqlite_file
- TESTENV=python3.4-1.7-sqlite_file
- TESTENV=python3.4-1.8-sqlite_file
- TESTENV=python3.4-master-sqlite
- TESTENV=python3.4-master-sqlite_file
- TESTENV=checkqa-python2.7
- TESTENV=checkqa-python3.4
matrix:
allow_failures:
- env: TESTENV=python2.7-master-sqlite_file
- env: TESTENV=python3.4-master-sqlite
- env: TESTENV=python3.4-master-sqlite_file
install:
# Create pip wrapper script, using travis_retry (a function) and
# inject it into tox.ini.
- mkdir -p bin
- PATH=$PWD/bin:$PATH
- printf '#!/bin/sh\n' > bin/travis_retry_pip
- declare -f travis_retry >> bin/travis_retry_pip
- printf '\necho "Using pip-wrapper.." >&2\ntravis_retry pip "$@"' >> bin/travis_retry_pip
- chmod +x bin/travis_retry_pip
- sed -i.bak 's/^\[testenv\]/\0\ninstall_command = travis_retry_pip install {opts} {packages}/' tox.ini
- diff tox.ini tox.ini.bak && return 1 || true
- sed -i.bak 's/whitelist_externals =/\0\n travis_retry_pip/' tox.ini
- diff tox.ini tox.ini.bak && return 1 || true

- pip install tox
script: tox -e $TESTENV
script: tox -e $TESTENV
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ Rob Berry <[email protected]>
Floris Bruynooghe <[email protected]>
Rafal Stozek
Donald Stufft <[email protected]>
Nicolas Delaby <[email protected]>
Daniel Hahler <https://twitter.com/blueyed>
15 changes: 10 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
.PHONY: docs test clean
.PHONY: docs test clean isort

export DJANGO_SETTINGS_MODULE?=pytest_django_test.settings_sqlite_file

testenv: bin/py.test

test: bin/py.test
bin/pip install -e .
bin/py.test

bin/python bin/pip:
virtualenv .
Expand All @@ -10,15 +15,15 @@ bin/py.test: bin/python requirements.txt
bin/pip install -Ur requirements.txt
touch $@

test: bin/py.test
bin/pip install -e .
bin/py.test

bin/sphinx-build: bin/pip
bin/pip install sphinx

docs: bin/sphinx-build
SPHINXBUILD=../bin/sphinx-build $(MAKE) -C docs html

# See setup.cfg for configuration.
isort:
find pytest_django tests -name '*.py' -exec isort {} +

clean:
rm -rf bin include/ lib/ man/ pytest_django.egg-info/ build/
82 changes: 36 additions & 46 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,59 +1,49 @@
.. image:: https://secure.travis-ci.org/pelme/pytest_django.png?branch=master
.. image:: https://secure.travis-ci.org/pytest-dev/pytest-django.png?branch=master
:alt: Build Status
:target: https://travis-ci.org/pelme/pytest_django
:target: https://travis-ci.org/pytest-dev/pytest-django

pytest-django is a plugin for `pytest <http://pytest.org/>`_ that provides a set of useful tools for testing `Django <http://www.djangoproject.com/>`_ applications and projects.
Welcome to pytest-django!
=========================

* Authors: Ben Firshman, Andreas Pelme and `contributors <https://github.com/pelme/pytest_django/contributors>`_
* Licence: BSD
* Compatibility: Django 1.3-1.7 (Django master is compatible at the time of each release), python 2.5-2.7, 3.2-3.3 or PyPy, pytest >= 2.3.4
* Project URL: https://github.com/pelme/pytest_django
* Documentation: http://pytest-django.rtfd.org/


Quick Start
===========
1. ``pip install pytest-django``
2. Make sure ``DJANGO_SETTINGS_MODULE`` is defined and and run tests with the ``py.test`` command.
3. (Optionally) If you put your tests under a tests directory (the standard Django application layout), and your files are not named ``test_FOO.py``, `see the FAQ <http://pytest-django.readthedocs.org/en/latest/faq.html#my-tests-are-not-being-picked-up-when-i-run-pytest-from-the-root-directory-why-not>`_


Documentation
==============

`Documentation is available on Read the Docs. <http://pytest-django.readthedocs.org/en/latest/index.html>`_
pytest-django allows you to test your Django project/applications with the
`pytest testing tool <http://pytest.org/>`_.

* `Quick start / tutorial
<http://pytest-django.readthedocs.org/en/latest/tutorial.html>`_
* Full documentation: http://pytest-django.readthedocs.org/en/latest/
* `Contribution docs
<http://pytest-django.readthedocs.org/en/latest/contributing.html>`_
* Version compatibility:

Why would I use this instead of Django's manage.py test command?
================================================================
* Django: 1.3-1.8 and latest master branch (compatible at the time of each release)
* Python: CPython 2.6-2.7,3.2-3.4 or PyPy 2,3
* pytest: 2.6.x

Running the test suite with pytest offers some features that are not present in Djangos standard test mechanism:

* Less boilerplate: no need to import unittest, create a subclass with methods. Just write tests as regular functions.
* `Manage test dependencies with fixtures <http://pytest.org/latest/fixture.html>`_
* Database re-use: no need to re-create the test database for every test run.
* Run tests in multiple processes for increased speed
* There are a lot of other nice plugins available for pytest.
* Easy switching: Existing unittest-style tests will still work without any modifications.

See the `pytest documentation <http://pytest.org/latest/>`_ for more information on pytest.


Contributing
============

Read the `contributing page <http://pytest-django.readthedocs.org/en/latest/contributing.html>`_ from the documentation.
* Licence: BSD
* Project maintainers: Andreas Pelme, Floris Bruynooghe and Daniel Hahler
* `All contributors <https://github.com/pytest-dev/pytest-django/contributors>`_
* Github repository: https://github.com/pytest-dev/pytest-django
* `Issue tracker <http://github.com/pytest-dev/pytest-django/issues>`_
* `Python Package Index (PyPI) <https://pypi.python.org/pypi/pytest-django/>`_

To run the project's tests::
Install pytest-django
---------------------

make test
::

To build the project's docs::
pip install pytest-django

make docs
Why would I use this instead of Django's `manage.py test` command?
------------------------------------------------------------------

Running your test suite with pytest-django allows you to tap into the features
that are already present in pytest. Here are some advantages:

Bugs? Feature suggestions?
============================
* `Manage test dependencies with pytest fixtures. <http://pytest.org/latest/fixture.html>`_
* Less boilerplate tests: no need to import unittest, create a subclass with methods. Write tests as regular functions.
* Database re-use: no need to re-create the test database for every test run.
* Run tests in multiple processes for increased speed (with the pytest-xdist plugin).
* Make use of other `pytest plugins <http://pytest.org/latest/plugins.html>`_.
* Works with both worlds: Existing unittest-style TestCase's still work without any modifications.

Report issues and feature requests at the `github issue tracker <http://github.com/pelme/pytest_django/issues>`_.
See the `pytest documentation <http://pytest.org/latest/>`_ for more information on pytest itself.
76 changes: 69 additions & 7 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,68 @@
Changelog
=========

2.8.0
-----

Features
^^^^^^^^

* pytest's verbosity is being used for Django's code to setup/teardown the test
database (#172).

* Added a new option `--nomigrations` to avoid running Django 1.7+ migrations
when constructing the test database. Huge thanks to Renan Ivo for complete
patch, tests and documentation.

Bug fixes
^^^^^^^^^

* Fixed compatibility issues related to Django 1.8's
`setUpClass`/`setUpTestData`. Django 1.8 is now a fully supported version.
Django master as of 2014-01-18 (the Django 1.9 branch) is also supported.

2.7.0
-----

Features
^^^^^^^^

* New fixtures: ``admin_user``, ``django_user_model`` and
``django_username_field`` (#109).

* Automatic discovery of Django projects to make it easier for new users. This
change is slightly backward incompatible, if you encounter problems with it,
the old behaviour can be restored by adding this to ``pytest.ini``,
``setup.cfg`` or ``tox.ini``::

[pytest]
django_find_project = false

Please see the :ref:`managing_python_path` section for more information.

Bugfixes
^^^^^^^^

* Fix interaction between ``db`` and ``transaction_db`` fixtures (#126).

* Fix admin client with custom user models (#124). Big thanks to Benjamin
Hedrich and Dmitry Dygalo for patch and tests.

* Fix usage of South migrations, which were unconditionally disabled previously
(#22).

* Fixed #119, #134: Call ``django.setup()`` in Django >=1.7 directly after
settings is loaded to ensure proper loading of Django applications. Thanks to
Ionel Cristian Mărieș, Daniel Hahler, Tymur Maryokhin, Kirill SIbirev, Paul
Collins, Aymeric Augustin, Jannis Leidel, Baptiste Mispelon and Anatoly
Bubenkoff for report, discussion and feedback.

* `The `live_server`` fixture can now serve static files also for Django>=1.7
if the ``django.contrib.staticfiles`` app is installed. (#140).

* ``DJANGO_LIVE_TEST_SERVER_ADDRESS`` environment variable is read instead
of ``DJANGO_TEST_LIVE_SERVER_ADDRESS``. (#140)

2.6.2
-----

Expand Down Expand Up @@ -41,9 +103,9 @@ used - use 2.6.1 or newer to avoid confusion.
strategy as for pytest itself is used: No code will be changed to prevent
Python 2.5 from working, but it will not be actively tested.

* pytest-xdist support: it is now possible to run tests in parallell. Just use
* pytest-xdist support: it is now possible to run tests in parallel. Just use
pytest-xdist as normal (pass -n to py.test). One database will be created for
each subprocess so that tests run independent from eachother.
each subprocess so that tests run independent from each other.

2.4.0
-----
Expand Down Expand Up @@ -73,7 +135,7 @@ used - use 2.6.1 or newer to avoid confusion.
-----

* Python 3 support. pytest-django now supports Python 3.2 and 3.3 in addition
to 2.5-2.7. Big thanks to Rafal Stozek for making this happend!
to 2.5-2.7. Big thanks to Rafal Stozek for making this happen!

2.1.0
-----
Expand All @@ -95,15 +157,15 @@ used - use 2.6.1 or newer to avoid confusion.
-----

This release is *backward incompatible*. The biggest change is the need
to add the ``pytest.mark.django_db`` to tests which needs database
to add the ``pytest.mark.django_db`` to tests which require database
access.

Finding such tests is generally very easy: just run your test suite, the
tests which needs database access will fail. Add ``pytestmark =
tests which need database access will fail. Add ``pytestmark =
pytest.mark.django_db`` to the module/class or decorate them with
``@pytest.mark.django_db``.

Most of the interals has been rewritten, exploiting py.test's new
Most of the internals have been rewritten, exploiting py.test's new
fixtures API. This release would not be possible without Floris
Bruynooghe who did the port to the new fixture API and fixed a number of
bugs.
Expand Down Expand Up @@ -178,4 +240,4 @@ way for easier additions of new and exciting features in the future!
* Added documentation
* Uploaded to PyPI for easy installation
* Added the ``transaction_test_case`` decorator for tests that needs real transactions
* Added initial implemantion for live server support via a funcarg (no docs yet, it might change!)
* Added initial implementation for live server support via a funcarg (no docs yet, it might change!)
2 changes: 2 additions & 0 deletions docs/configuring_django.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _configuring_django_settings:

Configuring Django settings
===========================

Expand Down
Loading