From 7bd70f0325b92eb9165e53f47774c3e692662105 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D0=B0=D1=80=D0=B5=D0=B2=20=D0=90=D0=BB=D0=B5=D0=BA?= =?UTF-8?q?=D1=81=D0=B0=D0=BD=D0=B4=D1=80?= Date: Fri, 6 Jun 2014 20:49:29 +0400 Subject: [PATCH 1/4] xdist disable suffix --- pytest_django/fixtures.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pytest_django/fixtures.py b/pytest_django/fixtures.py index e434d9a46..14e1c18f9 100644 --- a/pytest_django/fixtures.py +++ b/pytest_django/fixtures.py @@ -25,11 +25,15 @@ def _django_db_setup(request, _django_runner, _django_cursor_wrapper): """Session-wide database setup, internal to pytest-django""" skip_if_no_django() + from django.conf import settings from django.core import management # xdist if hasattr(request.config, 'slaveinput'): - db_suffix = request.config.slaveinput['slaveid'] + if hasattr(settings, 'XDIST_DISABLE_SUFFIX') and settings.XDIST_DISABLE_SUFFIX: + db_suffix = None + else: + db_suffix = request.config.slaveinput['slaveid'] else: db_suffix = None From fa4b6e951891ae88386a58c8df2e49081d61792e Mon Sep 17 00:00:00 2001 From: Alexander Karev Date: Thu, 19 Jun 2014 02:52:16 +0400 Subject: [PATCH 2/4] xdist-one-db --- pytest_django/fixtures.py | 5 ++++- pytest_django/plugin.py | 3 +++ tests/test_db_setup.py | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/pytest_django/fixtures.py b/pytest_django/fixtures.py index 8de9e6393..f17ef20dd 100644 --- a/pytest_django/fixtures.py +++ b/pytest_django/fixtures.py @@ -32,7 +32,10 @@ def _django_db_setup(request, # xdist if hasattr(request.config, 'slaveinput'): - db_suffix = request.config.slaveinput['slaveid'] + if request.config.getvalue('xdist_one_db'): + db_suffix = None + else: + db_suffix = request.config.slaveinput['slaveid'] else: db_suffix = None diff --git a/pytest_django/plugin.py b/pytest_django/plugin.py index 62366cdcc..08c45a8dc 100644 --- a/pytest_django/plugin.py +++ b/pytest_django/plugin.py @@ -39,6 +39,9 @@ def pytest_addoption(parser): action='store_true', dest='create_db', default=False, help='Re-create the database, even if it exists. This ' 'option will be ignored if not --reuse-db is given.') + group._addoption('--xdist-one-db', + action='store_true', dest='xdist_one_db', default=False, + help='Use only one database with xdist plugin.') group._addoption('--ds', action='store', type='string', dest='ds', default=None, help='Set DJANGO_SETTINGS_MODULE.') diff --git a/tests/test_db_setup.py b/tests/test_db_setup.py index a62bfaadc..e98d99ee3 100644 --- a/tests/test_db_setup.py +++ b/tests/test_db_setup.py @@ -109,6 +109,40 @@ def test_b(settings): result.stdout.fnmatch_lines(['*PASSED*test_b*']) +@skip_on_python32 +def test_xdist_one_db(django_testdir): + skip_if_sqlite() + + django_testdir.create_test_module(''' + import pytest + + from .app.models import Item + + def _check(settings): + # Make sure that the database name looks correct + db_name = settings.DATABASES['default']['NAME'] + assert not 'gw' in db_name + + assert Item.objects.count() == 0 + Item.objects.create(name='foo') + assert Item.objects.count() == 1 + + + @pytest.mark.django_db + def test_a(settings): + _check(settings) + + + @pytest.mark.django_db + def test_b(settings): + _check(settings) + ''') + + result = django_testdir.runpytest('-vv', '-n2', '-s', '--reuse-db', '--xdist-one-db') + result.stdout.fnmatch_lines(['*PASSED*test_a*']) + result.stdout.fnmatch_lines(['*PASSED*test_b*']) + + class TestSqliteWithXdist: pytestmark = skip_on_python32 From 111dc799fc1d9b3fd840461e44d6501e0acc5104 Mon Sep 17 00:00:00 2001 From: Alexandr Karev Date: Fri, 13 Feb 2015 18:09:29 +0300 Subject: [PATCH 3/4] merge 4.8.0 and xdist_one_db fix --- .Python | 1 - .gitignore | 2 + .travis.yml | 43 +- AUTHORS | 2 + Makefile | 8 +- README.rst | 89 +- docs/changelog.rst | 72 +- docs/configuring_django.rst | 2 + docs/contributing.rst | 94 +- docs/database.rst | 10 +- docs/faq.rst | 76 +- docs/helpers.rst | 41 +- docs/index.rst | 5 +- docs/managing_python_path.rst | 83 + docs/tutorial.rst | 90 +- docs/usage.rst | 2 + generate_configurations.py | 191 +- pytest.ini | 2 - pytest_django/__init__.py | 2 +- pytest_django/client.py | 30 +- pytest_django/compat.py | 14 +- pytest_django/db_reuse.py | 68 +- pytest_django/deprecated.py | 17 - pytest_django/django_compat.py | 17 +- pytest_django/fixtures.py | 220 +- pytest_django/lazy_django.py | 18 +- pytest_django/live_server_helper.py | 31 +- pytest_django/migrations.py | 8 + pytest_django/plugin.py | 262 ++- {tests => pytest_django_test}/__init__.py | 0 {tests => pytest_django_test}/app/__init__.py | 0 .../app/fixtures/items.json | 0 {tests => pytest_django_test}/app/models.py | 0 pytest_django_test/app/static/a_file.txt | 1 + {tests => pytest_django_test/app}/views.py | 6 + {tests => pytest_django_test}/compat.py | 4 +- {tests => pytest_django_test}/db_helpers.py | 83 +- .../settings_base.py | 12 +- .../settings_mysql_innodb.py | 2 +- .../settings_mysql_myisam.py | 2 +- .../settings_postgres.py | 2 +- .../settings_sqlite.py | 2 +- pytest_django_test/settings_sqlite_file.py | 19 + {tests => pytest_django_test}/urls.py | 3 +- .../urls_overridden.py | 0 requirements.txt | 2 + setup.cfg | 17 + setup.py | 7 +- tests/conftest.py | 98 +- tests/test_database.py | 35 +- tests/test_db_name.py | 25 +- tests/test_db_setup.py | 270 ++- tests/test_django_configurations.py | 14 +- tests/test_django_settings_module.py | 75 +- tests/test_environment.py | 45 +- tests/test_fixtures.py | 193 +- tests/test_manage_py_scan.py | 49 + tests/test_unittest.py | 11 +- tests/test_urls.py | 9 +- tests/urls_liveserver.py | 15 - tests/urls_unittest.py | 11 - tox.ini | 2035 ++++++++++++----- 62 files changed, 3343 insertions(+), 1204 deletions(-) delete mode 120000 .Python create mode 100644 docs/managing_python_path.rst mode change 100644 => 100755 generate_configurations.py delete mode 100644 pytest.ini delete mode 100644 pytest_django/deprecated.py create mode 100644 pytest_django/migrations.py rename {tests => pytest_django_test}/__init__.py (100%) rename {tests => pytest_django_test}/app/__init__.py (100%) rename {tests => pytest_django_test}/app/fixtures/items.json (100%) rename {tests => pytest_django_test}/app/models.py (100%) create mode 100644 pytest_django_test/app/static/a_file.txt rename {tests => pytest_django_test/app}/views.py (73%) rename {tests => pytest_django_test}/compat.py (62%) rename {tests => pytest_django_test}/db_helpers.py (61%) rename {tests => pytest_django_test}/settings_base.py (54%) rename {tests => pytest_django_test}/settings_mysql_innodb.py (86%) rename {tests => pytest_django_test}/settings_mysql_myisam.py (83%) rename {tests => pytest_django_test}/settings_postgres.py (84%) rename {tests => pytest_django_test}/settings_sqlite.py (73%) create mode 100644 pytest_django_test/settings_sqlite_file.py rename {tests => pytest_django_test}/urls.py (55%) rename {tests => pytest_django_test}/urls_overridden.py (100%) create mode 100644 tests/test_manage_py_scan.py delete mode 100644 tests/urls_liveserver.py delete mode 100644 tests/urls_unittest.py diff --git a/.Python b/.Python deleted file mode 120000 index cc24a1e92..000000000 --- a/.Python +++ /dev/null @@ -1 +0,0 @@ -/System/Library/Frameworks/Python.framework/Versions/2.7/Python \ No newline at end of file diff --git a/.gitignore b/.gitignore index 988e87a1f..7bf666b8c 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,6 @@ _build /include/ /lib/ /src/ +/share/ .cache +.Python diff --git a/.travis.yml b/.travis.yml index 7391fccbc..c1192be50 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,22 +1,31 @@ - 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=python3.4-master-sqlite + - TESTENV=pypy-2.6.4-master-sqlite_file + - TESTENV=pypy3-2.6.4-master-sqlite_file + - TESTENV=python2.6-2.6.4-1.6-sqlite_file + - TESTENV=python2.7-2.6.4-1.3-sqlite_file + - TESTENV=python2.7-2.6.4-1.4-sqlite_file + - TESTENV=python2.7-2.6.4-master-mysql_innodb + - TESTENV=python2.7-2.6.4-master-mysql_myisam + - TESTENV=python2.7-2.6.4-master-sqlite_file + - TESTENV=python3.2-2.6.4-master-sqlite_file + - TESTENV=python3.3-2.6.4-master-sqlite_file + - TESTENV=python3.4-2.6.4-1.5-sqlite_file + - TESTENV=python3.4-2.6.4-1.6-sqlite_file + - TESTENV=python3.4-2.6.4-1.7-sqlite_file + - TESTENV=python3.4-2.6.4-1.8-sqlite_file + - TESTENV=python3.4-2.6.4-master-postgres + - TESTENV=python3.4-2.6.4-master-sqlite + - TESTENV=python3.4-2.6.4-master-sqlite_file + - TESTENV=checkqa-python2.6 + - TESTENV=checkqa-python2.7 + - TESTENV=checkqa-python3.2 + - TESTENV=checkqa-python3.3 + - TESTENV=checkqa-python3.4 + - TESTENV=checkqa-pypy + - TESTENV=checkqa-pypy3 install: - pip install tox -script: tox -e $TESTENV +script: tox -e $TESTENV \ No newline at end of file diff --git a/AUTHORS b/AUTHORS index 0d174c595..fbeb394b6 100644 --- a/AUTHORS +++ b/AUTHORS @@ -11,3 +11,5 @@ Rob Berry Floris Bruynooghe Rafal Stozek Donald Stufft +Nicolas Delaby +Daniel Hahler diff --git a/Makefile b/Makefile index 10192b523..063ec03ef 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,6 @@ -.PHONY: docs test clean +.PHONY: docs test clean isort + +export DJANGO_SETTINGS_MODULE?=tests.settings_sqlite testenv: bin/py.test @@ -20,5 +22,9 @@ bin/sphinx-build: bin/pip 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/ diff --git a/README.rst b/README.rst index ebfe1c0fa..c700fa595 100644 --- a/README.rst +++ b/README.rst @@ -1,59 +1,42 @@ -.. 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 `_ that provides a set of useful tools for testing `Django `_ applications and projects. +Welcome to pytest-django! +========================= -* Authors: Ben Firshman, Andreas Pelme and `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 `_ - - -Documentation -============== - -`Documentation is available on Read the Docs. `_ - - -Why would I use this instead of Django's manage.py test command? -================================================================ - -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 `_ - * 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. +pytest-django allows you to test your Django project/applications with the +`pytest testing tool `_. -See the `pytest documentation `_ for more information on pytest. +* `Quick start / tutorial + `_ +* Full documentation: http://pytest-django.readthedocs.org/en/latest/ +* `Contribution docs + `_ +* Version compatibility: + * 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 -Contributing -============ - -Read the `contributing page `_ from the documentation. - -To run the project's tests:: - - make test - -To build the project's docs:: - - make docs - - -Bugs? Feature suggestions? -============================ - -Report issues and feature requests at the `github issue tracker `_. +* Licence: BSD +* Project maintainers: Andreas Pelme, Floris Bruynooghe and Daniel Hahler +* `All contributors `_ +* Github repository: https://github.com/pytest-dev/pytest-django +* `Issue tracker `_ +* `Python Package Index (PyPI) `_ + +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: + +* `Manage test dependencies with pytest fixtures. `_ +* 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 `_. +* Works with both worlds: Existing unittest-style TestCase's still work without any modifications. + +See the `pytest documentation `_ for more information on pytest itself. diff --git a/docs/changelog.rst b/docs/changelog.rst index c90a5f3d3..a5774fad8 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -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 ----- @@ -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 ----- @@ -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 ----- @@ -103,7 +165,7 @@ tests which needs 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. @@ -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!) diff --git a/docs/configuring_django.rst b/docs/configuring_django.rst index f91dfe204..6281434b2 100644 --- a/docs/configuring_django.rst +++ b/docs/configuring_django.rst @@ -1,3 +1,5 @@ +.. _configuring_django_settings: + Configuring Django settings =========================== diff --git a/docs/contributing.rst b/docs/contributing.rst index 468fefb99..66ce2a644 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -3,7 +3,7 @@ Contributing to pytest-django ############################# Like every open-source project, pytest-django is always looking for motivated -individuals to contribute to it's source code. However, to ensure the highest +individuals to contribute to its source code. However, to ensure the highest code quality and keep the repository nice and tidy, everybody has to follow a few rules (nothing major, I promise :) ) @@ -12,10 +12,10 @@ few rules (nothing major, I promise :) ) Community ********* -The fastest way to get feedback on contributions/bugs are usually to open an +The fastest way to get feedback on contributions/bugs is usually to open an issue in the `issue tracker`_. -Discussions also happends via IRC in #pylib on irc.freenode.org. You may also +Discussions also happen via IRC in #pylib on irc.freenode.org. You may also be interested in following `@andreaspelme`_ on Twitter. ************* @@ -24,15 +24,15 @@ In a nutshell Here's what the contribution process looks like, in a bullet-points fashion: -#. pytest-django is hosted on `GitHub`_, at https://github.com/pelme/pytest-django -#. The best method to contribute back is to create an account there, then fork +#. pytest-django is hosted on `GitHub`_, at + https://github.com/pytest-dev/pytest-django +#. The best method to contribute back is to create an account there and fork the project. You can use this fork as if it was your own project, and should push your changes to it. #. When you feel your code is good enough for inclusion, "send us a `pull request`_", by using the nice GitHub web interface. - ***************** Contributing Code ***************** @@ -43,18 +43,18 @@ Getting the source code - Code will be reviewed and tested by at least one core developer, preferably by several. Other community members are welcome to give feedback. -- Code *must* be tested. Your pull request should include unit-tests (that cover - the piece of code you're submitting, obviously) +- Code *must* be tested. Your pull request should include unit-tests (that + cover the piece of code you're submitting, obviously). - Documentation should reflect your changes if relevant. There is nothing worse than invalid documentation. - Usually, if unit tests are written, pass, and your change is relevant, then - it'll be merged. + your pull request will be merged. Since we're hosted on GitHub, pytest-django uses `git`_ as a version control system. The `GitHub help`_ is very well written and will get you started on using git -and GitHub in a jiffy. It is an invaluable resource for newbies and old timers +and GitHub in a jiffy. It is an invaluable resource for newbies and oldtimers alike. @@ -63,11 +63,11 @@ Syntax and conventions We try to conform to `PEP8`_ as much as possible. A few highlights: -- Indentation should be exactly 4 spaces. Not 2, not 6, not 8. **4**. Also, tabs - are evil. +- Indentation should be exactly 4 spaces. Not 2, not 6, not 8. **4**. Also, + tabs are evil. - We try (loosely) to keep the line length at 79 characters. Generally the rule - is "it should look good in a terminal-base editor" (eg vim), but we try not be - [Godwin's law] about it. + is "it should look good in a terminal-based editor" (eg vim), but we try not + be [Godwin's law] about it. Process @@ -93,26 +93,29 @@ person :) Generally tests should be: -- Unitary (as much as possible). I.E. should test as much as possible only one - function/method/class. That's the very definition of unit tests. Integration - tests are interesting too obviously, but require more time to maintain since - they have a higher probability of breaking. +- Unitary (as much as possible). I.E. should test as much as possible only on + one function/method/class. That's the very definition of unit tests. + Integration tests are also interesting obviously, but require more time to + maintain since they have a higher probability of breaking. - Short running. No hard numbers here, but if your one test doubles the time it takes for everybody to run them, it's probably an indication that you're doing it wrong. In a similar way to code, pull requests will be reviewed before pulling (obviously), and we encourage discussion via code review (everybody learns -something this way) or IRC discussions. +something this way) or in the IRC channel. Running the tests ----------------- There is a Makefile in the repository which aids in setting up a virtualenv -which can be used to invoke py.test to run pytest-django's tests when -developing.:: +and running the tests:: + + $ make test - $ make +You can manually create the virtualenv using:: + + $ make testenv This will install a virtualenv with py.test and the latest stable version of Django. The virtualenv can then be activated with:: @@ -129,7 +132,7 @@ invoking:: $ tox -There is a huge number of unique test configurations (63 at the time of +There is a huge number of unique test configurations (98 at the time of writing), running them all will take a long time. All valid configurations can be found in `tox.ini`. To test against a few of them, invoke tox with the `-e` flag:: @@ -147,37 +150,37 @@ configuration files. Measuring test coverage ----------------------- -Some of tests are executed in subprocesses. Because of that regular +Some of the tests are executed in subprocesses. Because of that regular coverage measurements (using pytest-cov plugin) are not reliable. If you want to measure coverage you'll need to create .pth file as described in `subprocess section of coverage documentation`_. If you're using -"setup.py develop" thing you should uninstall pytest_django (using pip) +``setup.py develop`` you should uninstall pytest_django (using pip) for the time of measuring coverage. You'll also need mysql and postgres databases. There are predefined settings -for each database in tests directory. You may want to modify these files +for each database in the tests directory. You may want to modify these files but please don't include them in your pull requests. After this short initial setup you're ready to run tests:: $ COVERAGE_PROCESS_START=`pwd`/.coveragerc COVERAGE_FILE=`pwd`/.coverage PYTHONPATH=`pwd` py.test --ds=tests.postgres_settings -You should repeat above step for sqlite and mysql before next step. This step -will create a lot of ``.coverage`` files with additional suffix for every -process. +You should repeat the above step for sqlite and mysql before the next step. +This step will create a lot of ``.coverage`` files with additional suffixes for +every process. -The final step is to combine all files created by different processes and -generate html coverage report:: +The final step is to combine all the files created by different processes and +generate the html coverage report:: $ coverage combine $ coverage html -Your coverage report is now ready in ``htmlcov`` directory. +Your coverage report is now ready in the ``htmlcov`` directory. -Continous integration ---------------------- +Continuous integration +---------------------- `Travis`_ is used to automatically run all tests against all supported versions of Python, Django and different database backends. @@ -192,28 +195,28 @@ Contributing Documentation Perhaps considered "boring" by hard-core coders, documentation is sometimes even more important than code! This is what brings fresh blood to a project, -and serves as a reference for old timers. On top of this, documentation is the +and serves as a reference for oldtimers. On top of this, documentation is the one area where less technical people can help most - you just need to write a semi-decent English. People need to understand you. We don't care about style or correctness. Documentation should be: -- We use `Sphinx`_/`restructuredText`_. So obviously this is the format you should - use :) File extensions should be .rst. +- We use `Sphinx`_/`restructuredText`_. So obviously this is the format you + should use :) File extensions should be .rst. - Written in English. We can discuss how it would bring more people to the project to have a Klingon translation or anything, but that's a problem we will ask ourselves when we already have a good documentation in English. - Accessible. You should assume the reader to be moderately familiar with Python and Django, but not anything else. Link to documentation of libraries you use, for example, even if they are "obvious" to you (South is the first - example that comes to mind - it's obvious to any Django programmer, but not to - any newbie at all). + example that comes to mind - it's obvious to any Django programmer, but not + to any newbie at all). A brief description of what it does is also welcome. -Pulling of documentation is pretty fast and painless. Usually somebody goes over -your text and merges it, since there are no "breaks" and that GitHub parses rst -files automagically it's really convenient to work with. +Pulling of documentation is pretty fast and painless. Usually somebody goes +over your text and merges it, since there are no "breaks" and that GitHub +parses rst files automagically it's really convenient to work with. Also, contributing to the documentation will earn you great respect from the core developers. You get good karma just like a test contributor, but you get @@ -226,8 +229,8 @@ double cookie points. Seriously. You rock. project. Many thanks for allowing us to steal it! -.. _fork: https://github.com/pelme/pytest_django -.. _issue tracker: https://github.com/pelme/pytest_django/issues +.. _fork: https://github.com/pytest-dev/pytest-django +.. _issue tracker: https://github.com/pytest-dev/pytest-django/issues .. _Sphinx: http://sphinx.pocoo.org/ .. _PEP8: http://www.python.org/dev/peps/pep-0008/ .. _GitHub : http://www.github.com @@ -239,6 +242,5 @@ double cookie points. Seriously. You rock. .. _restructuredText: http://docutils.sourceforge.net/docs/ref/rst/introduction.html .. _django CMS: https://www.django-cms.org/ .. _Travis: https://travis-ci.org/ -.. _pytest-django Travis: https://travis-ci.org/pelme/pytest_django +.. _pytest-django Travis: https://travis-ci.org/pytest-dev/pytest-django .. _`subprocess section of coverage documentation`: http://nedbatchelder.com/code/coverage/subprocess.html - diff --git a/docs/database.rst b/docs/database.rst index 2152fa2e9..c75fa18ec 100644 --- a/docs/database.rst +++ b/docs/database.rst @@ -104,7 +104,7 @@ database will automatically be re-created. ``--create-db`` - force re creation of the test database -------------------------------------------------------- When used with ``--reuse-db``, this option will re-create the database, -regardless of wheter it exists or not. +regardless of whether it exists or not. Example work flow with ``--reuse-db`` and ``--create-db``. ----------------------------------------------------------- @@ -120,3 +120,11 @@ A good way to use ``--reuse-db`` and ``--create-db`` can be: * When you alter your database schema, run ``py.test --create-db``, to force re-creation of the test database. + +``--nomigrations`` - Disable Django 1.7+ migrations +-------------------------------------------------------------- + +Using ``--nomigrations`` will `disable Django 1.7+ migrations `_ +and create the database inspecting all app models (the default behavior of +Django until version 1.6). It may be faster when there are several migrations +to run in the database setup. diff --git a/docs/faq.rst b/docs/faq.rst index cd1483536..d69d4c0aa 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -1,68 +1,76 @@ FAQ === +.. _faq-import-error: I see an error saying "could not import myproject.settings" ----------------------------------------------------------- -py.test does not automatically add your project to the Python path, that is -usually done when running tests via `manage.py test`. +pytest-django tries to automatically add your project to the Python path by +looking for a ``manage.py`` file and adding its path to the Python path. -The easiest way to get your project code available on the Python path is to -create a `setup.py` like this:: - - from distutils.core import setup - setup(name='myproj', version='1.0') - -And then install your project into your virtualenv with ``pip install -e .``. - -Alternatively, when you create a `conftest.py` file in your project root, it -will also implicitly add that directory to the python path. +If this for some reason fails for you, you have to manage your Python paths +explicilty. See the documentation on :ref:`managing_the_python_path_explicilty` +for more information. How can I make sure that all my tests run with a specific locale? ----------------------------------------------------------------- -Activate a specific locale in your project's ``conftest.py``:: +Create a `pytest fixture `_ that is +automatically run before each test case. To run all tests with the english +locale, put the following code in your project's `conftest.py +`_ file:: from django.utils.translation import activate - def pytest_runtest_setup(item): + @pytest.fixture(autouse=True) + def set_default_language(): activate('en') .. _faq-tests-not-being-picked-up: -My tests are not being picked up when I run py.test from the root directory. Why not? +My tests are not being found. Why not? ------------------------------------------------------------------------------------- - By default, py.test looks for tests in files named ``test_*.py`` (note that this is not the same as ``test*.py``). - If you have your tests in files with other names, they will not be collected. It is common to put tests under - ``app_directory/tests/views.py``. To find those tests, create a ``pytest.ini`` file in your - project root with the contents:: + By default, py.test looks for tests in files named ``test_*.py`` (note that + this is not the same as ``test*.py``). If you have your tests in files with + other names, they will not be collected. It is common to put tests under + ``app_directory/tests/views.py``. To find those tests, create a ``pytest.ini`` + file in your project root with the contents:: [pytest] python_files=*.py +When debugging test collection problems, the `--collectonly` flag and `-rs` +(report skipped tests) can be helpful. -.. _faq-django-settings-module: - -How can I avoid having to type DJANGO_SETTINGS_MODULE=... to run the tests? ---------------------------------------------------------------------------- +How do South and pytest-django play together? +--------------------------------------------- -If you are using virtualenvwrapper, use a postactivate script to set ``DJANGO_SETTINGS_MODULE`` when your project's virtualenv is activated. +pytest-django detects South and applies its monkey-patch, which gets fixed +to handle initial data properly (which South would skip otherwise, because +of a bug). -This snippet should do the trick (make sure to replace ``YOUR_VIRTUALENV_NAME``):: +The ``SOUTH_TESTS_MIGRATE`` Django setting can be used to control wheter or not +migrations are used to construct the test database. - echo "export DJANGO_SETTINGS_MODULE=yourproject.settings" >> $WORKON_HOME/YOUR_VIRTUALENV_NAME/bin/postactivate +Does pytest-django work with the pytest-xdist plugin? +----------------------------------------------------- +Yes. pytest-django supports running tests in parallel with pytest-xdist. Each +process created by xdist gets its own separate database that is used for the +tests. This ensures that each test can run independently, regardless of wheter +transactions are tested or not. -How does South and pytest-django play together? ------------------------------------------------- +.. _faq-getting-help: -Djangos own syncdb will always be used to create the test database, regardless of wheter South is present or not. +How/where can I get help with pytest/pytest-django? +--------------------------------------------------- +Usage questions can be asked on StackOverflow with the `pytest tag +`_. -Does this work with the pytest-xdist plugin? --------------------------------------------- +If you think you've found a bug or something that is wrong in the +documentation, feel free to `open an issue on the Github project for +pytest-django `_. -Yes, pytest-django supports running tests in parallel with pytest-xdist. Each -process created by xdist gets its own database that is used for the tests. This -ensures that each test can run independently. +Direct help can be found in the #pylib IRC channel on irc.freenode.org. diff --git a/docs/helpers.rst b/docs/helpers.rst index 79445cff0..573f17010 100644 --- a/docs/helpers.rst +++ b/docs/helpers.rst @@ -1,3 +1,5 @@ +.. _helpers: + Django helpers ============== @@ -22,11 +24,9 @@ on what marks are and for notes on using_ them. of the test. This behavior is the same as Django's standard `django.test.TestCase`_ class. -.. _django.test.TestCase: https://docs.djangoproject.com/en/dev/topics/testing/overview/#testcase - In order for a test to have access to the database it must either be marked using the ``django_db`` mark or request one of the ``db`` - or ``transcational_db`` fixtures. Otherwise the test will fail + or ``transactional_db`` fixtures. Otherwise the test will fail when trying to access the database. :type transaction: bool @@ -38,8 +38,6 @@ on what marks are and for notes on using_ them. uses. When ``transaction=True``, the behavior will be the same as `django.test.TransactionTestCase`_ -.. _django.test.TransactionTestCase: https://docs.djangoproject.com/en/dev/topics/testing/overview/#transactiontestcase - .. note:: If you want access to the Django database *inside a fixture* @@ -49,6 +47,16 @@ on what marks are and for notes on using_ them. ``transactional_db`` fixture. See below for a description of them. + .. note:: Automatic usage with ``django.test.TestCase``. + + Test classes that subclass `django.test.TestCase`_ will have access to + the database always to make them compatible with existing Django tests. + Test classes that subclass Python's ``unittest.TestCase`` need to have the + marker applied in order to access the database. + +.. _django.test.TestCase: https://docs.djangoproject.com/en/dev/topics/testing/overview/#testcase +.. _django.test.TransactionTestCase: https://docs.djangoproject.com/en/dev/topics/testing/overview/#transactiontestcase + ``pytest.mark.urls`` - override the urlconf ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -131,6 +139,25 @@ Example As an extra bonus this will automatically mark the database using the ``django_db`` mark. +``admin_user`` - a admin user (superuser) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +An instance of a superuser, with username "admin" and password "password" (in +case there is no "admin" user yet). + +As an extra bonus this will automatically mark the database using the +``django_db`` mark. + +``django_user_model`` +~~~~~~~~~~~~~~~~~~~~~ + +The user model used by Django. This handles different versions of Django. + +``django_username_field`` +~~~~~~~~~~~~~~~~~~~~~~~~~ + +The field name used for the username on the user model. + ``db`` ~~~~~~~ @@ -151,7 +178,7 @@ database access themselves. A test function would normally use the ~~~~~~~~~~~~~~~ This fixture runs a live Django server in a background thread. The -server's URL can be retreived using the ``live_server.url`` attribute +server's URL can be retrieved using the ``live_server.url`` attribute or by requesting it's string value: ``unicode(live_server)``. You can also directly concatenate a string to form a URL: ``live_server + '/foo``. @@ -168,6 +195,6 @@ Example :: - def test_with_secific_settings(settings): + def test_with_specific_settings(settings): settings.USE_TZ = True assert settings.USE_TZ diff --git a/docs/index.rst b/docs/index.rst index 617b48f68..e2bad5a95 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -8,6 +8,7 @@ pytest-django is a plugin for `py.test `_ that provides a se tutorial configuring_django + managing_python_path usage database helpers @@ -18,7 +19,7 @@ pytest-django is a plugin for `py.test `_ that provides a se Why would I use this instead of Django's manage.py test command? ================================================================ -Running the test suite with py.test offers some features that are not present in Djangos standard test mechanism: +Running the test suite with py.test offers some features that are not present in Django's 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 `_ @@ -38,7 +39,7 @@ Quick Start Bugs? Feature suggestions? ============================ -Report issues and feature requests at the `github issue tracker `_. +Report issues and feature requests at the `github issue tracker `_. Indices and tables ================== diff --git a/docs/managing_python_path.rst b/docs/managing_python_path.rst new file mode 100644 index 000000000..3ba5927b4 --- /dev/null +++ b/docs/managing_python_path.rst @@ -0,0 +1,83 @@ +.. _managing_python_path: + +Managing the Python path +======================== + +pytest needs to be able to import the code in your project. Normally, when +interacting with Django code, the interaction happens via ``manage.py``, which +will implicilty add that directory to the Python path. + +However, when Python is started via the ``py.test`` command, some extra care is +needed to have the Python path setup properly. There are two ways to handle +this problem, described below. + +Automatic looking for of Django projects +---------------------------------------- + +By default, pytest-django tries to find Django projects by automatically +looking for the project's ``manage.py`` file and adding its directory to the +Python path. + +Looking for the ``manage.py`` file uses the same algorithm as pytest uses to +find ``pytest.ini``, ``tox.ini`` and ``setup.cfg``: Each test root directories +parents will be searched for ``manage.py`` files, and it will stop when the +first file is found. + +If you have a custom project setup, have none or multiple ``manage.py`` files +in your project, the automatic detection may not be correct. See +:ref:`managing_the_python_path_explicilty` for more details on how to configure +your environment in that case. + +.. _managing_the_python_path_explicilty: + +Managing the Python path explicilty +----------------------------------- + +First, disable the automatic Django project finder. Add this to +``pytest.ini``, ``setup.cfg`` or ``tox.ini``:: + + [pytest] + django_find_project = false + + +Next, you need to make sure that your project code is available on the Python +path. There are multiple ways to achieve this: + +Managing your project with virtualenv, pip and editable mode +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The easiest way to have your code available on the Python path when using +virtualenv and pip is to have a setup.py file and install your project in +editable mode when developing. + +If you don't already have a setup.py file, creating a setup.py file with this +content will get you started:: + + import setuptools + setuptools.setup(name='myproj', version='1.0') + +This ``setup.py`` file is not sufficient to distribute your package to PyPI or +more general packaging, but it should help you get started. Please refer to the +`Python Packaging User Guide +`_ +for more information on packaing Python applications.` + +To install the project afterwards:: + + pip install --editable . + +Your code should then be importable from any Python application. You can also +add this directly to your project's requirements.txt file like this:: + + # requirements.txt + -e . + django>=1.7 + pytest-django + + +Using pytest-pythonpath +~~~~~~~~~~~~~~~~~~~~~~~ + +You can also use the `pytest-pythonpath +`_ plugin to explicitly add paths to +the Python path. diff --git a/docs/tutorial.rst b/docs/tutorial.rst index 9aa379439..142b50728 100644 --- a/docs/tutorial.rst +++ b/docs/tutorial.rst @@ -1,40 +1,82 @@ -Getting started -=============== +Getting started with pytest and pytest-django +============================================= -Andreas Pelme gave a talk at EuroPython 2013 on testing in Django with -py.test. It shows the benefits of using py.test and how to get started: +Introduction +------------ -`Testing Django application with py.test (YouTube link) `_ +pytest and pytest-django are compatible with standard Django test suites and +Nose test suites. They should be able to pick up and run existing tests without +any or little configuration. This section describes how to get started quickly. + +Talks, articles and blog posts +------------------------------ + + * Talk from DjangoCon Europe 2014: `pytest: helps you write better Django apps, by Andreas Pelme `_ + + * Talk from EuroPython 2013: `Testing Django application with py.test, by Andreas Pelme `_ + + * Three part blog post tutorial (part 3 mentions Django integration): `pytest: no-boilerplate testing, by Daniel Greenfeld `_ + + * Blog post: `Django Projects to Django Apps: Converting the Unit Tests, by + John Costa + `_. + +For general information and tutorials on pytest, see the `pytest tutorial page `_. -Installation ------------- -pytest-django is available directly from `PyPi `_, and can be easily installed with ``pip``:: +Step 1: Installation +-------------------- + +pytest-django can be obtained directly from `PyPI +`_, and can be installed with +``pip``:: pip install pytest-django -``pytest-django`` uses ``py.test``'s module system and can be used right away after installation, there is nothing more to configure. +Installing pytest-django will also automatically install the latest version of +pytest. ``pytest-django`` uses ``pytest``'s plugin system and can be used right away +after installation, there is nothing more to configure. + +Step 2: Point pytest to your Django settings +-------------------------------------------- + +You need to tell pytest which Django settings that should be used for test +runs. The easiest way to achieve this is to create a pytest configuration file with this information. + +Create a filed called ``pytest.ini`` in your project root directory that contains:: -Usage ------ + [pytest] + DJANGO_SETTINGS_MODULE=yourproject.settings -Tests are invoked directly with the ``py.test`` command, instead of ``manage.py test``/``django-admin.py test``:: +You can also specify your Django settings by setting the +``DJANGO_SETTINGS_MODULE`` environment variable or specifying the +``--ds=yourproject.settings`` command line flag when running the tests. See the +full documentation on :ref:`configuring_django_settings`. + +Step 3: Run your test suite +--------------------------- + +Tests are invoked directly with the ``py.test`` command, instead of ``manage.py +test``, that you might be used to:: py.test -Django needs the environment variable ``DJANGO_SETTINGS_MODULE`` set -for tests runs to work. This plugin allows you to specify this in -multiple ways: +Do you have problems with pytest not finding your code? See the FAQ +:ref:`faq-import-error`. + +Next steps +---------- + +The :ref:`usage` section describes more ways to interact with your test suites. -1. Using the ``--ds`` command line option. -2. By writing a ``DJANGO_SETTINGS_MODULE`` setting in the ``[pytest]`` - section of your `py.test configuration file - `_ -3. By using the ``DJANGO_SETTINGS_MODULE`` environment variable. +pytest-django also provides some :ref:`helpers` to make it easier to write +Django tests. -`py.test` will find tests in your project automatically, ``INSTALLED_APPS`` will not be consulted. This means that 3rd-party and django.contrib.* apps will not be picked up by the test runner. +Consult the `pytest documentation `_ for more information +in pytest itself. -If you use virtualenv you can automatically use the environment -variable. See :ref:`faq-django-settings-module`. +Stuck? Need help? +----------------- -If you are interested in how to select specific tests, format tracebacks in different way, see `the excellent py.test documentation `_. +No problem, see the FAQ on :ref:`faq-getting-help` for information on how to +get help. diff --git a/docs/usage.rst b/docs/usage.rst index 19c51a1f8..8a3f94e59 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -1,3 +1,5 @@ +.. _usage: + Usage and invocations ===================== diff --git a/generate_configurations.py b/generate_configurations.py old mode 100644 new mode 100755 index 6cdb32248..3e90fe104 --- a/generate_configurations.py +++ b/generate_configurations.py @@ -1,51 +1,66 @@ +#!/usr/bin/env python from __future__ import print_function +import itertools +from collections import namedtuple +from textwrap import dedent + # https://xkcd.com/1319/ # https://xkcd.com/1205/ -import itertools -from collections import namedtuple -TestEnv = namedtuple('TestEnv', ['python_version', 'django_version', 'settings']) +TestEnvBase = namedtuple('TestEnvBase', ['python_version', 'pytest_version', + 'django_version', 'settings']) + +class TestEnv(TestEnvBase): + def is_py2(self): + return self.python_version.startswith('python2') or self.python_version == 'pypy' + + def is_py3(self): + return self.python_version.startswith('python3') or self.python_version == 'pypy3' + def is_pypy(self): + return self.python_version.startswith('pypy') -PYTHON_VERSIONS = ['python2.6', 'python2.7', 'python3.2', 'python3.3', 'python3.4', 'pypy'] -DJANGO_VERSIONS = ['1.3', '1.4', '1.5', '1.6', '1.7', 'master'] -SETTINGS = ['sqlite', 'mysql_myisam', 'mysql_innodb', 'postgres'] +# Python to run tox. +RUN_PYTHON = '3.4' +PYTHON_VERSIONS = ['python2.6', 'python2.7', 'python3.2', 'python3.3', + 'python3.4', 'pypy', 'pypy3'] +PYTEST_VERSIONS = ['2.6.4'] +DJANGO_VERSIONS = ['1.3', '1.4', '1.5', '1.6', '1.7', '1.8', 'master'] +SETTINGS = ['sqlite', 'sqlite_file', 'mysql_myisam', 'mysql_innodb', + 'postgres'] DJANGO_REQUIREMENTS = { - '1.3': 'Django==1.3.7', - '1.4': 'Django==1.4.13', - '1.5': 'Django==1.5.8', - '1.6': 'Django==1.6.5', - '1.7': 'https://www.djangoproject.com/m/releases/1.7/Django-1.7b4.tar.gz', + '1.3': 'Django>=1.3,<1.4', + '1.4': 'Django>=1.4,<1.5', + '1.5': 'Django>=1.5,<1.6', + '1.6': 'Django>=1.6,<1.7', + '1.7': 'Django>=1.7,<1.8', + '1.8': 'https://github.com/django/django/archive/stable/1.8.x.zip', 'master': 'https://github.com/django/django/archive/master.zip', } -TESTENV_TEMPLATE = """ -[testenv:%(testenv_name)s] -commands = -%(commands)s -basepython = %(python_version)s -deps = -%(deps)s -setenv = - DJANGO_SETTINGS_MODULE = tests.settings_%(settings)s - PYTHONPATH = {toxinidir} - UID = %(uid)s -""" +TOX_TESTENV_TEMPLATE = dedent(""" + [testenv:%(testenv_name)s] + commands = + %(commands)s + basepython = %(python_version)s + deps = + %(deps)s + setenv = + PYTHONPATH = {toxinidir} + UID = %(uid)s + """) def is_valid_env(env): - # Stable database adapters for PyPy+Postgres/MySQL are hard to come by.. - if env.python_version == 'pypy' and env.settings in ('postgres', - 'mysql_myisam', - 'mysql_innodb'): - return False - if env.python_version == 'pypy' and env.settings in 'mysql': + # Stable database adapters for PyPy+Postgres/MySQL are hard to come by.. + if env.is_pypy() and env.settings in ('postgres', 'mysql_myisam', 'mysql_innodb'): return False - if env.python_version in ('python3.2', 'python3.3', 'python3.4'): + if env.is_py3(): + # Django <1.5 does not support Python 3 if env.django_version in ('1.3', '1.4'): return False @@ -54,18 +69,21 @@ def is_valid_env(env): return False # Django 1.7 dropped Python 2.6 support - if env.python_version == 'python2.6' and env.django_version in ('1.7', 'master'): + if env.python_version == 'python2.6' and env.django_version in ('1.7', '1.8', 'master'): return False return True def requirements(env): - yield 'pytest==2.5.2' - yield 'pytest-xdist==1.10' + yield 'pytest==%s' % (env.pytest_version) + yield 'pytest-xdist==1.11' yield DJANGO_REQUIREMENTS[env.django_version] yield 'django-configurations==0.8' + if env.is_py2(): + yield 'south==1.0' + if env.settings == 'postgres': # Django 1.3 does not work with recent psycopg2 versions if env.django_version == '1.3': @@ -84,24 +102,26 @@ def commands(uid, env): # The sh trickery always exits with 0 if env.settings in ('mysql_myisam', 'mysql_innodb'): - yield 'sh -c "mysql -u root -e \'drop database if exists %(name)s; create database %(name)s\'" || exit 0' % {'name': db_name} + yield 'sh -c "mysql -u root -e \'drop database if exists %(name)s;' \ + ' create database %(name)s\'" || exit 0' % {'name': db_name} if env.settings == 'postgres': - yield 'sh -c "dropdb %(name)s; createdb %(name)s || exit 0"' % {'name': db_name} + yield 'sh -c "dropdb %(name)s;' \ + ' createdb %(name)s || exit 0"' % {'name': db_name} - yield 'py.test {posargs}' + yield 'py.test --ds=pytest_django_test.settings_%s --strict -r fEsxXw {posargs}' % env.settings def testenv_name(env): return '-'.join(env) -def testenv_config(uid, env): +def tox_testenv_config(uid, env): cmds = '\n'.join(' %s' % r for r in commands(uid, env)) deps = '\n'.join(' %s' % r for r in requirements(env)) - return TESTENV_TEMPLATE % { + return TOX_TESTENV_TEMPLATE % { 'testenv_name': testenv_name(env), 'python_version': env.python_version, 'django_version': env.django_version, @@ -113,16 +133,18 @@ def testenv_config(uid, env): def generate_all_envs(): - products = itertools.product(PYTHON_VERSIONS, DJANGO_VERSIONS, SETTINGS) + products = itertools.product(PYTHON_VERSIONS, PYTEST_VERSIONS, + DJANGO_VERSIONS, SETTINGS) - for idx, (python_version, django_version, settings) in enumerate(products): - env = TestEnv(python_version, django_version, settings) + for idx, (python_version, pytest_version, django_version, settings) \ + in enumerate(products): + env = TestEnv(python_version, pytest_version, django_version, settings) if is_valid_env(env): yield env -def generate_unique_envs(envs): +def generate_default_envs(envs): """ Returns a list of testenvs that include all different Python versions, all Django versions and all database backends. @@ -137,59 +159,86 @@ def find_and_add(variations, env_getter): break find_and_add(PYTHON_VERSIONS, lambda env: env.python_version) + find_and_add(PYTEST_VERSIONS, lambda env: env.pytest_version) find_and_add(DJANGO_VERSIONS, lambda env: env.django_version) find_and_add(SETTINGS, lambda env: env.settings) return result -def make_tox_ini(envs): - contents = [''' -[testenv] -whitelist_externals = - sh -'''] - - for idx, env in enumerate(envs): - contents.append(testenv_config(idx, env)) +def make_tox_ini(envs, default_envs): + default_env_names = ([testenv_name(env) for env in default_envs] + + ['checkqa-%s' % python_version for python_version in PYTHON_VERSIONS]) + + contents = [dedent(''' + [tox] + envlist = %(active_envs)s + + [testenv] + whitelist_externals = + sh + ''' % {'active_envs': ','.join(default_env_names)}).lstrip()] + + # Add checkqa-testenvs for different PYTHON_VERSIONS. + # flake8 is configured in setup.cfg. + idx = 0 + for python_version in PYTHON_VERSIONS: + idx = idx + 1 + contents.append(dedent(""" + [testenv:checkqa-%(python_version)s] + commands = + flake8 --version + flake8 --show-source --statistics pytest_django tests + basepython = %(python_version)s + deps = + flake8 + setenv = + UID = %(uid)s""" % { + 'python_version': python_version, + 'uid': idx, + })) + + for env in envs: + idx = idx + 1 + contents.append(tox_testenv_config(idx, env)) return '\n'.join(contents) def make_travis_yml(envs): - contents = """ -language: python -python: - - "3.3" -env: -%(testenvs)s -install: - - pip install tox -script: tox -e $TESTENV -""" + contents = dedent(""" + language: python + python: + - "%(RUN_PYTHON)s" + env: + %(testenvs)s + %(checkenvs)s + install: + - pip install tox + script: tox -e $TESTENV + """).strip("\n") testenvs = '\n'.join(' - TESTENV=%s' % testenv_name(env) for env in envs) + checkenvs = '\n'.join(' - TESTENV=checkqa-%s' % + python for python in PYTHON_VERSIONS) return contents % { - 'testenvs': testenvs + 'testenvs': testenvs, + 'checkenvs': checkenvs, + 'RUN_PYTHON': RUN_PYTHON, } def main(): all_envs = sorted(generate_all_envs()) - unique_envs = sorted(generate_unique_envs(all_envs)) + default_envs = sorted(generate_default_envs(all_envs)) with open('tox.ini', 'w+') as tox_ini_file: - tox_ini_file.write(make_tox_ini(all_envs)) + tox_ini_file.write(make_tox_ini(all_envs, default_envs)) with open('.travis.yml', 'w+') as travis_yml_file: - travis_yml_file.write(make_travis_yml(unique_envs)) - - print('Run unique envs locally with ') - print() - print('tox -e ' + ','.join(testenv_name(e) for e in unique_envs)) - print() - print('detox -e ' + ','.join(testenv_name(e) for e in unique_envs)) + travis_yml_file.write(make_travis_yml(default_envs)) + print ('tox.ini and .travis.yml has been generated!') if __name__ == '__main__': main() diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index f757ef304..000000000 --- a/pytest.ini +++ /dev/null @@ -1,2 +0,0 @@ -[pytest] -addopts = --ignore lib/ --ignore build/ --ignore include/ --tb=short diff --git a/pytest_django/__init__.py b/pytest_django/__init__.py index 41566c9ed..f2df444a7 100644 --- a/pytest_django/__init__.py +++ b/pytest_django/__init__.py @@ -1 +1 @@ -__version__ = '2.6.2' +__version__ = '2.8.0' diff --git a/pytest_django/client.py b/pytest_django/client.py index b67b839b0..d8e000708 100644 --- a/pytest_django/client.py +++ b/pytest_django/client.py @@ -1,6 +1,6 @@ from django.core.handlers.wsgi import WSGIRequest -from django.test.client import FakePayload from django.test.client import RequestFactory as VanillaRequestFactory +from django.test.client import FakePayload class PytestDjangoRequestFactory(VanillaRequestFactory): @@ -18,21 +18,21 @@ class PytestDjangoRequestFactory(VanillaRequestFactory): """ def request(self, **request): environ = { - 'HTTP_COOKIE': self.cookies.output(header='', sep='; '), - 'PATH_INFO': '/', - 'REMOTE_ADDR': '127.0.0.1', - 'REQUEST_METHOD': 'GET', - 'SCRIPT_NAME': '', - 'SERVER_NAME': 'testserver', - 'SERVER_PORT': '80', - 'SERVER_PROTOCOL': 'HTTP/1.1', - 'wsgi.version': (1, 0), - 'wsgi.url_scheme': 'http', - 'wsgi.input': FakePayload(''), - 'wsgi.errors': self.errors, + 'HTTP_COOKIE': self.cookies.output(header='', sep='; '), + 'PATH_INFO': str('/'), + 'REMOTE_ADDR': str('127.0.0.1'), + 'REQUEST_METHOD': str('GET'), + 'SCRIPT_NAME': str(''), + 'SERVER_NAME': str('testserver'), + 'SERVER_PORT': str('80'), + 'SERVER_PROTOCOL': str('HTTP/1.1'), + 'wsgi.version': (1, 0), + 'wsgi.url_scheme': str('http'), + 'wsgi.input': FakePayload(b''), + 'wsgi.errors': self.errors, 'wsgi.multiprocess': True, - 'wsgi.multithread': False, - 'wsgi.run_once': False, + 'wsgi.multithread': False, + 'wsgi.run_once': False, } environ.update(self.defaults) environ.update(request) diff --git a/pytest_django/compat.py b/pytest_django/compat.py index 4d24110b4..10ea9e04c 100644 --- a/pytest_django/compat.py +++ b/pytest_django/compat.py @@ -1,12 +1,15 @@ # In Django 1.6, the old test runner was deprecated, and the useful bits were -# moved out of the test runner +# moved out of the test runner. + +import pytest try: from django.test.runner import DiscoverRunner as DjangoTestRunner except ImportError: from django.test.simple import DjangoTestSuiteRunner as DjangoTestRunner -_runner = DjangoTestRunner(interactive=False) +_runner = DjangoTestRunner(verbosity=pytest.config.option.verbose, + interactive=False) try: @@ -25,10 +28,3 @@ del _runner - - -try: - from django import setup -except ImportError: - # Emulate Django 1.7 django.setup() with get_models - from django.db.models import get_models as setup diff --git a/pytest_django/db_reuse.py b/pytest_django/db_reuse.py index 714461a57..6517dd62a 100644 --- a/pytest_django/db_reuse.py +++ b/pytest_django/db_reuse.py @@ -3,26 +3,27 @@ The code in this module is heavily inspired by django-nose: https://github.com/jbalogh/django-nose/ """ +import os.path import sys import types -def is_in_memory_db(connection): - """Return whether it makes any sense to use REUSE_DB with the backend of a - connection.""" - # This is a SQLite in-memory DB. Those are created implicitly when - # you try to connect to them, so our test below doesn't work. - return connection.settings_dict['NAME'] == ':memory:' - - def test_database_exists_from_previous_run(connection): - # Check for sqlite memory databases - if is_in_memory_db(connection): - return False - # Try to open a cursor to the test database + test_db_name = connection.creation._get_test_db_name() + + # When using a real SQLite backend (via TEST_NAME), check if the file + # exists, because it gets created automatically. + if connection.settings_dict['ENGINE'] == 'django.db.backends.sqlite3': + if not os.path.exists(test_db_name): + return False + orig_db_name = connection.settings_dict['NAME'] - connection.settings_dict['NAME'] = connection.creation._get_test_db_name() + connection.settings_dict['NAME'] = test_db_name + + # With SQLite memory databases the db never exists. + if connection.settings_dict['NAME'] == ':memory:': + return False try: connection.cursor() @@ -46,13 +47,24 @@ def _monkeypatch(obj, method_name, new_method): def _get_db_name(db_settings, suffix): - if db_settings['ENGINE'] == 'django.db.backends.sqlite3': - return ':memory:' + "This provides the default test db name that Django uses." + from django import VERSION as DJANGO_VERSION + + name = None + try: + if DJANGO_VERSION > (1, 7): + name = db_settings['TEST']['NAME'] + elif DJANGO_VERSION < (1, 7): + name = db_settings['TEST_NAME'] + except KeyError: + pass + + if not name: + if db_settings['ENGINE'] == 'django.db.backends.sqlite3': + return ':memory:' + else: + name = 'test_' + db_settings['NAME'] - if db_settings.get('TEST_NAME'): - name = db_settings['TEST_NAME'] - else: - name = 'test_' + db_settings['NAME'] if suffix: name = '%s_%s' % (name, suffix) return name @@ -64,20 +76,21 @@ def monkey_patch_creation_for_db_suffix(suffix=None): if suffix is not None: def _get_test_db_name(self): """ - Internal implementation - returns the name of the test DB that will be - created. Only useful when called from create_test_db() and - _create_test_db() and when no external munging is done with the 'NAME' - or 'TEST_NAME' settings. + Internal implementation - returns the name of the test DB that will + be created. Only useful when called from create_test_db() and + _create_test_db() and when no external munging is done with the + 'NAME' or 'TEST_NAME' settings. """ db_name = _get_db_name(self.connection.settings_dict, suffix) return db_name for connection in connections.all(): - - _monkeypatch(connection.creation, '_get_test_db_name', _get_test_db_name) + _monkeypatch(connection.creation, + '_get_test_db_name', _get_test_db_name) -def create_test_db_with_reuse(self, verbosity=1, autoclobber=False): +def create_test_db_with_reuse(self, verbosity=1, autoclobber=False, + keepdb=False, serialize=False): """ This method is a monkey patched version of create_test_db that will not actually create a new database, but just reuse the @@ -106,4 +119,5 @@ def monkey_patch_creation_for_db_reuse(): for connection in connections.all(): if test_database_exists_from_previous_run(connection): - _monkeypatch(connection.creation, 'create_test_db', create_test_db_with_reuse) + _monkeypatch(connection.creation, 'create_test_db', + create_test_db_with_reuse) diff --git a/pytest_django/deprecated.py b/pytest_django/deprecated.py deleted file mode 100644 index b64051b6a..000000000 --- a/pytest_django/deprecated.py +++ /dev/null @@ -1,17 +0,0 @@ -import pytest - - -def transaction_test_case(*args, **kwargs): - raise pytest.UsageError('transaction_test_case has been deprecated: use ' - 'pytest.mark.django_db(transaction=True) ') - - -def pytest_namespace(): - def load_fixture(*args, **kwargs): - raise pytest.UsageError('pytest.load_fixture has been deprecated') - - def urls(*args, **kwargs): - raise pytest.UsageError('pytest.urls has been deprecated: use ' - 'pytest.mark.urls instead') - - return {'load_fixture': load_fixture, 'urls': urls} diff --git a/pytest_django/django_compat.py b/pytest_django/django_compat.py index 6b5eabe9a..927f4b51c 100644 --- a/pytest_django/django_compat.py +++ b/pytest_django/django_compat.py @@ -1,22 +1,17 @@ # Note that all functions here assume django is available. So ensure # this is the case before you call them. -import sys -def is_django_unittest(item): - """Returns True if the item is a Django test case, otherwise False""" +def is_django_unittest(request_or_item): + """Returns True if the request_or_item is a Django test case, otherwise False""" try: from django.test import SimpleTestCase as TestCase except ImportError: from django.test import TestCase - if not hasattr(item, 'obj'): - return False + cls = getattr(request_or_item, 'cls', None) - if sys.version_info < (3, 0): - return (hasattr(item.obj, 'im_class') and - issubclass(item.obj.im_class, TestCase)) + if cls is None: + return False - return (hasattr(item.obj, '__self__') and - hasattr(item.obj.__self__, '__class__') and - issubclass(item.obj.__self__.__class__, TestCase)) + return issubclass(cls, TestCase) diff --git a/pytest_django/fixtures.py b/pytest_django/fixtures.py index f17ef20dd..1381940d5 100644 --- a/pytest_django/fixtures.py +++ b/pytest_django/fixtures.py @@ -3,6 +3,7 @@ from __future__ import with_statement import os +import warnings import pytest @@ -10,15 +11,15 @@ from .db_reuse import (monkey_patch_creation_for_db_reuse, monkey_patch_creation_for_db_suffix) from .django_compat import is_django_unittest -from .lazy_django import skip_if_no_django +from .lazy_django import get_django_version, skip_if_no_django -__all__ = ['_django_db_setup', 'db', 'transactional_db', +__all__ = ['_django_db_setup', 'db', 'transactional_db', 'admin_user', + 'django_user_model', 'django_username_field', 'client', 'admin_client', 'rf', 'settings', 'live_server', '_live_server_helper'] -################ Internal Fixtures ################ - +# ############### Internal Fixtures ################ @pytest.fixture(scope='session') def _django_db_setup(request, @@ -28,7 +29,6 @@ def _django_db_setup(request, skip_if_no_django() from .compat import setup_databases, teardown_databases - from django.core import management # xdist if hasattr(request.config, 'slaveinput'): @@ -41,10 +41,10 @@ def _django_db_setup(request, monkey_patch_creation_for_db_suffix(db_suffix) - # Disable south's syncdb command - commands = management.get_commands() - if commands['syncdb'] == 'south': - management._commands['syncdb'] = 'django.core' + _handle_south() + + if request.config.getvalue('nomigrations'): + _disable_native_migrations() with _django_cursor_wrapper: # Monkey patch Django's setup code to support database re-use @@ -63,8 +63,89 @@ def teardown_database(): request.addfinalizer(teardown_database) -################ User visible fixtures ################ +def _django_db_fixture_helper(transactional, request, _django_cursor_wrapper): + if is_django_unittest(request): + return + + if transactional: + _django_cursor_wrapper.enable() + + def flushdb(): + """Flush the database and close database connections""" + # Django does this by default *before* each test + # instead of after. + from django.db import connections + from django.core.management import call_command + + for db in connections: + call_command('flush', verbosity=0, + interactive=False, database=db) + for conn in connections.all(): + conn.close() + + request.addfinalizer(_django_cursor_wrapper.disable) + request.addfinalizer(flushdb) + else: + if 'live_server' in request.funcargnames: + return + from django.test import TestCase + + _django_cursor_wrapper.enable() + _django_cursor_wrapper._is_transactional = False + case = TestCase(methodName='__init__') + case._pre_setup() + request.addfinalizer(_django_cursor_wrapper.disable) + request.addfinalizer(case._post_teardown) + + +def _handle_south(): + from django.conf import settings + if 'south' in settings.INSTALLED_APPS: + # Handle south. + from django.core import management + + try: + # if `south` >= 0.7.1 we can use the test helper + from south.management.commands import patch_for_test_db_setup + except ImportError: + # if `south` < 0.7.1 make sure it's migrations are disabled + management.get_commands() + management._commands['syncdb'] = 'django.core' + else: + # Monkey-patch south.hacks.django_1_0.SkipFlushCommand to load + # initial data. + # Ref: http://south.aeracode.org/ticket/1395#comment:3 + import south.hacks.django_1_0 + from django.core.management.commands.flush import ( + Command as FlushCommand) + + class SkipFlushCommand(FlushCommand): + def handle_noargs(self, **options): + # Reinstall the initial_data fixture. + from django.core.management import call_command + # `load_initial_data` got introduces with Django 1.5. + load_initial_data = options.get('load_initial_data', None) + if load_initial_data or load_initial_data is None: + # Reinstall the initial_data fixture. + call_command('loaddata', 'initial_data', **options) + # no-op to avoid calling flush + return + south.hacks.django_1_0.SkipFlushCommand = SkipFlushCommand + + patch_for_test_db_setup() + + +def _disable_native_migrations(): + from django import get_version + + if get_version() >= '1.7': + from django.conf import settings + from .migrations import DisableMigrations + + settings.MIGRATION_MODULES = DisableMigrations() + +# ############### User visible fixtures ################ @pytest.fixture(scope='function') def db(request, _django_db_setup, _django_cursor_wrapper): @@ -73,24 +154,16 @@ def db(request, _django_db_setup, _django_cursor_wrapper): This database will be setup with the default fixtures and will have the transaction management disabled. At the end of the test the transaction will be rolled back to undo any changes to the - database. This is more limited then the ``transaction_db`` + database. This is more limited than the ``transactional_db`` resource but faster. - If both this and ``transaction_db`` are requested then the - database setup will behave as only ``transaction_db`` was + If both this and ``transactional_db`` are requested then the + database setup will behave as only ``transactional_db`` was requested. """ - if ('transactional_db' not in request.funcargnames and - 'live_server' not in request.funcargnames and - not is_django_unittest(request.node)): - - from django.test import TestCase - - _django_cursor_wrapper.enable() - case = TestCase(methodName='__init__') - case._pre_setup() - request.addfinalizer(_django_cursor_wrapper.disable) - request.addfinalizer(case._post_teardown) + if 'transactional_db' in request.funcargnames: + return request.getfuncargvalue('transactional_db') + return _django_db_fixture_helper(False, request, _django_cursor_wrapper) @pytest.fixture(scope='function') @@ -98,36 +171,19 @@ def transactional_db(request, _django_db_setup, _django_cursor_wrapper): """Require a django test database with transaction support This will re-initialise the django database for each test and is - thus slower then the normal ``db`` fixture. + thus slower than the normal ``db`` fixture. If you want to use the database with transactions you must request this resource. If both this and ``db`` are requested then the - database setup will behave as only ``transaction_db`` was + database setup will behave as only ``transactional_db`` was requested. """ - if not is_django_unittest(request.node): - _django_cursor_wrapper.enable() - - def flushdb(): - """Flush the database and close database connections""" - # Django does this by default *before* each test - # instead of after. - from django.db import connections - from django.core.management import call_command - - for db in connections: - call_command('flush', verbosity=0, - interactive=False, database=db) - for conn in connections.all(): - conn.close() - - request.addfinalizer(_django_cursor_wrapper.disable) - request.addfinalizer(flushdb) + return _django_db_fixture_helper(True, request, _django_cursor_wrapper) @pytest.fixture() def client(): - """A Django test client instance""" + """A Django test client instance.""" skip_if_no_django() from django.test.client import Client @@ -136,26 +192,64 @@ def client(): @pytest.fixture() -def admin_client(db): - """A Django test client logged in as an admin user""" +def django_user_model(db): + """ + The class of Django's user model. + """ try: from django.contrib.auth import get_user_model - User = get_user_model() except ImportError: - from django.contrib.auth.models import User - from django.test.client import Client + assert get_django_version < (1, 5) + from django.contrib.auth.models import User as UserModel + else: + UserModel = get_user_model() + return UserModel + + +@pytest.fixture() +def django_username_field(django_user_model): + """ + The fieldname for the username used with Django's user model. + """ + try: + return django_user_model.USERNAME_FIELD + except AttributeError: + assert get_django_version < (1, 5) + return 'username' + + +@pytest.fixture() +def admin_user(db, django_user_model, django_username_field): + """ + A Django admin user. + + This uses an existing user with username "admin", or creates a new one with + password "password". + """ + UserModel = django_user_model + username_field = django_username_field try: - User.objects.get(username='admin') - except User.DoesNotExist: - user = User.objects.create_user('admin', 'admin@example.com', - 'password') - user.is_staff = True - user.is_superuser = True - user.save() + user = UserModel._default_manager.get(**{username_field: 'admin'}) + except UserModel.DoesNotExist: + extra_fields = {} + if username_field != 'username': + extra_fields[username_field] = 'admin' + user = UserModel._default_manager.create_superuser( + 'admin', 'admin@example.com', 'password', **extra_fields) + return user + + +@pytest.fixture() +def admin_client(db, admin_user): + """ + A Django test client logged in as an admin user (via the ``admin_user`` + fixture). + """ + from django.test.client import Client client = Client() - client.login(username='admin', password='password') + client.login(username=admin_user.username, password='password') return client @@ -211,11 +305,21 @@ def live_server(request): the other way around) transactional database access will be needed as data inside a transaction is not shared between the live server and test code. + + Static assets will be served for all versions of Django. + Except for django >= 1.7, if ``django.contrib.staticfiles`` is not + installed. """ skip_if_no_django() addr = request.config.getvalue('liveserver') + if not addr: + addr = os.getenv('DJANGO_LIVE_TEST_SERVER_ADDRESS') if not addr: addr = os.getenv('DJANGO_TEST_LIVE_SERVER_ADDRESS') + if addr: + warnings.warn('Please use DJANGO_LIVE_TEST_SERVER_ADDRESS' + ' instead of DJANGO_TEST_LIVE_SERVER_ADDRESS.', + DeprecationWarning) if not addr: addr = 'localhost:8081,8100-8200' server = live_server_helper.LiveServer(addr) diff --git a/pytest_django/lazy_django.py b/pytest_django/lazy_django.py index 72b82c959..f68993512 100644 --- a/pytest_django/lazy_django.py +++ b/pytest_django/lazy_django.py @@ -4,6 +4,7 @@ import os import sys + import pytest @@ -14,8 +15,17 @@ def skip_if_no_django(): def django_settings_is_configured(): - if 'django' in sys.modules or os.environ.get('DJANGO_SETTINGS_MODULE'): - from django.conf import settings - return settings.configured - else: + # Avoid importing Django if it has not yet been imported + if not os.environ.get('DJANGO_SETTINGS_MODULE') \ + and 'django' not in sys.modules: return False + + # If DJANGO_SETTINGS_MODULE is defined at this point, Django is assumed to + # always be loaded. + from django.conf import settings + assert settings.configured is True + return True + + +def get_django_version(): + return __import__('django').VERSION diff --git a/pytest_django/live_server_helper.py b/pytest_django/live_server_helper.py index ed03a1a40..3d64c2b4b 100644 --- a/pytest_django/live_server_helper.py +++ b/pytest_django/live_server_helper.py @@ -1,6 +1,9 @@ import sys + import pytest +from .lazy_django import get_django_version + def supported(): import django.test.testcases @@ -33,16 +36,24 @@ def __init__(self, addr): conn.allow_thread_sharing = True connections_override[conn.alias] = conn - try: - from django.test.testcases import _StaticFilesHandler - static_handler_kwargs = {'static_handler': _StaticFilesHandler} - except ImportError: - static_handler_kwargs = {} + liveserver_kwargs = {'connections_override': connections_override} + from django.conf import settings + if ('django.contrib.staticfiles' in settings.INSTALLED_APPS and + get_django_version() >= (1, 7)): + from django.contrib.staticfiles.handlers import ( + StaticFilesHandler) + liveserver_kwargs['static_handler'] = StaticFilesHandler + else: + try: + from django.test.testcases import _StaticFilesHandler + except ImportError: + pass + else: + liveserver_kwargs['static_handler'] = _StaticFilesHandler host, possible_ports = parse_addr(addr) self.thread = LiveServerThread(host, possible_ports, - connections_override=connections_override, - **static_handler_kwargs) + **liveserver_kwargs) self.thread.daemon = True self.thread.start() self.thread.is_ready.wait() @@ -66,7 +77,7 @@ def __unicode__(self): return self.url def __add__(self, other): - return unicode(self) + other + return unicode(self) + other # noqa: pyflakes on python3 else: def __str__(self): return self.url @@ -92,7 +103,7 @@ def parse_addr(specified_address): for port_range in port_ranges.split(','): # A port range can be of either form: '8000' or '8000-8010'. extremes = list(map(int, port_range.split('-'))) - assert len(extremes) in [1, 2] + assert len(extremes) in (1, 2) if len(extremes) == 1: # Port range of the form '8000' possible_ports.append(extremes[0]) @@ -104,4 +115,4 @@ def parse_addr(specified_address): raise Exception( 'Invalid address ("%s") for live server.' % specified_address) - return (host, possible_ports) + return host, possible_ports diff --git a/pytest_django/migrations.py b/pytest_django/migrations.py new file mode 100644 index 000000000..6c4d72648 --- /dev/null +++ b/pytest_django/migrations.py @@ -0,0 +1,8 @@ +# code snippet copied from https://gist.github.com/NotSqrt/5f3c76cd15e40ef62d09 +class DisableMigrations(object): + + def __contains__(self, item): + return True + + def __getitem__(self, item): + return "notmigrations" diff --git a/pytest_django/plugin.py b/pytest_django/plugin.py index 08c45a8dc..96ecb2c25 100644 --- a/pytest_django/plugin.py +++ b/pytest_django/plugin.py @@ -1,32 +1,34 @@ """A py.test plugin which helps testing Django applications This plugin handles creating and destroying the test environment and -test database and provides some useful text fixtues. +test database and provides some useful text fixtures. """ import os -import sys + +import contextlib import pytest +import types from .django_compat import is_django_unittest -from .fixtures import (_django_db_setup, db, transactional_db, client, - admin_client, rf, settings, live_server, - _live_server_helper) - -from .lazy_django import skip_if_no_django, django_settings_is_configured +from .fixtures import (_django_db_setup, _live_server_helper, admin_client, + admin_user, client, db, django_user_model, + django_username_field, live_server, rf, settings, + transactional_db) +from .lazy_django import django_settings_is_configured, skip_if_no_django - -(_django_db_setup, db, transactional_db, client, admin_client, rf, - settings, live_server, _live_server_helper) +# Silence linters for imported fixtures. +(_django_db_setup, _live_server_helper, admin_client, admin_user, client, db, + django_user_model, django_username_field, live_server, rf, settings, + transactional_db) SETTINGS_MODULE_ENV = 'DJANGO_SETTINGS_MODULE' CONFIGURATION_ENV = 'DJANGO_CONFIGURATION' -################ pytest hooks ################ - +# ############### pytest hooks ################ def pytest_addoption(parser): group = parser.getgroup('django') @@ -48,6 +50,9 @@ def pytest_addoption(parser): group._addoption('--dc', action='store', type='string', dest='dc', default=None, help='Set DJANGO_CONFIGURATION.') + group._addoption('--nomigrations', + action='store_true', dest='nomigrations', default=False, + help='Disable Django 1.7 migrations on test setup') parser.addini(CONFIGURATION_ENV, 'django-configurations class to use by pytest-django.') group._addoption('--liveserver', default=None, @@ -55,16 +60,129 @@ def pytest_addoption(parser): parser.addini(SETTINGS_MODULE_ENV, 'Django settings module to use by pytest-django.') + parser.addini('django_find_project', + 'Automatically find and add a Django project to the ' + 'Python path.', + default=True) + +import py +import sys + + +def _exists(path, ignore=EnvironmentError): + try: + return path.check() + except ignore: + return False + + +PROJECT_FOUND = ('pytest-django found a Django project in %s ' + '(it contains manage.py) and added it to the Python path.\n' + 'If this is wrong, add "django_find_project = false" to ' + 'pytest.ini and expliclity manage your Python path.') + +PROJECT_NOT_FOUND = ('pytest-django could not find a Django project ' + '(no manage.py file could be found). You must ' + 'expliclity add your Django project to the Python path ' + 'to have it picked up.') + +PROJECT_SCAN_DISABLED = ('pytest-django did not search for Django ' + 'projects since it is disabled in the configuration ' + '("django_find_project = false")') + + +@contextlib.contextmanager +def _handle_import_error(extra_message): + try: + yield + except ImportError as e: + django_msg = (e.args[0] + '\n\n') if e.args else '' + msg = django_msg + extra_message + raise ImportError(msg) + + +def _add_django_project_to_path(args): + args = [x for x in args if not str(x).startswith("-")] + + if not args: + args = [py.path.local()] + + for arg in args: + arg = py.path.local(arg) + + for base in arg.parts(reverse=True): + manage_py_try = base.join('manage.py') + + if _exists(manage_py_try): + sys.path.insert(0, str(base)) + return PROJECT_FOUND % base + + return PROJECT_NOT_FOUND + + +def _setup_django(): + import django + + if hasattr(django, 'setup'): + django.setup() + else: + # Emulate Django 1.7 django.setup() with get_models + from django.db.models import get_models + + get_models() + + +def _parse_django_find_project_ini(x): + if x in (True, False): + return x + + x = x.lower() + possible_values = {'true': True, + 'false': False, + '1': True, + '0': False} + + try: + return possible_values[x] + except KeyError: + raise ValueError('%s is not a valid value for django_find_project. ' + 'It must be one of %s.' + % (x, ', '.join(possible_values.keys()))) + + +def pytest_load_initial_conftests(early_config, parser, args): + # Register the marks + early_config.addinivalue_line( + 'markers', + 'django_db(transaction=False): Mark the test as using ' + 'the django test database. The *transaction* argument marks will ' + "allow you to use real transactions in the test like Django's " + 'TransactionTestCase.') + early_config.addinivalue_line( + 'markers', + 'urls(modstr): Use a different URLconf for this test, similar to ' + 'the `urls` attribute of Django `TestCase` objects. *modstr* is ' + 'a string specifying the module of a URL config, e.g. ' + '"my_app.test_urls".') + + options = parser.parse_known_args(args) + + django_find_project = _parse_django_find_project_ini( + early_config.getini('django_find_project')) + + if django_find_project: + _django_project_scan_outcome = _add_django_project_to_path(args) + else: + _django_project_scan_outcome = PROJECT_SCAN_DISABLED -def _load_settings(config, options): # Configure DJANGO_SETTINGS_MODULE ds = (options.ds or - config.getini(SETTINGS_MODULE_ENV) or + early_config.getini(SETTINGS_MODULE_ENV) or os.environ.get(SETTINGS_MODULE_ENV)) # Configure DJANGO_CONFIGURATION dc = (options.dc or - config.getini(CONFIGURATION_ENV) or + early_config.getini(CONFIGURATION_ENV) or os.environ.get(CONFIGURATION_ENV)) if ds: @@ -77,39 +195,35 @@ def _load_settings(config, options): import configurations.importer configurations.importer.install() + # Forcefully load django settings, throws ImportError or + # ImproperlyConfigured if settings cannot be loaded. from django.conf import settings - try: + + with _handle_import_error(_django_project_scan_outcome): settings.DATABASES - except ImportError: - e = sys.exc_info()[1] - raise pytest.UsageError(*e.args) + _setup_django() -if pytest.__version__[:3] >= "2.4": - def pytest_load_initial_conftests(early_config, parser, args): - _load_settings(early_config, parser.parse_known_args(args)) +@pytest.mark.trylast +def pytest_configure(): + if django_settings_is_configured(): + _setup_django() -def pytest_configure(config): - # Register the marks - config.addinivalue_line( - 'markers', - 'django_db(transaction=False): Mark the test as using ' - 'the django test database. The *transaction* argument marks will ' - "allow you to use real transactions in the test like Django's " - 'TransactionTestCase.') - config.addinivalue_line( - 'markers', - 'urls(modstr): Use a different URLconf for this test, similar to ' - 'the `urls` attribute of Django `TestCase` objects. *modstr* is ' - 'a string specifying the module of a URL config, e.g. ' - '"my_app.test_urls".') - if pytest.__version__[:3] < "2.4": - _load_settings(config, config.option) +def pytest_runtest_setup(item): + if django_settings_is_configured() and is_django_unittest(item): + cls = item.cls -################ Autouse fixtures ################ + if hasattr(cls, '__real_setUpClass'): + return + + cls.__real_setUpClass = cls.setUpClass + cls.__real_tearDownClass = cls.tearDownClass + + cls.setUpClass = types.MethodType(lambda cls: None, cls) + cls.tearDownClass = types.MethodType(lambda cls: None, cls) @pytest.fixture(autouse=True, scope='session') @@ -126,11 +240,8 @@ def _django_test_environment(request): """ if django_settings_is_configured(): from django.conf import settings - from .compat import (setup, setup_test_environment, - teardown_test_environment) + from .compat import setup_test_environment, teardown_test_environment settings.DEBUG = False - setup() - setup_test_environment() request.addfinalizer(teardown_test_environment) @@ -143,20 +254,20 @@ def _django_cursor_wrapper(request): returned has a .enable() and a .disable() method which can be used to temporarily enable database access. """ - if django_settings_is_configured(): - - # util -> utils rename in Django 1.7 - try: - import django.db.backends.utils - utils_module = django.db.backends.utils - except ImportError: - import django.db.backends.util - utils_module = django.db.backends.util - - manager = CursorManager(utils_module) - manager.disable() - else: - manager = CursorManager() + if not django_settings_is_configured(): + return None + + # util -> utils rename in Django 1.7 + try: + import django.db.backends.utils + utils_module = django.db.backends.utils + except ImportError: + import django.db.backends.util + utils_module = django.db.backends.util + + manager = CursorManager(utils_module) + manager.disable() + request.addfinalizer(manager.restore) return manager @@ -176,14 +287,21 @@ def _django_db_marker(request): request.getfuncargvalue('db') -@pytest.fixture(autouse=True) +@pytest.fixture(autouse=True, scope='class') def _django_setup_unittest(request, _django_cursor_wrapper): """Setup a django unittest, internal to pytest-django""" - if django_settings_is_configured() and is_django_unittest(request.node): + if django_settings_is_configured() and is_django_unittest(request): request.getfuncargvalue('_django_test_environment') request.getfuncargvalue('_django_db_setup') + _django_cursor_wrapper.enable() - request.addfinalizer(_django_cursor_wrapper.disable) + request.node.cls.__real_setUpClass() + + def teardown(): + request.node.cls.__real_tearDownClass() + _django_cursor_wrapper.restore() + + request.addfinalizer(teardown) @pytest.fixture(autouse=True, scope='function') @@ -214,7 +332,7 @@ def restore(): request.addfinalizer(restore) -################ Helper Functions ################ +# ############### Helper Functions ################ class CursorManager(object): @@ -226,10 +344,13 @@ class CursorManager(object): no-op. """ - def __init__(self, dbutil=None): + def __init__(self, dbutil): self._dbutil = dbutil - if dbutil: - self._orig_wrapper = dbutil.CursorWrapper + self._history = [] + self._real_wrapper = dbutil.CursorWrapper + + def _save_active_wrapper(self): + return self._history.append(self._dbutil.CursorWrapper) def _blocking_wrapper(*args, **kwargs): __tracebackhide__ = True @@ -239,18 +360,21 @@ def _blocking_wrapper(*args, **kwargs): def enable(self): """Enable access to the django database""" - if self._dbutil: - self._dbutil.CursorWrapper = self._orig_wrapper + self._save_active_wrapper() + self._dbutil.CursorWrapper = self._real_wrapper def disable(self): - if self._dbutil: - self._dbutil.CursorWrapper = self._blocking_wrapper + self._save_active_wrapper() + self._dbutil.CursorWrapper = self._blocking_wrapper + + def restore(self): + self._dbutil.CursorWrapper = self._history.pop() def __enter__(self): self.enable() def __exit__(self, exc_type, exc_value, traceback): - self.disable() + self.restore() def validate_django_db(marker): diff --git a/tests/__init__.py b/pytest_django_test/__init__.py similarity index 100% rename from tests/__init__.py rename to pytest_django_test/__init__.py diff --git a/tests/app/__init__.py b/pytest_django_test/app/__init__.py similarity index 100% rename from tests/app/__init__.py rename to pytest_django_test/app/__init__.py diff --git a/tests/app/fixtures/items.json b/pytest_django_test/app/fixtures/items.json similarity index 100% rename from tests/app/fixtures/items.json rename to pytest_django_test/app/fixtures/items.json diff --git a/tests/app/models.py b/pytest_django_test/app/models.py similarity index 100% rename from tests/app/models.py rename to pytest_django_test/app/models.py diff --git a/pytest_django_test/app/static/a_file.txt b/pytest_django_test/app/static/a_file.txt new file mode 100644 index 000000000..a7f8d9e5d --- /dev/null +++ b/pytest_django_test/app/static/a_file.txt @@ -0,0 +1 @@ +bla diff --git a/tests/views.py b/pytest_django_test/app/views.py similarity index 73% rename from tests/views.py rename to pytest_django_test/app/views.py index 78b0a8fd2..d6d5bacb2 100644 --- a/tests/views.py +++ b/pytest_django_test/app/views.py @@ -2,8 +2,14 @@ from django.template import Template from django.template.context import Context +from .models import Item + def admin_required_view(request): if request.user.is_staff: return HttpResponse(Template('You are an admin').render(Context())) return HttpResponse(Template('Access denied').render(Context())) + + +def item_count(request): + return HttpResponse('Item count: %d' % Item.objects.count()) diff --git a/tests/compat.py b/pytest_django_test/compat.py similarity index 62% rename from tests/compat.py rename to pytest_django_test/compat.py index 99473464b..4ec3cdcb8 100644 --- a/tests/compat.py +++ b/pytest_django_test/compat.py @@ -5,6 +5,6 @@ try: - from urllib2 import urlopen # noqa + from urllib2 import urlopen, HTTPError # noqa except ImportError: - from urllib.request import urlopen # noqa + from urllib.request import urlopen, HTTPError # noqa diff --git a/tests/db_helpers.py b/pytest_django_test/db_helpers.py similarity index 61% rename from tests/db_helpers.py rename to pytest_django_test/db_helpers.py index fdb8d7a22..3e91eb2b3 100644 --- a/tests/db_helpers.py +++ b/pytest_django_test/db_helpers.py @@ -1,12 +1,22 @@ +import os import subprocess + import pytest +from django.conf import settings +from django.db import connection +from django.db import transaction + from .compat import force_text +from .app.models import Item -from django.conf import settings -DB_NAME = settings.DATABASES['default']['NAME'] + '_db_test' -TEST_DB_NAME = 'test_' + DB_NAME +DB_NAME = settings.DATABASES['default']['NAME'] +if DB_NAME == ':memory:': + TEST_DB_NAME = DB_NAME +else: + DB_NAME += '_db_test' + TEST_DB_NAME = 'test_' + DB_NAME def get_db_engine(): @@ -37,12 +47,14 @@ def run_mysql(*args): return run_cmd(*args) -def skip_if_sqlite(): +def skip_if_sqlite_in_memory(): from django.conf import settings - if settings.DATABASES['default']['ENGINE'] == 'django.db.backends.sqlite3': + if settings.DATABASES['default']['ENGINE'] == 'django.db.backends.sqlite3' \ + and settings.DATABASES['default']['NAME'] == ':memory:': pytest.skip('Do not test db reuse since database does not support it') + def create_empty_production_database(): drop_database(name=DB_NAME) @@ -59,6 +71,13 @@ def create_empty_production_database(): 'database exists' in force_text(r.std_err)) return + if get_db_engine() == 'sqlite3': + if DB_NAME == ':memory:': + raise AssertionError( + 'sqlite in-memory database must not be created!') + open(DB_NAME, 'a').close() + return + raise AssertionError('%s cannot be tested properly' % get_db_engine()) @@ -80,6 +99,14 @@ def drop_database(name=TEST_DB_NAME, suffix=None): or r.status_code == 0) return + if get_db_engine() == 'sqlite3': + if name == ':memory:': + raise AssertionError( + 'sqlite in-memory database cannot be dropped!') + if os.path.exists(name): + os.unlink(name) + return + raise AssertionError('%s cannot be tested properly!' % get_db_engine()) @@ -97,6 +124,12 @@ def db_exists(db_suffix=None): r = run_mysql(name, '-e', 'SELECT 1') return r.status_code == 0 + if get_db_engine() == 'sqlite3': + if TEST_DB_NAME == ':memory:': + raise AssertionError( + 'sqlite in-memory database cannot be checked for existence!') + return os.path.exists(name) + raise AssertionError('%s cannot be tested properly!' % get_db_engine()) @@ -111,6 +144,14 @@ def mark_database(): assert r.status_code == 0 return + if get_db_engine() == 'sqlite3': + if TEST_DB_NAME == ':memory:': + raise AssertionError('sqlite in-memory database cannot be marked!') + r = run_cmd('sqlite3', TEST_DB_NAME, + 'CREATE TABLE mark_table(kaka int);') + assert r.status_code == 0 + return + raise AssertionError('%s cannot be tested properly!' % get_db_engine()) @@ -126,4 +167,36 @@ def mark_exists(): return r.status_code == 0 + if get_db_engine() == 'sqlite3': + if TEST_DB_NAME == ':memory:': + raise AssertionError( + 'sqlite in-memory database cannot be checked for mark!') + r = run_cmd('sqlite3', TEST_DB_NAME, 'SELECT 1 FROM mark_table') + + return r.status_code == 0 + raise AssertionError('%s cannot be tested properly!' % get_db_engine()) + + +def noop_transactions(): + """Test whether transactions are disabled. + + Return True if transactions are disabled, False if they are + enabled. + """ + + # Newer versions of Django simply run standard tests in an atomic block. + if hasattr(connection, 'in_atomic_block'): + return connection.in_atomic_block + else: + with transaction.commit_manually(): + Item.objects.create(name='transaction_noop_test') + transaction.rollback() + + try: + item = Item.objects.get(name='transaction_noop_test') + except Item.DoesNotExist: + return False + else: + item.delete() + return True diff --git a/tests/settings_base.py b/pytest_django_test/settings_base.py similarity index 54% rename from tests/settings_base.py rename to pytest_django_test/settings_base.py index dcfd60309..501d9cfd2 100644 --- a/tests/settings_base.py +++ b/pytest_django_test/settings_base.py @@ -1,12 +1,12 @@ import os -ROOT_URLCONF = 'tests.urls' +ROOT_URLCONF = 'pytest_django_test.urls' INSTALLED_APPS = [ 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', - 'tests.app', + 'pytest_django_test.app', ] STATIC_URL = '/static/' @@ -22,3 +22,11 @@ db_suffix = '_%s' % uid else: db_suffix = '' + +MIDDLEWARE_CLASSES = ( + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', +) diff --git a/tests/settings_mysql_innodb.py b/pytest_django_test/settings_mysql_innodb.py similarity index 86% rename from tests/settings_mysql_innodb.py rename to pytest_django_test/settings_mysql_innodb.py index e89f95bea..477cb4b9c 100644 --- a/tests/settings_mysql_innodb.py +++ b/pytest_django_test/settings_mysql_innodb.py @@ -1,4 +1,4 @@ -from tests.settings_base import * # noqa +from .settings_base import * # noqa DATABASES = { 'default': { diff --git a/tests/settings_mysql_myisam.py b/pytest_django_test/settings_mysql_myisam.py similarity index 83% rename from tests/settings_mysql_myisam.py rename to pytest_django_test/settings_mysql_myisam.py index b40363dd2..fceb4f790 100644 --- a/tests/settings_mysql_myisam.py +++ b/pytest_django_test/settings_mysql_myisam.py @@ -1,4 +1,4 @@ -from tests.settings_base import * # noqa +from pytest_django_test.settings_base import * # noqa DATABASES = { 'default': { diff --git a/tests/settings_postgres.py b/pytest_django_test/settings_postgres.py similarity index 84% rename from tests/settings_postgres.py rename to pytest_django_test/settings_postgres.py index 353246130..53dc1d2d4 100644 --- a/tests/settings_postgres.py +++ b/pytest_django_test/settings_postgres.py @@ -1,4 +1,4 @@ -from tests.settings_base import * # noqa +from pytest_django_test.settings_base import * # noqa # PyPy compatibility try: diff --git a/tests/settings_sqlite.py b/pytest_django_test/settings_sqlite.py similarity index 73% rename from tests/settings_sqlite.py rename to pytest_django_test/settings_sqlite.py index d1f5de6f9..cf593decc 100644 --- a/tests/settings_sqlite.py +++ b/pytest_django_test/settings_sqlite.py @@ -1,4 +1,4 @@ -from tests.settings_base import * # noqa +from .settings_base import * # noqa DATABASES = { 'default': { diff --git a/pytest_django_test/settings_sqlite_file.py b/pytest_django_test/settings_sqlite_file.py new file mode 100644 index 000000000..b5ec08634 --- /dev/null +++ b/pytest_django_test/settings_sqlite_file.py @@ -0,0 +1,19 @@ +from pytest_django_test.settings_base import * # noqa + +# This is a SQLite configuration, which uses a file based database for +# tests (via setting TEST_NAME / TEST['NAME']). + +# The name as expected / used by Django/pytest_django (tests/db_helpers.py). +db_name = 'DBNAME_pytest_django_db' + db_suffix +test_db_name = 'test_' + db_name + '_db_test' + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': db_name, + # # Django > (1, 7) + 'TEST': {'NAME': test_db_name}, + # # Django < (1, 7) + 'TEST_NAME': test_db_name, + }, +} diff --git a/tests/urls.py b/pytest_django_test/urls.py similarity index 55% rename from tests/urls.py rename to pytest_django_test/urls.py index 4bea0a03d..3b622a695 100644 --- a/tests/urls.py +++ b/pytest_django_test/urls.py @@ -5,5 +5,6 @@ urlpatterns = patterns( '', - (r'admin-required/', 'tests.views.admin_required_view'), + (r'^item_count/$', 'pytest_django_test.app.views.item_count'), + (r'^admin-required/$', 'pytest_django_test.app.views.admin_required_view'), ) diff --git a/tests/urls_overridden.py b/pytest_django_test/urls_overridden.py similarity index 100% rename from tests/urls_overridden.py rename to pytest_django_test/urls_overridden.py diff --git a/requirements.txt b/requirements.txt index 0e31f42fa..e03faf4a3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,5 @@ pytest-xdist tox wheel twine +south +isort diff --git a/setup.cfg b/setup.cfg index 5e4090017..9c4bcba53 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,2 +1,19 @@ +[pytest] +# --strict: warnings become errors. +# -r fEsxXw: show extra test summary info for everything. +addopts = --ignore lib/ --ignore build/ --ignore include/ --ignore local/ --ignore src/ --strict -r fEsxXw +DJANGO_SETTINGS_MODULE = pytest_django_test.settings_sqlite + [wheel] universal = 1 + +[flake8] +# Ref: http://flake8.readthedocs.org/en/latest/warnings.html#error-codes +ignore = NONE +# Default, if empty: +# ignore = E123,E133,E226,E241,E242 +max-line-length = 99 + +[isort] +# NOTE: local imports are handled special (they do not get handled as "tests"). +forced_separate=tests,pytest_django,pytest_django_test diff --git a/setup.py b/setup.py index 1854211ca..30b30e119 100755 --- a/setup.py +++ b/setup.py @@ -1,8 +1,9 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -import os import codecs +import os + from setuptools import setup @@ -26,7 +27,7 @@ def read(fname): url='http://pytest-django.readthedocs.org/', packages=['pytest_django'], long_description=read('README.rst'), - install_requires=['pytest>=2.3.4'], + install_requires=['pytest>=2.5'], classifiers=['Development Status :: 5 - Production/Stable', 'Framework :: Django', 'Intended Audience :: Developers', @@ -34,11 +35,11 @@ def read(fname): 'Operating System :: OS Independent', 'Programming Language :: Python', 'Topic :: Software Development :: Testing', - 'Programming Language :: Python :: 2.5', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', ], # the following makes a plugin available to py.test entry_points={'pytest11': ['django = pytest_django.plugin']}) diff --git a/tests/conftest.py b/tests/conftest.py index c80977a2e..992138fd9 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,27 +1,45 @@ -import pytest -import py - -import shutil import copy +import shutil from textwrap import dedent +import py +import pytest +from django.conf import settings + +from pytest_django_test.db_helpers import (create_empty_production_database, + DB_NAME, get_db_engine) pytest_plugins = 'pytester' -TESTS_DIR = py.path.local(__file__) +REPOSITORY_ROOT = py.path.local(__file__).join('..') -from django.conf import settings +def pytest_configure(config): + config.addinivalue_line( + 'markers', + 'django_project: options for the django_testdir fixture') -from .db_helpers import (create_empty_production_database, get_db_engine, - DB_NAME) +def _marker_apifun(extra_settings='', + create_manage_py=False, + project_root=None): + return { + 'extra_settings': extra_settings, + 'create_manage_py': create_manage_py, + 'project_root': project_root, + } @pytest.fixture(scope='function') def django_testdir(request, testdir, monkeypatch): - if get_db_engine() in ('mysql', 'postgresql_psycopg2'): - # Django requires the production database to exists.. + marker = request.node.get_marker('django_project') + + options = _marker_apifun(**(marker.kwargs if marker else {})) + + db_engine = get_db_engine() + if db_engine in ('mysql', 'postgresql_psycopg2') \ + or (db_engine == 'sqlite3' and DB_NAME != ':memory:'): + # Django requires the production database to exist. create_empty_production_database() if hasattr(request.node.cls, 'db_settings'): @@ -45,26 +63,64 @@ def django_testdir(request, testdir, monkeypatch): 'tpkg.app', ] SECRET_KEY = 'foobar' - ''') % {'db_settings': repr(db_settings)} + SITE_ID = 1234 # Needed for 1.3 compatibility + + MIDDLEWARE_CLASSES = ( + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + ) + + %(extra_settings)s + ''') % { + 'db_settings': repr(db_settings), + 'extra_settings': dedent(options['extra_settings'])} + + if options['project_root']: + project_root = testdir.mkdir(options['project_root']) + else: + project_root = testdir.tmpdir + + tpkg_path = project_root.mkdir('tpkg') + + if options['create_manage_py']: + project_root.ensure('manage.py') - tpkg_path = testdir.mkpydir('tpkg') - app_source = TESTS_DIR.dirpath('app') + tpkg_path.ensure('__init__.py') + + app_source = REPOSITORY_ROOT.dirpath('pytest_django_test/app') + test_app_path = tpkg_path.join('app') # Copy the test app to make it available in the new test run shutil.copytree(py.builtin._totext(app_source), - py.builtin._totext(tpkg_path.join('app'))) - tpkg_path.join("db_test_settings.py").write(test_settings) + py.builtin._totext(test_app_path)) + tpkg_path.join("the_settings.py").write(test_settings) - monkeypatch.setenv('DJANGO_SETTINGS_MODULE', 'tpkg.db_test_settings') + monkeypatch.setenv('DJANGO_SETTINGS_MODULE', 'tpkg.the_settings') def create_test_module(test_code, filename='test_the_test.py'): - tpkg_path = testdir.tmpdir / 'tpkg' - tpkg_path.join(filename).write(dedent(test_code)) + tpkg_path.join(filename).write(dedent(test_code), ensure=True) - def create_conftest(testdir, conftest_code): - return create_test_module(testdir, conftest_code, 'conftest.py') + def create_app_file(code, filename): + test_app_path.join(filename).write(dedent(code), ensure=True) testdir.create_test_module = create_test_module - testdir.create_conftest = create_conftest + testdir.create_app_file = create_app_file + testdir.project_root = project_root return testdir + + +@pytest.fixture +def django_testdir_initial(django_testdir): + """A django_testdir fixture which provides initial_data.""" + django_testdir.makefile('.json', initial_data=""" + [{ + "pk": 1, + "model": "app.item", + "fields": { "name": "mark_initial_data" } + }]""") + + return django_testdir diff --git a/tests/test_database.py b/tests/test_database.py index d414e2433..e041d5ffb 100644 --- a/tests/test_database.py +++ b/tests/test_database.py @@ -1,21 +1,20 @@ from __future__ import with_statement -from django.db import transaction, connection -from django.test.testcases import connections_support_transactions - import pytest +from django.db import connection, transaction +from django.test.testcases import connections_support_transactions -from .app.models import Item +from pytest_django_test.app.models import Item def noop_transactions(): - """Test whether transactions are disabled + """Test whether transactions are disabled. Return True if transactions are disabled, False if they are enabled. """ - # Newer versions of Django simply runs standard tests in an atomic block. + # Newer versions of Django simply run standard tests in an atomic block. if hasattr(connection, 'in_atomic_block'): return connection.in_atomic_block else: @@ -96,7 +95,7 @@ def test_mydb(self, mydb): def test_fixture_clean(self, both_dbs): # Relies on the order: test_mydb created an object - # See https://github.com/pelme/pytest_django/issues/17 + # See https://github.com/pytest-dev/pytest-django/issues/17 assert Item.objects.count() == 0 @pytest.fixture @@ -109,6 +108,28 @@ def test_fin(self, fin): pass +class TestDatabaseFixturesBothOrder: + @pytest.fixture + def fixture_with_db(self, db): + Item.objects.create(name='spam') + + @pytest.fixture + def fixture_with_transdb(self, transactional_db): + Item.objects.create(name='spam') + + def test_trans(self, fixture_with_transdb): + pass + + def test_db(self, fixture_with_db): + pass + + def test_db_trans(self, fixture_with_db, fixture_with_transdb): + pass + + def test_trans_db(self, fixture_with_transdb, fixture_with_db): + pass + + class TestDatabaseMarker: @pytest.mark.django_db diff --git a/tests/test_db_name.py b/tests/test_db_name.py index 1f3fec1da..fb303e09b 100644 --- a/tests/test_db_name.py +++ b/tests/test_db_name.py @@ -1,5 +1,7 @@ # coding: utf-8 +from django import VERSION as DJANGO_VERSION + from pytest_django.db_reuse import _get_db_name @@ -15,13 +17,34 @@ def test_name(): assert _get_db_name(db_settings, 'abc') == 'test_pytest_django_abc' +def test_name_sqlite(): + db_settings = { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': 'pytest_django', + 'HOST': 'localhost', + 'USER': '', + } + assert _get_db_name(db_settings, None) == ':memory:' + assert _get_db_name(db_settings, 'abc') == ':memory:' + + if DJANGO_VERSION > (1, 7): + db_settings['TEST'] = {'NAME': 'custom_test_db'} + else: + db_settings['TEST_NAME'] = 'custom_test_db' + assert _get_db_name(db_settings, None) == 'custom_test_db' + assert _get_db_name(db_settings, 'abc') == 'custom_test_db_abc' + + def test_testname(): db_settings = { 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME': 'pytest_django', - 'TEST_NAME': 'test123', 'HOST': 'localhost', 'USER': '', } + if DJANGO_VERSION > (1, 7): + db_settings['TEST'] = {'NAME': 'test123'} + else: + db_settings['TEST_NAME'] = 'test123' assert _get_db_name(db_settings, None) == 'test123' assert _get_db_name(db_settings, 'abc') == 'test123_abc' diff --git a/tests/test_db_setup.py b/tests/test_db_setup.py index e98d99ee3..b6a3c97b6 100644 --- a/tests/test_db_setup.py +++ b/tests/test_db_setup.py @@ -2,20 +2,40 @@ import pytest -from .db_helpers import mark_exists, mark_database, drop_database, db_exists, skip_if_sqlite - +from pytest_django.lazy_django import get_django_version +from pytest_django_test.db_helpers import (db_exists, drop_database, + mark_database, mark_exists, + skip_if_sqlite_in_memory) skip_on_python32 = pytest.mark.skipif(sys.version_info[:2] == (3, 2), reason='xdist is flaky with Python 3.2') +def test_db_reuse_simple(django_testdir): + "A test for all backends to check that `--reuse-db` works." + django_testdir.create_test_module(''' + import pytest + + from .app.models import Item + + @pytest.mark.django_db + def test_db_can_be_accessed(): + assert Item.objects.count() == 0 + ''') + + result = django_testdir.runpytest('-v', '--reuse-db') + result.stdout.fnmatch_lines([ + "*test_db_can_be_accessed PASSED*", + ]) + + def test_db_reuse(django_testdir): """ Test the re-use db functionality. This test requires a PostgreSQL server to be available and the environment variables PG_HOST, PG_DB, PG_USER to be defined. """ - skip_if_sqlite() + skip_if_sqlite_in_memory() django_testdir.create_test_module(''' import pytest @@ -61,9 +81,47 @@ def test_db_can_be_accessed(): assert not mark_exists() +class TestSqlite: + + db_name_17 = 'test_db_name_django17' + db_name_before_17 = 'test_db_name_before_django17' + + db_settings = {'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': 'db_name', + }} + from django import VERSION + if VERSION > (1, 7): + db_settings['default']['TEST'] = {'NAME': db_name_17} + else: + db_settings['default']['TEST_NAME'] = db_name_before_17 + + def test_sqlite_test_name_used(self, django_testdir): + + django_testdir.create_test_module(''' + import pytest + from django.db import connections + from django import VERSION + + @pytest.mark.django_db + def test_a(): + (conn, ) = connections.all() + + assert conn.vendor == 'sqlite' + print(conn.settings_dict) + if VERSION > (1,7): + assert conn.settings_dict['NAME'] == '%s' + else: + assert conn.settings_dict['NAME'] == '%s' + ''' % (self.db_name_17, self.db_name_before_17)) + + result = django_testdir.runpytest('--tb=short', '-v') + result.stdout.fnmatch_lines(['*test_a*PASSED*']) + + @skip_on_python32 def test_xdist_with_reuse(django_testdir): - skip_if_sqlite() + skip_if_sqlite_in_memory() drop_database('gw0') drop_database('gw1') @@ -91,11 +149,21 @@ def test_a(settings): @pytest.mark.django_db def test_b(settings): _check(settings) + + @pytest.mark.django_db + def test_c(settings): + _check(settings) + + @pytest.mark.django_db + def test_d(settings): + _check(settings) ''') result = django_testdir.runpytest('-vv', '-n2', '-s', '--reuse-db') result.stdout.fnmatch_lines(['*PASSED*test_a*']) result.stdout.fnmatch_lines(['*PASSED*test_b*']) + result.stdout.fnmatch_lines(['*PASSED*test_c*']) + result.stdout.fnmatch_lines(['*PASSED*test_d*']) assert db_exists('gw0') assert db_exists('gw1') @@ -103,36 +171,34 @@ def test_b(settings): result = django_testdir.runpytest('-vv', '-n2', '-s', '--reuse-db') result.stdout.fnmatch_lines(['*PASSED*test_a*']) result.stdout.fnmatch_lines(['*PASSED*test_b*']) + result.stdout.fnmatch_lines(['*PASSED*test_c*']) + result.stdout.fnmatch_lines(['*PASSED*test_d*']) - result = django_testdir.runpytest('-vv', '-n2', '-s', '--reuse-db', '--create-db') + result = django_testdir.runpytest('-vv', '-n2', '-s', '--reuse-db', + '--create-db') result.stdout.fnmatch_lines(['*PASSED*test_a*']) result.stdout.fnmatch_lines(['*PASSED*test_b*']) + result.stdout.fnmatch_lines(['*PASSED*test_c*']) + result.stdout.fnmatch_lines(['*PASSED*test_d*']) @skip_on_python32 def test_xdist_one_db(django_testdir): - skip_if_sqlite() + skip_if_sqlite_in_memory() django_testdir.create_test_module(''' import pytest - from .app.models import Item - def _check(settings): # Make sure that the database name looks correct db_name = settings.DATABASES['default']['NAME'] assert not 'gw' in db_name - assert Item.objects.count() == 0 Item.objects.create(name='foo') assert Item.objects.count() == 1 - - @pytest.mark.django_db def test_a(settings): _check(settings) - - @pytest.mark.django_db def test_b(settings): _check(settings) @@ -163,8 +229,184 @@ def test_a(): (conn, ) = connections.all() assert conn.vendor == 'sqlite' - assert conn.settings_dict['NAME'] == ':memory:' + assert conn.creation._get_test_db_name() == ':memory:' ''') result = django_testdir.runpytest('--tb=short', '-vv', '-n1') result.stdout.fnmatch_lines(['*PASSED*test_a*']) + + +@pytest.mark.skipif(get_django_version() >= (1, 9), + reason=('Django 1.9 requires migration and has no concept ' + 'of initial data fixtures')) +def test_initial_data(django_testdir_initial): + """Test that initial data gets loaded.""" + django_testdir_initial.create_test_module(''' + import pytest + + from .app.models import Item + + @pytest.mark.django_db + def test_inner_south(): + assert [x.name for x in Item.objects.all()] \ + == ["mark_initial_data"] + ''') + + result = django_testdir_initial.runpytest('--tb=short', '-v') + result.stdout.fnmatch_lines(['*test_inner_south*PASSED*']) + + +# NOTE: South tries to monkey-patch management._commands, which has been +# replaced by lru_cache and would cause an AttributeError. +@pytest.mark.skipif(get_django_version() >= (1, 7), + reason='South does not support Django 1.7+') +@pytest.mark.skipif(sys.version_info[0] == 3, + reason='South is not properly supported on Python 3') +class TestSouth: + """Test interaction with initial_data and South.""" + + @pytest.mark.django_project(extra_settings=""" + INSTALLED_APPS += [ 'south', ] + SOUTH_TESTS_MIGRATE = True + SOUTH_MIGRATION_MODULES = { + 'app': 'app.south_migrations', + } + """) + def test_initial_data_south(self, django_testdir_initial): + django_testdir_initial.create_test_module(''' + import pytest + + from .app.models import Item + + @pytest.mark.django_db + def test_inner_south(): + assert [x.name for x in Item.objects.all()] \ + == ["mark_initial_data"] + ''') + + result = django_testdir_initial.runpytest('--tb=short', '-v') + result.stdout.fnmatch_lines(['*test_inner_south*PASSED*']) + + @pytest.mark.django_project(extra_settings=""" + INSTALLED_APPS += [ 'south', ] + SOUTH_TESTS_MIGRATE = True + SOUTH_MIGRATION_MODULES = { + 'app': 'tpkg.app.south_migrations', + } + """) + def test_initial_south_migrations(self, django_testdir_initial): + testdir = django_testdir_initial + testdir.create_test_module(''' + import pytest + + @pytest.mark.django_db + def test_inner_south(): + pass + ''') + + testdir.mkpydir('tpkg/app/south_migrations') + testdir.create_app_file(""" + from south.v2 import SchemaMigration + + class Migration(SchemaMigration): + def forwards(self, orm): + print("mark_south_migration_forwards") + """, 'south_migrations/0001_initial.py') + result = testdir.runpytest('--tb=short', '-v', '-s') + result.stdout.fnmatch_lines(['*mark_south_migration_forwards*']) + + @pytest.mark.django_project(extra_settings=""" + INSTALLED_APPS += [ 'south', ] + SOUTH_TESTS_MIGRATE = False + SOUTH_MIGRATION_MODULES = { + 'app': 'tpkg.app.south_migrations', + } + """) + def test_south_no_migrations(self, django_testdir_initial): + testdir = django_testdir_initial + testdir.create_test_module(''' + import pytest + + @pytest.mark.django_db + def test_inner_south(): + pass + ''') + + testdir.mkpydir('tpkg/app/south_migrations') + p = testdir.tmpdir.join( + "tpkg/app/south_migrations/0001_initial").new(ext="py") + p.write('raise Exception("This should not get imported.")', + ensure=True) + + result = testdir.runpytest('--tb=short', '-v') + result.stdout.fnmatch_lines(['*test_inner_south*PASSED*']) + + +class TestNativeMigrations(object): + """ Tests for Django 1.7 Migrations """ + + @pytest.mark.skipif(get_django_version() < (1, 7), + reason=('Django < 1.7 doesn\'t have migrations')) + def test_no_migrations(self, django_testdir_initial): + testdir = django_testdir_initial + testdir.create_test_module(''' + import pytest + + @pytest.mark.django_db + def test_inner_migrations(): + pass + ''') + + testdir.mkpydir('tpkg/app/migrations') + p = testdir.tmpdir.join( + "tpkg/app/migrations/0001_initial").new(ext="py") + p.write('raise Exception("This should not get imported.")', + ensure=True) + + result = testdir.runpytest('--nomigrations', '--tb=short', '-v') + result.stdout.fnmatch_lines(['*test_inner_migrations*PASSED*']) + + @pytest.mark.skipif(get_django_version() < (1, 7), + reason=('Django < 1.7 doesn\'t have migrations')) + def test_migrations_run(self, django_testdir): + testdir = django_testdir + testdir.create_test_module(''' + import pytest + + @pytest.mark.django_db + def test_inner_migrations(): + pass + ''') + + testdir.mkpydir('tpkg/app/migrations') + testdir.tmpdir.join("tpkg/app/migrations/__init__").new(ext="py") + testdir.create_app_file(""" + from django.db import migrations, models + + def print_it(apps, schema_editor): + print("mark_migrations_run") + + class Migration(migrations.Migration): + + dependencies = [] + + operations = [ + migrations.CreateModel( + name='Item', + fields=[ + ('id', models.AutoField(serialize=False, + auto_created=True, + primary_key=True)), + ('name', models.CharField(max_length=100)), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.RunPython( + print_it, + ), + ] + """, 'migrations/0001_initial.py') + result = testdir.runpytest('--tb=short', '-v', '-s') + result.stdout.fnmatch_lines(['*mark_migrations_run*']) diff --git a/tests/test_django_configurations.py b/tests/test_django_configurations.py index 64faf8b13..f3e5afce4 100644 --- a/tests/test_django_configurations.py +++ b/tests/test_django_configurations.py @@ -2,15 +2,17 @@ If these tests fail you probably forgot to install django-configurations. """ -import sys import pytest -# importing configurations fails on 2.5, even though it might be installed -if sys.version_info < (2, 6): - pytest.skip('django-configurations is not supported on Python < 2.6') - pytest.importorskip('configurations') +try: + import configurations.importer + configurations +except ImportError as e: + if 'LaxOptionParser' in e.args[0]: + pytest.skip('This version of django-configurations is incompatible with Django: ' # noqa + 'https://github.com/jezdez/django-configurations/issues/65') # noqa BARE_SETTINGS = ''' from configurations import Settings @@ -73,7 +75,7 @@ def test_dc_option(testdir, monkeypatch): monkeypatch.setenv('DJANGO_SETTINGS_MODULE', 'DO_NOT_USE_env') monkeypatch.setenv('DJANGO_CONFIGURATION', 'DO_NOT_USE_env') - testdir.makeini("""\ + testdir.makeini(""" [pytest] DJANGO_SETTINGS_MODULE = DO_NOT_USE_ini DJANGO_CONFIGURATION = DO_NOT_USE_ini diff --git a/tests/test_django_settings_module.py b/tests/test_django_settings_module.py index 72eb6be98..57246772d 100644 --- a/tests/test_django_settings_module.py +++ b/tests/test_django_settings_module.py @@ -3,6 +3,10 @@ If these tests fail you probably forgot to run "python setup.py develop". """ +import django +import pytest + + BARE_SETTINGS = ''' # At least one database must be configured DATABASES = { @@ -51,7 +55,7 @@ def test_ds(): def test_ds_option(testdir, monkeypatch): monkeypatch.setenv('DJANGO_SETTINGS_MODULE', 'DO_NOT_USE_env') - testdir.makeini("""\ + testdir.makeini(""" [pytest] DJANGO_SETTINGS_MODULE = DO_NOT_USE_ini """) @@ -69,13 +73,27 @@ def test_ds(): def test_ds_non_existent(testdir, monkeypatch): - # Make sure we do not fail with INTERNALERROR if an incorrect - # DJANGO_SETTINGS_MODULE is given. + """ + Make sure we do not fail with INTERNALERROR if an incorrect + DJANGO_SETTINGS_MODULE is given. + """ monkeypatch.setenv('DJANGO_SETTINGS_MODULE', 'DOES_NOT_EXIST') testdir.makepyfile('def test_ds(): pass') result = testdir.runpytest() - result.stderr.fnmatch_lines( - ["*Could not import settings 'DOES_NOT_EXIST' (Is it on sys.path?*):*"]) + result.stderr.fnmatch_lines(["*ImportError:*DOES_NOT_EXIST*"]) + + +def test_ds_after_user_conftest(testdir, monkeypatch): + """ + Test that the settings module can be imported, after pytest has adjusted + the sys.path. + """ + monkeypatch.setenv('DJANGO_SETTINGS_MODULE', 'settings_after_conftest') + testdir.makepyfile('def test_ds(): pass') + testdir.makepyfile(settings_after_conftest="SECRET_KEY='secret'") + # testdir.makeconftest("import sys; print(sys.path)") + result = testdir.runpytest('-v') + result.stdout.fnmatch_lines(['*1 passed*']) def test_django_settings_configure(testdir, monkeypatch): @@ -196,5 +214,52 @@ def pytest_configure(): def test_debug_is_false(): assert settings.DEBUG is False """) + r = testdir.runpytest() assert r.ret == 0 + + +@pytest.mark.skipif(not hasattr(django, 'setup'), + reason="This Django version does not support app loading") +@pytest.mark.django_project(extra_settings=""" + INSTALLED_APPS = [ + 'tpkg.app.apps.TestApp', + ] +""") +def test_django_setup_sequence(django_testdir): + django_testdir.create_app_file(""" + from django.apps import apps, AppConfig + + from django.contrib.auth.models import AbstractUser + from django.db import models + + + class TestApp(AppConfig): + name = 'tpkg.app' + + def ready(self): + print ('READY(): populating=%r' % apps._lock.locked()) + """, 'apps.py') + + django_testdir.create_app_file(""" + from django.apps import apps + + print ('IMPORT: populating=%r,ready=%r' % ( + apps._lock.locked(), apps.ready)) + SOME_THING = 1234 + """, 'models.py') + + django_testdir.create_app_file("", '__init__.py') + django_testdir.makepyfile(""" + from django.apps import apps + from tpkg.app.models import SOME_THING + + def test_anything(): + print ('TEST: populating=%r,ready=%r' % ( + apps._lock.locked(), apps.ready)) + """) + + result = django_testdir.runpytest('-s', '--tb=line') + result.stdout.fnmatch_lines(['*IMPORT: populating=True,ready=False*']) + result.stdout.fnmatch_lines(['*READY(): populating=True*']) + result.stdout.fnmatch_lines(['*TEST: populating=False,ready=True*']) diff --git a/tests/test_environment.py b/tests/test_environment.py index c27d75be9..b7c40ce7b 100644 --- a/tests/test_environment.py +++ b/tests/test_environment.py @@ -3,13 +3,14 @@ import pytest from django.core import mail from django.db import connection -from .app.models import Item + +from pytest_django_test.app.models import Item # It doesn't matter which order all the _again methods are run, we just need # to check the environment remains constant. -# This is possible with some of the testdir magic, but this is a nice lazy to -# it +# This is possible with some of the testdir magic, but this is the lazy way +# to do it. def test_mail(): @@ -47,3 +48,41 @@ def test_database_name(): def test_database_noaccess(): with pytest.raises(pytest.fail.Exception): Item.objects.count() + + +def test_django_testrunner_verbosity_from_pytest(django_testdir): + """ + Test that Django's code to setup and teardown the databases uses pytest's + verbosity level. + """ + django_testdir.create_test_module(''' + import pytest + + @pytest.mark.django_db + def test_inner_testrunner(): + pass + ''') + + # Not verbose by default. + result = django_testdir.runpytest('-s') + result.stdout.fnmatch_lines([ + "tpkg/test_the_test.py ."]) + + # -v and -q results in verbosity 0. + result = django_testdir.runpytest('-s', '-v', '-q') + result.stdout.fnmatch_lines([ + "tpkg/test_the_test.py ."]) + + # Verbose output with '-v'. + result = django_testdir.runpytest('-s', '-v') + result.stdout.fnmatch_lines_random([ + "tpkg/test_the_test.py:*", + "*PASSED*", + "*Destroying test database for alias 'default'...*"]) + + # More verbose output with '-v -v'. + result = django_testdir.runpytest('-s', '-v', '-v') + result.stdout.fnmatch_lines_random([ + "tpkg/test_the_test.py:*", + "*PASSED*", + "*Destroying test database for alias 'default' ('*')...*"]) diff --git a/tests/test_fixtures.py b/tests/test_fixtures.py index a4bfc0479..9fa564272 100644 --- a/tests/test_fixtures.py +++ b/tests/test_fixtures.py @@ -1,4 +1,4 @@ -"""Test for user-visible fixtures +"""Tests for user-visible fixtures. Not quite all fixtures are tested here, the db and transactional_db fixtures are tested in test_database. @@ -6,18 +6,15 @@ from __future__ import with_statement -import django import pytest from django.conf import settings as real_settings from django.test.client import Client, RequestFactory from django.test.testcases import connections_support_transactions -from .app.models import Item -from .test_database import noop_transactions -from .compat import force_text, urlopen - - -django # Avoid pyflakes complaints +from pytest_django.lazy_django import get_django_version +from pytest_django_test.app.models import Item +from pytest_django_test.compat import force_text, HTTPError, urlopen +from pytest_django_test.db_helpers import noop_transactions def test_client(client): @@ -37,6 +34,15 @@ def test_admin_client_no_db_marker(admin_client): assert force_text(resp.content) == 'You are an admin' +@pytest.mark.django_db +def test_admin_user(admin_user, django_user_model): + assert isinstance(admin_user, django_user_model) + + +def test_admin_user_no_db_marker(admin_user, django_user_model): + assert isinstance(admin_user, django_user_model) + + def test_rf(rf): assert isinstance(rf, RequestFactory) @@ -80,9 +86,9 @@ def test_deleted_again(self, settings): class TestLiveServer: pytestmark = [ - pytest.mark.skipif('django.VERSION[:2] < (1, 4)'), - pytest.mark.urls('tests.urls_liveserver'), - ] + pytest.mark.skipif(get_django_version() < (1, 4), + reason="Django > 1.3 required"), + ] def test_url(self, live_server): assert live_server.url == force_text(live_server) @@ -138,3 +144,168 @@ def item_transactional_db(self, transactional_db): def test_item_transactional_db(self, item_transactional_db, live_server): response_data = urlopen(live_server + '/item_count/').read() assert force_text(response_data) == 'Item count: 1' + + @pytest.mark.skipif(get_django_version() >= (1, 7), + reason="Django < 1.7 required") + def test_serve_static(self, live_server, settings): + """ + Test that the LiveServer serves static files by default. + """ + response_data = urlopen(live_server + '/static/a_file.txt').read() + assert force_text(response_data) == 'bla\n' + + @pytest.mark.django_project(extra_settings=""" + INSTALLED_APPS = [ + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.sites', + 'django.contrib.staticfiles', + 'tpkg.app', + ] + + STATIC_URL = '/static/' + """) + def test_serve_static_with_staticfiles_app(self, django_testdir, settings): + """ + LiveServer always serves statics with ``django.contrib.staticfiles`` + handler. + """ + django_testdir.create_test_module(""" + import pytest + try: + from django.utils.encoding import force_text + except ImportError: + from django.utils.encoding import force_unicode as force_text + + try: + from urllib2 import urlopen, HTTPError + except ImportError: + from urllib.request import urlopen, HTTPError + + class TestLiveServer: + def test_a(self, live_server, settings): + assert ('django.contrib.staticfiles' + in settings.INSTALLED_APPS) + response_data = urlopen( + live_server + '/static/a_file.txt').read() + assert force_text(response_data) == 'bla\\n' + """) + result = django_testdir.runpytest('--tb=short', '-v') + result.stdout.fnmatch_lines(['*test_a*PASSED*']) + + @pytest.mark.skipif(get_django_version() < (1, 7), + reason="Django >= 1.7 required") + def test_serve_static_dj17_without_staticfiles_app(self, live_server, + settings): + """ + Because ``django.contrib.staticfiles`` is not installed + LiveServer can not serve statics with django >= 1.7 . + """ + with pytest.raises(HTTPError): + urlopen(live_server + '/static/a_file.txt').read() + + +@pytest.mark.django_project(extra_settings=""" + AUTH_USER_MODEL = 'app.MyCustomUser' + INSTALLED_APPS = [ + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.sites', + 'tpkg.app', + ] + ROOT_URLCONF = 'tpkg.app.urls' + """) +@pytest.mark.skipif(get_django_version() < (1, 5), + reason="Django >= 1.5 required") +def test_custom_user_model(django_testdir): + django_testdir.create_app_file(""" + from django.contrib.auth.models import AbstractUser + from django.db import models + + class MyCustomUser(AbstractUser): + identifier = models.CharField(unique=True, max_length=100) + + USERNAME_FIELD = 'identifier' + """, 'models.py') + django_testdir.create_app_file(""" + try: + from django.conf.urls import patterns # Django >1.4 + except ImportError: + from django.conf.urls.defaults import patterns # Django 1.3 + + urlpatterns = patterns( + '', + (r'admin-required/', 'tpkg.app.views.admin_required_view'), + ) + """, 'urls.py') + django_testdir.create_app_file(""" + from django.http import HttpResponse + from django.template import Template + from django.template.context import Context + + + def admin_required_view(request): + if request.user.is_staff: + return HttpResponse( + Template('You are an admin').render(Context())) + return HttpResponse( + Template('Access denied').render(Context())) + """, 'views.py') + django_testdir.makepyfile(""" + from pytest_django_test.compat import force_text + from tpkg.app.models import MyCustomUser + + def test_custom_user_model(admin_client): + resp = admin_client.get('/admin-required/') + assert force_text(resp.content) == 'You are an admin' + """) + + django_testdir.create_app_file('', 'migrations/__init__.py') + django_testdir.create_app_file(""" +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import django.utils.timezone +import django.core.validators + + +class Migration(migrations.Migration): + + dependencies = [ + ('auth', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='MyCustomUser', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('password', models.CharField(max_length=128, verbose_name='password')), + ('last_login', models.DateTimeField(null=True, verbose_name='last login', blank=True)), + ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), + ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, max_length=30, validators=[django.core.validators.RegexValidator('^[\\w.@+-]+$', 'Enter a valid username. This value may contain only letters, numbers and @/./+/-/_ characters.', 'invalid')], help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.', unique=True, verbose_name='username')), + ('first_name', models.CharField(max_length=30, verbose_name='first name', blank=True)), + ('last_name', models.CharField(max_length=30, verbose_name='last name', blank=True)), + ('email', models.EmailField(max_length=254, verbose_name='email address', blank=True)), + ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')), + ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')), + ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')), + ('identifier', models.CharField(unique=True, max_length=100)), + ('groups', models.ManyToManyField(related_query_name='user', related_name='user_set', to='auth.Group', blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', verbose_name='groups')), + ('user_permissions', models.ManyToManyField(related_query_name='user', related_name='user_set', to='auth.Permission', blank=True, help_text='Specific permissions for this user.', verbose_name='user permissions')), + ], + options={ + 'abstract': False, + 'verbose_name': 'user', + 'verbose_name_plural': 'users', + }, + bases=None, + ), + ] + """, 'migrations/0001_initial.py') # noqa + + result = django_testdir.runpytest('-s') + result.stdout.fnmatch_lines(['*1 passed*']) diff --git a/tests/test_manage_py_scan.py b/tests/test_manage_py_scan.py new file mode 100644 index 000000000..b9a8fce1a --- /dev/null +++ b/tests/test_manage_py_scan.py @@ -0,0 +1,49 @@ +import pytest + + +@pytest.mark.django_project(project_root='django_project_root', + create_manage_py=True) +def test_django_project_found(django_testdir): + # XXX: Important: Do not chdir() to django_project_root since runpytest + # will call "python /path/to/pytest.py", which will impliclity add cwd to + # the path. By instead calling "python /path/to/pytest.py + # django_project_root", we avoid impliclity adding the project to sys.path + # This matches the behaviour when py.test is called directly as an + # executable (cwd is not added to the Python path) + + django_testdir.create_test_module(""" + def test_foobar(): + assert 1 + 1 == 2 + """) + + result = django_testdir.runpytest('django_project_root') + assert result.ret == 0 + + outcomes = result.parseoutcomes() + assert outcomes['passed'] == 1 + + +@pytest.mark.django_project(project_root='django_project_root', + create_manage_py=True) +def test_django_project_found_invalid_settings(django_testdir, monkeypatch): + monkeypatch.setenv('DJANGO_SETTINGS_MODULE', 'DOES_NOT_EXIST') + + result = django_testdir.runpytest('django_project_root') + result.stderr.fnmatch_lines(['*ImportError:*DOES_NOT_EXIST*']) + result.stderr.fnmatch_lines(['*pytest-django found a Django project*']) + + +def test_django_project_scan_disabled_invalid_settings(django_testdir, + monkeypatch): + monkeypatch.setenv('DJANGO_SETTINGS_MODULE', 'DOES_NOT_EXIST') + + django_testdir.makeini(''' + [pytest] + django_find_project = false + ''') + + result = django_testdir.runpytest('django_project_root') + + result.stderr.fnmatch_lines(['*ImportError*DOES_NOT_EXIST*']) + result.stderr.fnmatch_lines(['*pytest-django did not search for ' + 'Django projects*']) diff --git a/tests/test_unittest.py b/tests/test_unittest.py index 55203aee9..5e3e9d2f4 100644 --- a/tests/test_unittest.py +++ b/tests/test_unittest.py @@ -1,9 +1,8 @@ import pytest - from django.test import TestCase -from .app.models import Item -from .compat import force_text +from pytest_django_test.app.models import Item +from pytest_django_test.compat import force_text class TestFixtures(TestCase): @@ -61,11 +60,11 @@ class TestUrls(TestCase): """ Make sure overriding ``urls`` works. """ - urls = 'tests.urls_unittest' + urls = 'pytest_django_test.urls_overridden' def test_urls(self): - resp = self.client.get('/test_url/') - self.assertEqual(force_text(resp.content), 'Test URL works!') + resp = self.client.get('/overridden_url/') + self.assertEqual(force_text(resp.content), 'Overridden urlconf works!') def test_sole_test(django_testdir): diff --git a/tests/test_urls.py b/tests/test_urls.py index 29ecd4e1a..964aaa59f 100644 --- a/tests/test_urls.py +++ b/tests/test_urls.py @@ -1,6 +1,9 @@ import pytest from django.conf import settings -from .compat import force_text + +from pytest_django_test.compat import force_text + +pytestmark = pytest.mark.urls('pytest_django_test.urls_overridden') try: from django.core.urlresolvers import is_valid_path @@ -21,13 +24,11 @@ def is_valid_path(path, urlconf=None): return False -@pytest.mark.urls('tests.urls_overridden') def test_urls(): - assert settings.ROOT_URLCONF == 'tests.urls_overridden' + assert settings.ROOT_URLCONF == 'pytest_django_test.urls_overridden' assert is_valid_path('/overridden_url/') -@pytest.mark.urls('tests.urls_overridden') def test_urls_client(client): response = client.get('/overridden_url/') assert force_text(response.content) == 'Overridden urlconf works!' diff --git a/tests/urls_liveserver.py b/tests/urls_liveserver.py deleted file mode 100644 index 0e74cf540..000000000 --- a/tests/urls_liveserver.py +++ /dev/null @@ -1,15 +0,0 @@ -try: - from django.conf.urls import patterns, url # Django >1.4 -except ImportError: - from django.conf.urls.defaults import patterns, url # Django 1.3 - - -from django.http import HttpResponse - -from .app.models import Item - -urlpatterns = patterns( - '', - url(r'^item_count/$', - lambda r: HttpResponse('Item count: %d' % Item.objects.count())) -) diff --git a/tests/urls_unittest.py b/tests/urls_unittest.py deleted file mode 100644 index 4c1bfe3ee..000000000 --- a/tests/urls_unittest.py +++ /dev/null @@ -1,11 +0,0 @@ -try: - from django.conf.urls import patterns, url # Django >1.4 -except ImportError: - from django.conf.urls.defaults import patterns, url # Django 1.3 - -from django.http import HttpResponse - -urlpatterns = patterns( - '', - url(r'^test_url/$', lambda r: HttpResponse('Test URL works!')) -) diff --git a/tox.ini b/tox.ini index 1779788fc..2f3d1b9e7 100644 --- a/tox.ini +++ b/tox.ini @@ -1,1138 +1,1977 @@ +[tox] +envlist = pypy-2.6.4-master-sqlite_file,pypy3-2.6.4-master-sqlite_file,python2.6-2.6.4-1.6-sqlite_file,python2.7-2.6.4-1.3-sqlite_file,python2.7-2.6.4-1.4-sqlite_file,python2.7-2.6.4-master-mysql_innodb,python2.7-2.6.4-master-mysql_myisam,python2.7-2.6.4-master-sqlite_file,python3.2-2.6.4-master-sqlite_file,python3.3-2.6.4-master-sqlite_file,python3.4-2.6.4-1.5-sqlite_file,python3.4-2.6.4-1.6-sqlite_file,python3.4-2.6.4-1.7-sqlite_file,python3.4-2.6.4-1.8-sqlite_file,python3.4-2.6.4-master-postgres,python3.4-2.6.4-master-sqlite,python3.4-2.6.4-master-sqlite_file,checkqa-python2.6,checkqa-python2.7,checkqa-python3.2,checkqa-python3.3,checkqa-python3.4,checkqa-pypy,checkqa-pypy3 [testenv] whitelist_externals = sh -[testenv:pypy-1.3-sqlite] +[testenv:checkqa-python2.6] commands = - py.test {posargs} -basepython = pypy + flake8 --version + flake8 --show-source --statistics pytest_django tests +basepython = python2.6 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.3.7 - django-configurations==0.8 + flake8 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite - PYTHONPATH = {toxinidir} - UID = 0 + UID = 1 - -[testenv:pypy-1.4-sqlite] +[testenv:checkqa-python2.7] commands = - py.test {posargs} -basepython = pypy + flake8 --version + flake8 --show-source --statistics pytest_django tests +basepython = python2.7 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.4.13 - django-configurations==0.8 + flake8 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite - PYTHONPATH = {toxinidir} - UID = 1 - + UID = 2 -[testenv:pypy-1.5-sqlite] +[testenv:checkqa-python3.2] commands = - py.test {posargs} -basepython = pypy + flake8 --version + flake8 --show-source --statistics pytest_django tests +basepython = python3.2 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.5.8 - django-configurations==0.8 + flake8 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite - PYTHONPATH = {toxinidir} - UID = 2 + UID = 3 - -[testenv:pypy-1.6-sqlite] +[testenv:checkqa-python3.3] commands = - py.test {posargs} -basepython = pypy + flake8 --version + flake8 --show-source --statistics pytest_django tests +basepython = python3.3 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.6.5 - django-configurations==0.8 + flake8 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite - PYTHONPATH = {toxinidir} - UID = 3 - + UID = 4 -[testenv:pypy-1.7-sqlite] +[testenv:checkqa-python3.4] commands = - py.test {posargs} -basepython = pypy + flake8 --version + flake8 --show-source --statistics pytest_django tests +basepython = python3.4 deps = - pytest==2.5.2 - pytest-xdist==1.10 - https://www.djangoproject.com/m/releases/1.7/Django-1.7b4.tar.gz - django-configurations==0.8 + flake8 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite - PYTHONPATH = {toxinidir} - UID = 4 + UID = 5 - -[testenv:pypy-master-sqlite] +[testenv:checkqa-pypy] commands = - py.test {posargs} + flake8 --version + flake8 --show-source --statistics pytest_django tests basepython = pypy deps = - pytest==2.5.2 - pytest-xdist==1.10 - https://github.com/django/django/archive/master.zip - django-configurations==0.8 -setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite - PYTHONPATH = {toxinidir} - UID = 5 - - -[testenv:python2.6-1.3-mysql_innodb] -commands = - sh -c "mysql -u root -e 'drop database if exists pytest_django_6; create database pytest_django_6'" || exit 0 - py.test {posargs} -basepython = python2.6 -deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.3.7 - django-configurations==0.8 - mysql-python==1.2.5 + flake8 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_mysql_innodb - PYTHONPATH = {toxinidir} - UID = 6 - + UID = 6 -[testenv:python2.6-1.3-mysql_myisam] +[testenv:checkqa-pypy3] commands = - sh -c "mysql -u root -e 'drop database if exists pytest_django_7; create database pytest_django_7'" || exit 0 - py.test {posargs} -basepython = python2.6 + flake8 --version + flake8 --show-source --statistics pytest_django tests +basepython = pypy3 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.3.7 - django-configurations==0.8 - mysql-python==1.2.5 + flake8 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_mysql_myisam - PYTHONPATH = {toxinidir} - UID = 7 + UID = 7 - -[testenv:python2.6-1.3-postgres] +[testenv:pypy-2.6.4-1.3-sqlite] commands = - sh -c "dropdb pytest_django_8; createdb pytest_django_8 || exit 0" - py.test {posargs} -basepython = python2.6 + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = pypy deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.3.7 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.3,<1.4 django-configurations==0.8 - psycopg2==2.4.1 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_postgres PYTHONPATH = {toxinidir} UID = 8 -[testenv:python2.6-1.3-sqlite] +[testenv:pypy-2.6.4-1.3-sqlite_file] commands = - py.test {posargs} -basepython = python2.6 + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = pypy deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.3.7 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.3,<1.4 django-configurations==0.8 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite PYTHONPATH = {toxinidir} UID = 9 -[testenv:python2.6-1.4-mysql_innodb] +[testenv:pypy-2.6.4-1.4-sqlite] commands = - sh -c "mysql -u root -e 'drop database if exists pytest_django_10; create database pytest_django_10'" || exit 0 - py.test {posargs} -basepython = python2.6 + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = pypy deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.4.13 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.4,<1.5 django-configurations==0.8 - mysql-python==1.2.5 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_mysql_innodb PYTHONPATH = {toxinidir} UID = 10 -[testenv:python2.6-1.4-mysql_myisam] +[testenv:pypy-2.6.4-1.4-sqlite_file] commands = - sh -c "mysql -u root -e 'drop database if exists pytest_django_11; create database pytest_django_11'" || exit 0 - py.test {posargs} -basepython = python2.6 + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = pypy deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.4.13 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.4,<1.5 django-configurations==0.8 - mysql-python==1.2.5 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_mysql_myisam PYTHONPATH = {toxinidir} UID = 11 -[testenv:python2.6-1.4-postgres] +[testenv:pypy-2.6.4-1.5-sqlite] commands = - sh -c "dropdb pytest_django_12; createdb pytest_django_12 || exit 0" - py.test {posargs} -basepython = python2.6 + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = pypy deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.4.13 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 django-configurations==0.8 - psycopg2==2.5.2 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_postgres PYTHONPATH = {toxinidir} UID = 12 -[testenv:python2.6-1.4-sqlite] +[testenv:pypy-2.6.4-1.5-sqlite_file] commands = - py.test {posargs} -basepython = python2.6 + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = pypy deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.4.13 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 django-configurations==0.8 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite PYTHONPATH = {toxinidir} UID = 13 -[testenv:python2.6-1.5-mysql_innodb] +[testenv:pypy-2.6.4-1.6-sqlite] commands = - sh -c "mysql -u root -e 'drop database if exists pytest_django_14; create database pytest_django_14'" || exit 0 - py.test {posargs} -basepython = python2.6 + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = pypy deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.5.8 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 django-configurations==0.8 - mysql-python==1.2.5 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_mysql_innodb PYTHONPATH = {toxinidir} UID = 14 -[testenv:python2.6-1.5-mysql_myisam] +[testenv:pypy-2.6.4-1.6-sqlite_file] commands = - sh -c "mysql -u root -e 'drop database if exists pytest_django_15; create database pytest_django_15'" || exit 0 - py.test {posargs} -basepython = python2.6 + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = pypy deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.5.8 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 django-configurations==0.8 - mysql-python==1.2.5 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_mysql_myisam PYTHONPATH = {toxinidir} UID = 15 -[testenv:python2.6-1.5-postgres] +[testenv:pypy-2.6.4-1.7-sqlite] commands = - sh -c "dropdb pytest_django_16; createdb pytest_django_16 || exit 0" - py.test {posargs} -basepython = python2.6 + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = pypy deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.5.8 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.7,<1.8 django-configurations==0.8 - psycopg2==2.5.2 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_postgres PYTHONPATH = {toxinidir} UID = 16 -[testenv:python2.6-1.5-sqlite] +[testenv:pypy-2.6.4-1.7-sqlite_file] commands = - py.test {posargs} -basepython = python2.6 + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = pypy deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.5.8 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.7,<1.8 django-configurations==0.8 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite PYTHONPATH = {toxinidir} UID = 17 -[testenv:python2.6-1.6-mysql_innodb] +[testenv:pypy-2.6.4-1.8-sqlite] commands = - sh -c "mysql -u root -e 'drop database if exists pytest_django_18; create database pytest_django_18'" || exit 0 - py.test {posargs} -basepython = python2.6 + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = pypy deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.6.5 + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/stable/1.8.x.zip django-configurations==0.8 - mysql-python==1.2.5 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_mysql_innodb PYTHONPATH = {toxinidir} UID = 18 -[testenv:python2.6-1.6-mysql_myisam] +[testenv:pypy-2.6.4-1.8-sqlite_file] commands = - sh -c "mysql -u root -e 'drop database if exists pytest_django_19; create database pytest_django_19'" || exit 0 - py.test {posargs} -basepython = python2.6 + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = pypy deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.6.5 + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/stable/1.8.x.zip django-configurations==0.8 - mysql-python==1.2.5 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_mysql_myisam PYTHONPATH = {toxinidir} UID = 19 -[testenv:python2.6-1.6-postgres] +[testenv:pypy-2.6.4-master-sqlite] commands = - sh -c "dropdb pytest_django_20; createdb pytest_django_20 || exit 0" - py.test {posargs} -basepython = python2.6 + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = pypy deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.6.5 + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/master.zip django-configurations==0.8 - psycopg2==2.5.2 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_postgres PYTHONPATH = {toxinidir} UID = 20 -[testenv:python2.6-1.6-sqlite] +[testenv:pypy-2.6.4-master-sqlite_file] commands = - py.test {posargs} -basepython = python2.6 + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = pypy deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.6.5 + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/master.zip django-configurations==0.8 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite PYTHONPATH = {toxinidir} UID = 21 -[testenv:python2.7-1.3-mysql_innodb] +[testenv:pypy3-2.6.4-1.5-sqlite] commands = - sh -c "mysql -u root -e 'drop database if exists pytest_django_22; create database pytest_django_22'" || exit 0 - py.test {posargs} -basepython = python2.7 + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = pypy3 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.3.7 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 django-configurations==0.8 - mysql-python==1.2.5 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_mysql_innodb PYTHONPATH = {toxinidir} UID = 22 -[testenv:python2.7-1.3-mysql_myisam] +[testenv:pypy3-2.6.4-1.5-sqlite_file] commands = - sh -c "mysql -u root -e 'drop database if exists pytest_django_23; create database pytest_django_23'" || exit 0 - py.test {posargs} -basepython = python2.7 + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = pypy3 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.3.7 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 django-configurations==0.8 - mysql-python==1.2.5 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_mysql_myisam PYTHONPATH = {toxinidir} UID = 23 -[testenv:python2.7-1.3-postgres] +[testenv:pypy3-2.6.4-1.6-sqlite] commands = - sh -c "dropdb pytest_django_24; createdb pytest_django_24 || exit 0" - py.test {posargs} -basepython = python2.7 + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = pypy3 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.3.7 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 django-configurations==0.8 - psycopg2==2.4.1 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_postgres PYTHONPATH = {toxinidir} UID = 24 -[testenv:python2.7-1.3-sqlite] +[testenv:pypy3-2.6.4-1.6-sqlite_file] commands = - py.test {posargs} -basepython = python2.7 + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = pypy3 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.3.7 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 django-configurations==0.8 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite PYTHONPATH = {toxinidir} UID = 25 -[testenv:python2.7-1.4-mysql_innodb] +[testenv:pypy3-2.6.4-1.7-sqlite] commands = - sh -c "mysql -u root -e 'drop database if exists pytest_django_26; create database pytest_django_26'" || exit 0 - py.test {posargs} -basepython = python2.7 + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = pypy3 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.4.13 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.7,<1.8 django-configurations==0.8 - mysql-python==1.2.5 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_mysql_innodb PYTHONPATH = {toxinidir} UID = 26 -[testenv:python2.7-1.4-mysql_myisam] +[testenv:pypy3-2.6.4-1.7-sqlite_file] commands = - sh -c "mysql -u root -e 'drop database if exists pytest_django_27; create database pytest_django_27'" || exit 0 - py.test {posargs} -basepython = python2.7 + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = pypy3 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.4.13 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.7,<1.8 django-configurations==0.8 - mysql-python==1.2.5 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_mysql_myisam PYTHONPATH = {toxinidir} UID = 27 -[testenv:python2.7-1.4-postgres] +[testenv:pypy3-2.6.4-1.8-sqlite] commands = - sh -c "dropdb pytest_django_28; createdb pytest_django_28 || exit 0" - py.test {posargs} -basepython = python2.7 + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = pypy3 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.4.13 + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/stable/1.8.x.zip django-configurations==0.8 - psycopg2==2.5.2 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_postgres PYTHONPATH = {toxinidir} UID = 28 -[testenv:python2.7-1.4-sqlite] +[testenv:pypy3-2.6.4-1.8-sqlite_file] commands = - py.test {posargs} -basepython = python2.7 + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = pypy3 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.4.13 + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/stable/1.8.x.zip django-configurations==0.8 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite PYTHONPATH = {toxinidir} UID = 29 -[testenv:python2.7-1.5-mysql_innodb] +[testenv:pypy3-2.6.4-master-sqlite] commands = - sh -c "mysql -u root -e 'drop database if exists pytest_django_30; create database pytest_django_30'" || exit 0 - py.test {posargs} -basepython = python2.7 + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = pypy3 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.5.8 + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/master.zip django-configurations==0.8 - mysql-python==1.2.5 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_mysql_innodb PYTHONPATH = {toxinidir} UID = 30 -[testenv:python2.7-1.5-mysql_myisam] +[testenv:pypy3-2.6.4-master-sqlite_file] commands = - sh -c "mysql -u root -e 'drop database if exists pytest_django_31; create database pytest_django_31'" || exit 0 - py.test {posargs} -basepython = python2.7 + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = pypy3 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.5.8 + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/master.zip django-configurations==0.8 - mysql-python==1.2.5 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_mysql_myisam PYTHONPATH = {toxinidir} UID = 31 -[testenv:python2.7-1.5-postgres] +[testenv:python2.6-2.6.4-1.3-mysql_innodb] commands = - sh -c "dropdb pytest_django_32; createdb pytest_django_32 || exit 0" - py.test {posargs} -basepython = python2.7 + sh -c "mysql -u root -e 'drop database if exists pytest_django_32; create database pytest_django_32'" || exit 0 + py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs} +basepython = python2.6 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.5.8 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.3,<1.4 django-configurations==0.8 - psycopg2==2.5.2 + south==1.0 + mysql-python==1.2.5 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_postgres PYTHONPATH = {toxinidir} UID = 32 -[testenv:python2.7-1.5-sqlite] +[testenv:python2.6-2.6.4-1.3-mysql_myisam] commands = - py.test {posargs} -basepython = python2.7 + sh -c "mysql -u root -e 'drop database if exists pytest_django_33; create database pytest_django_33'" || exit 0 + py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs} +basepython = python2.6 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.5.8 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.3,<1.4 django-configurations==0.8 + south==1.0 + mysql-python==1.2.5 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite PYTHONPATH = {toxinidir} UID = 33 -[testenv:python2.7-1.6-mysql_innodb] +[testenv:python2.6-2.6.4-1.3-postgres] commands = - sh -c "mysql -u root -e 'drop database if exists pytest_django_34; create database pytest_django_34'" || exit 0 - py.test {posargs} -basepython = python2.7 + sh -c "dropdb pytest_django_34; createdb pytest_django_34 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python2.6 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.6.5 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.3,<1.4 django-configurations==0.8 - mysql-python==1.2.5 + south==1.0 + psycopg2==2.4.1 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_mysql_innodb PYTHONPATH = {toxinidir} UID = 34 -[testenv:python2.7-1.6-mysql_myisam] +[testenv:python2.6-2.6.4-1.3-sqlite] commands = - sh -c "mysql -u root -e 'drop database if exists pytest_django_35; create database pytest_django_35'" || exit 0 - py.test {posargs} -basepython = python2.7 + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python2.6 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.6.5 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.3,<1.4 django-configurations==0.8 - mysql-python==1.2.5 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_mysql_myisam PYTHONPATH = {toxinidir} UID = 35 -[testenv:python2.7-1.6-postgres] +[testenv:python2.6-2.6.4-1.3-sqlite_file] commands = - sh -c "dropdb pytest_django_36; createdb pytest_django_36 || exit 0" - py.test {posargs} -basepython = python2.7 + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python2.6 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.6.5 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.3,<1.4 django-configurations==0.8 - psycopg2==2.5.2 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_postgres PYTHONPATH = {toxinidir} UID = 36 -[testenv:python2.7-1.6-sqlite] +[testenv:python2.6-2.6.4-1.4-mysql_innodb] commands = - py.test {posargs} -basepython = python2.7 + sh -c "mysql -u root -e 'drop database if exists pytest_django_37; create database pytest_django_37'" || exit 0 + py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs} +basepython = python2.6 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.6.5 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.4,<1.5 django-configurations==0.8 + south==1.0 + mysql-python==1.2.5 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite PYTHONPATH = {toxinidir} UID = 37 -[testenv:python2.7-1.7-mysql_innodb] +[testenv:python2.6-2.6.4-1.4-mysql_myisam] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_38; create database pytest_django_38'" || exit 0 - py.test {posargs} -basepython = python2.7 + py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs} +basepython = python2.6 deps = - pytest==2.5.2 - pytest-xdist==1.10 - https://www.djangoproject.com/m/releases/1.7/Django-1.7b4.tar.gz + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.4,<1.5 django-configurations==0.8 + south==1.0 mysql-python==1.2.5 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_mysql_innodb PYTHONPATH = {toxinidir} UID = 38 -[testenv:python2.7-1.7-mysql_myisam] +[testenv:python2.6-2.6.4-1.4-postgres] commands = - sh -c "mysql -u root -e 'drop database if exists pytest_django_39; create database pytest_django_39'" || exit 0 - py.test {posargs} -basepython = python2.7 + sh -c "dropdb pytest_django_39; createdb pytest_django_39 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python2.6 deps = - pytest==2.5.2 - pytest-xdist==1.10 - https://www.djangoproject.com/m/releases/1.7/Django-1.7b4.tar.gz + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.4,<1.5 django-configurations==0.8 - mysql-python==1.2.5 + south==1.0 + psycopg2==2.5.2 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_mysql_myisam PYTHONPATH = {toxinidir} UID = 39 -[testenv:python2.7-1.7-postgres] +[testenv:python2.6-2.6.4-1.4-sqlite] commands = - sh -c "dropdb pytest_django_40; createdb pytest_django_40 || exit 0" - py.test {posargs} -basepython = python2.7 + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python2.6 deps = - pytest==2.5.2 - pytest-xdist==1.10 - https://www.djangoproject.com/m/releases/1.7/Django-1.7b4.tar.gz + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.4,<1.5 django-configurations==0.8 - psycopg2==2.5.2 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_postgres PYTHONPATH = {toxinidir} UID = 40 -[testenv:python2.7-1.7-sqlite] +[testenv:python2.6-2.6.4-1.4-sqlite_file] commands = - py.test {posargs} -basepython = python2.7 + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python2.6 deps = - pytest==2.5.2 - pytest-xdist==1.10 - https://www.djangoproject.com/m/releases/1.7/Django-1.7b4.tar.gz + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.4,<1.5 django-configurations==0.8 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite PYTHONPATH = {toxinidir} UID = 41 -[testenv:python2.7-master-mysql_innodb] +[testenv:python2.6-2.6.4-1.5-mysql_innodb] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_42; create database pytest_django_42'" || exit 0 - py.test {posargs} -basepython = python2.7 + py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs} +basepython = python2.6 deps = - pytest==2.5.2 - pytest-xdist==1.10 - https://github.com/django/django/archive/master.zip + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 django-configurations==0.8 + south==1.0 mysql-python==1.2.5 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_mysql_innodb PYTHONPATH = {toxinidir} UID = 42 -[testenv:python2.7-master-mysql_myisam] +[testenv:python2.6-2.6.4-1.5-mysql_myisam] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_43; create database pytest_django_43'" || exit 0 - py.test {posargs} -basepython = python2.7 + py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs} +basepython = python2.6 deps = - pytest==2.5.2 - pytest-xdist==1.10 - https://github.com/django/django/archive/master.zip + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 django-configurations==0.8 + south==1.0 mysql-python==1.2.5 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_mysql_myisam PYTHONPATH = {toxinidir} UID = 43 -[testenv:python2.7-master-postgres] +[testenv:python2.6-2.6.4-1.5-postgres] commands = sh -c "dropdb pytest_django_44; createdb pytest_django_44 || exit 0" - py.test {posargs} -basepython = python2.7 + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python2.6 deps = - pytest==2.5.2 - pytest-xdist==1.10 - https://github.com/django/django/archive/master.zip + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 django-configurations==0.8 + south==1.0 psycopg2==2.5.2 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_postgres PYTHONPATH = {toxinidir} UID = 44 -[testenv:python2.7-master-sqlite] +[testenv:python2.6-2.6.4-1.5-sqlite] commands = - py.test {posargs} -basepython = python2.7 + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python2.6 deps = - pytest==2.5.2 - pytest-xdist==1.10 - https://github.com/django/django/archive/master.zip + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 django-configurations==0.8 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite PYTHONPATH = {toxinidir} UID = 45 -[testenv:python3.2-1.5-postgres] +[testenv:python2.6-2.6.4-1.5-sqlite_file] commands = - sh -c "dropdb pytest_django_46; createdb pytest_django_46 || exit 0" - py.test {posargs} -basepython = python3.2 + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python2.6 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.5.8 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 django-configurations==0.8 - psycopg2==2.5.2 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_postgres PYTHONPATH = {toxinidir} UID = 46 -[testenv:python3.2-1.5-sqlite] +[testenv:python2.6-2.6.4-1.6-mysql_innodb] commands = - py.test {posargs} -basepython = python3.2 + sh -c "mysql -u root -e 'drop database if exists pytest_django_47; create database pytest_django_47'" || exit 0 + py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs} +basepython = python2.6 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.5.8 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 django-configurations==0.8 + south==1.0 + mysql-python==1.2.5 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite PYTHONPATH = {toxinidir} UID = 47 -[testenv:python3.2-1.6-postgres] +[testenv:python2.6-2.6.4-1.6-mysql_myisam] commands = - sh -c "dropdb pytest_django_48; createdb pytest_django_48 || exit 0" - py.test {posargs} -basepython = python3.2 + sh -c "mysql -u root -e 'drop database if exists pytest_django_48; create database pytest_django_48'" || exit 0 + py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs} +basepython = python2.6 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.6.5 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 django-configurations==0.8 - psycopg2==2.5.2 + south==1.0 + mysql-python==1.2.5 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_postgres PYTHONPATH = {toxinidir} UID = 48 -[testenv:python3.2-1.6-sqlite] +[testenv:python2.6-2.6.4-1.6-postgres] commands = - py.test {posargs} -basepython = python3.2 + sh -c "dropdb pytest_django_49; createdb pytest_django_49 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python2.6 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.6.5 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 django-configurations==0.8 + south==1.0 + psycopg2==2.5.2 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite PYTHONPATH = {toxinidir} UID = 49 -[testenv:python3.2-1.7-postgres] +[testenv:python2.6-2.6.4-1.6-sqlite] commands = - sh -c "dropdb pytest_django_50; createdb pytest_django_50 || exit 0" - py.test {posargs} -basepython = python3.2 + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python2.6 deps = - pytest==2.5.2 - pytest-xdist==1.10 - https://www.djangoproject.com/m/releases/1.7/Django-1.7b4.tar.gz + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 django-configurations==0.8 - psycopg2==2.5.2 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_postgres PYTHONPATH = {toxinidir} UID = 50 -[testenv:python3.2-1.7-sqlite] +[testenv:python2.6-2.6.4-1.6-sqlite_file] commands = - py.test {posargs} -basepython = python3.2 + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python2.6 deps = - pytest==2.5.2 - pytest-xdist==1.10 - https://www.djangoproject.com/m/releases/1.7/Django-1.7b4.tar.gz + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 django-configurations==0.8 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite PYTHONPATH = {toxinidir} UID = 51 -[testenv:python3.2-master-postgres] +[testenv:python2.7-2.6.4-1.3-mysql_innodb] commands = - sh -c "dropdb pytest_django_52; createdb pytest_django_52 || exit 0" - py.test {posargs} -basepython = python3.2 + sh -c "mysql -u root -e 'drop database if exists pytest_django_52; create database pytest_django_52'" || exit 0 + py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs} +basepython = python2.7 deps = - pytest==2.5.2 - pytest-xdist==1.10 - https://github.com/django/django/archive/master.zip + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.3,<1.4 django-configurations==0.8 - psycopg2==2.5.2 + south==1.0 + mysql-python==1.2.5 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_postgres PYTHONPATH = {toxinidir} UID = 52 -[testenv:python3.2-master-sqlite] +[testenv:python2.7-2.6.4-1.3-mysql_myisam] commands = - py.test {posargs} -basepython = python3.2 + sh -c "mysql -u root -e 'drop database if exists pytest_django_53; create database pytest_django_53'" || exit 0 + py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs} +basepython = python2.7 deps = - pytest==2.5.2 - pytest-xdist==1.10 - https://github.com/django/django/archive/master.zip + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.3,<1.4 django-configurations==0.8 + south==1.0 + mysql-python==1.2.5 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite PYTHONPATH = {toxinidir} UID = 53 -[testenv:python3.3-1.5-postgres] +[testenv:python2.7-2.6.4-1.3-postgres] commands = sh -c "dropdb pytest_django_54; createdb pytest_django_54 || exit 0" - py.test {posargs} -basepython = python3.3 + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python2.7 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.5.8 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.3,<1.4 django-configurations==0.8 - psycopg2==2.5.2 + south==1.0 + psycopg2==2.4.1 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_postgres PYTHONPATH = {toxinidir} UID = 54 -[testenv:python3.3-1.5-sqlite] +[testenv:python2.7-2.6.4-1.3-sqlite] commands = - py.test {posargs} -basepython = python3.3 + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python2.7 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.5.8 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.3,<1.4 django-configurations==0.8 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite PYTHONPATH = {toxinidir} UID = 55 -[testenv:python3.3-1.6-postgres] +[testenv:python2.7-2.6.4-1.3-sqlite_file] commands = - sh -c "dropdb pytest_django_56; createdb pytest_django_56 || exit 0" - py.test {posargs} -basepython = python3.3 + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python2.7 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.6.5 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.3,<1.4 django-configurations==0.8 - psycopg2==2.5.2 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_postgres PYTHONPATH = {toxinidir} UID = 56 -[testenv:python3.3-1.6-sqlite] +[testenv:python2.7-2.6.4-1.4-mysql_innodb] commands = - py.test {posargs} -basepython = python3.3 + sh -c "mysql -u root -e 'drop database if exists pytest_django_57; create database pytest_django_57'" || exit 0 + py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs} +basepython = python2.7 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.6.5 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.4,<1.5 django-configurations==0.8 + south==1.0 + mysql-python==1.2.5 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite PYTHONPATH = {toxinidir} UID = 57 -[testenv:python3.3-1.7-postgres] +[testenv:python2.7-2.6.4-1.4-mysql_myisam] commands = - sh -c "dropdb pytest_django_58; createdb pytest_django_58 || exit 0" - py.test {posargs} -basepython = python3.3 + sh -c "mysql -u root -e 'drop database if exists pytest_django_58; create database pytest_django_58'" || exit 0 + py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs} +basepython = python2.7 deps = - pytest==2.5.2 - pytest-xdist==1.10 - https://www.djangoproject.com/m/releases/1.7/Django-1.7b4.tar.gz + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.4,<1.5 django-configurations==0.8 - psycopg2==2.5.2 + south==1.0 + mysql-python==1.2.5 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_postgres PYTHONPATH = {toxinidir} UID = 58 -[testenv:python3.3-1.7-sqlite] +[testenv:python2.7-2.6.4-1.4-postgres] commands = - py.test {posargs} -basepython = python3.3 + sh -c "dropdb pytest_django_59; createdb pytest_django_59 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python2.7 deps = - pytest==2.5.2 - pytest-xdist==1.10 - https://www.djangoproject.com/m/releases/1.7/Django-1.7b4.tar.gz + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.4,<1.5 django-configurations==0.8 + south==1.0 + psycopg2==2.5.2 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite PYTHONPATH = {toxinidir} UID = 59 -[testenv:python3.3-master-postgres] +[testenv:python2.7-2.6.4-1.4-sqlite] commands = - sh -c "dropdb pytest_django_60; createdb pytest_django_60 || exit 0" - py.test {posargs} -basepython = python3.3 + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python2.7 deps = - pytest==2.5.2 - pytest-xdist==1.10 - https://github.com/django/django/archive/master.zip + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.4,<1.5 django-configurations==0.8 - psycopg2==2.5.2 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_postgres PYTHONPATH = {toxinidir} UID = 60 -[testenv:python3.3-master-sqlite] +[testenv:python2.7-2.6.4-1.4-sqlite_file] commands = - py.test {posargs} -basepython = python3.3 + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python2.7 deps = - pytest==2.5.2 - pytest-xdist==1.10 - https://github.com/django/django/archive/master.zip + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.4,<1.5 django-configurations==0.8 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite PYTHONPATH = {toxinidir} UID = 61 -[testenv:python3.4-1.5-postgres] +[testenv:python2.7-2.6.4-1.5-mysql_innodb] commands = - sh -c "dropdb pytest_django_62; createdb pytest_django_62 || exit 0" - py.test {posargs} -basepython = python3.4 + sh -c "mysql -u root -e 'drop database if exists pytest_django_62; create database pytest_django_62'" || exit 0 + py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs} +basepython = python2.7 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.5.8 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 django-configurations==0.8 - psycopg2==2.5.2 + south==1.0 + mysql-python==1.2.5 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_postgres PYTHONPATH = {toxinidir} UID = 62 -[testenv:python3.4-1.5-sqlite] +[testenv:python2.7-2.6.4-1.5-mysql_myisam] commands = - py.test {posargs} -basepython = python3.4 + sh -c "mysql -u root -e 'drop database if exists pytest_django_63; create database pytest_django_63'" || exit 0 + py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs} +basepython = python2.7 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.5.8 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 django-configurations==0.8 + south==1.0 + mysql-python==1.2.5 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite PYTHONPATH = {toxinidir} UID = 63 -[testenv:python3.4-1.6-postgres] +[testenv:python2.7-2.6.4-1.5-postgres] commands = sh -c "dropdb pytest_django_64; createdb pytest_django_64 || exit 0" - py.test {posargs} -basepython = python3.4 + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python2.7 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.6.5 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 django-configurations==0.8 + south==1.0 psycopg2==2.5.2 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_postgres PYTHONPATH = {toxinidir} UID = 64 -[testenv:python3.4-1.6-sqlite] +[testenv:python2.7-2.6.4-1.5-sqlite] commands = - py.test {posargs} -basepython = python3.4 + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python2.7 deps = - pytest==2.5.2 - pytest-xdist==1.10 - Django==1.6.5 + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 django-configurations==0.8 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite PYTHONPATH = {toxinidir} UID = 65 -[testenv:python3.4-1.7-postgres] +[testenv:python2.7-2.6.4-1.5-sqlite_file] commands = - sh -c "dropdb pytest_django_66; createdb pytest_django_66 || exit 0" - py.test {posargs} -basepython = python3.4 + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python2.7 deps = - pytest==2.5.2 - pytest-xdist==1.10 - https://www.djangoproject.com/m/releases/1.7/Django-1.7b4.tar.gz + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 django-configurations==0.8 - psycopg2==2.5.2 + south==1.0 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_postgres PYTHONPATH = {toxinidir} UID = 66 -[testenv:python3.4-1.7-sqlite] +[testenv:python2.7-2.6.4-1.6-mysql_innodb] commands = - py.test {posargs} -basepython = python3.4 + sh -c "mysql -u root -e 'drop database if exists pytest_django_67; create database pytest_django_67'" || exit 0 + py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs} +basepython = python2.7 deps = - pytest==2.5.2 - pytest-xdist==1.10 - https://www.djangoproject.com/m/releases/1.7/Django-1.7b4.tar.gz + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 django-configurations==0.8 + south==1.0 + mysql-python==1.2.5 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite PYTHONPATH = {toxinidir} UID = 67 -[testenv:python3.4-master-postgres] +[testenv:python2.7-2.6.4-1.6-mysql_myisam] commands = - sh -c "dropdb pytest_django_68; createdb pytest_django_68 || exit 0" - py.test {posargs} -basepython = python3.4 + sh -c "mysql -u root -e 'drop database if exists pytest_django_68; create database pytest_django_68'" || exit 0 + py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs} +basepython = python2.7 deps = - pytest==2.5.2 - pytest-xdist==1.10 - https://github.com/django/django/archive/master.zip + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 django-configurations==0.8 - psycopg2==2.5.2 + south==1.0 + mysql-python==1.2.5 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_postgres PYTHONPATH = {toxinidir} UID = 68 -[testenv:python3.4-master-sqlite] +[testenv:python2.7-2.6.4-1.6-postgres] commands = - py.test {posargs} -basepython = python3.4 + sh -c "dropdb pytest_django_69; createdb pytest_django_69 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python2.7 deps = - pytest==2.5.2 - pytest-xdist==1.10 - https://github.com/django/django/archive/master.zip + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 django-configurations==0.8 + south==1.0 + psycopg2==2.5.2 setenv = - DJANGO_SETTINGS_MODULE = tests.settings_sqlite PYTHONPATH = {toxinidir} UID = 69 + + +[testenv:python2.7-2.6.4-1.6-sqlite] +commands = + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python2.7 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 + django-configurations==0.8 + south==1.0 +setenv = + PYTHONPATH = {toxinidir} + UID = 70 + + +[testenv:python2.7-2.6.4-1.6-sqlite_file] +commands = + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python2.7 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 + django-configurations==0.8 + south==1.0 +setenv = + PYTHONPATH = {toxinidir} + UID = 71 + + +[testenv:python2.7-2.6.4-1.7-mysql_innodb] +commands = + sh -c "mysql -u root -e 'drop database if exists pytest_django_72; create database pytest_django_72'" || exit 0 + py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs} +basepython = python2.7 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.7,<1.8 + django-configurations==0.8 + south==1.0 + mysql-python==1.2.5 +setenv = + PYTHONPATH = {toxinidir} + UID = 72 + + +[testenv:python2.7-2.6.4-1.7-mysql_myisam] +commands = + sh -c "mysql -u root -e 'drop database if exists pytest_django_73; create database pytest_django_73'" || exit 0 + py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs} +basepython = python2.7 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.7,<1.8 + django-configurations==0.8 + south==1.0 + mysql-python==1.2.5 +setenv = + PYTHONPATH = {toxinidir} + UID = 73 + + +[testenv:python2.7-2.6.4-1.7-postgres] +commands = + sh -c "dropdb pytest_django_74; createdb pytest_django_74 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python2.7 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.7,<1.8 + django-configurations==0.8 + south==1.0 + psycopg2==2.5.2 +setenv = + PYTHONPATH = {toxinidir} + UID = 74 + + +[testenv:python2.7-2.6.4-1.7-sqlite] +commands = + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python2.7 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.7,<1.8 + django-configurations==0.8 + south==1.0 +setenv = + PYTHONPATH = {toxinidir} + UID = 75 + + +[testenv:python2.7-2.6.4-1.7-sqlite_file] +commands = + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python2.7 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.7,<1.8 + django-configurations==0.8 + south==1.0 +setenv = + PYTHONPATH = {toxinidir} + UID = 76 + + +[testenv:python2.7-2.6.4-1.8-mysql_innodb] +commands = + sh -c "mysql -u root -e 'drop database if exists pytest_django_77; create database pytest_django_77'" || exit 0 + py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs} +basepython = python2.7 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/stable/1.8.x.zip + django-configurations==0.8 + south==1.0 + mysql-python==1.2.5 +setenv = + PYTHONPATH = {toxinidir} + UID = 77 + + +[testenv:python2.7-2.6.4-1.8-mysql_myisam] +commands = + sh -c "mysql -u root -e 'drop database if exists pytest_django_78; create database pytest_django_78'" || exit 0 + py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs} +basepython = python2.7 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/stable/1.8.x.zip + django-configurations==0.8 + south==1.0 + mysql-python==1.2.5 +setenv = + PYTHONPATH = {toxinidir} + UID = 78 + + +[testenv:python2.7-2.6.4-1.8-postgres] +commands = + sh -c "dropdb pytest_django_79; createdb pytest_django_79 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python2.7 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/stable/1.8.x.zip + django-configurations==0.8 + south==1.0 + psycopg2==2.5.2 +setenv = + PYTHONPATH = {toxinidir} + UID = 79 + + +[testenv:python2.7-2.6.4-1.8-sqlite] +commands = + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python2.7 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/stable/1.8.x.zip + django-configurations==0.8 + south==1.0 +setenv = + PYTHONPATH = {toxinidir} + UID = 80 + + +[testenv:python2.7-2.6.4-1.8-sqlite_file] +commands = + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python2.7 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/stable/1.8.x.zip + django-configurations==0.8 + south==1.0 +setenv = + PYTHONPATH = {toxinidir} + UID = 81 + + +[testenv:python2.7-2.6.4-master-mysql_innodb] +commands = + sh -c "mysql -u root -e 'drop database if exists pytest_django_82; create database pytest_django_82'" || exit 0 + py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs} +basepython = python2.7 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/master.zip + django-configurations==0.8 + south==1.0 + mysql-python==1.2.5 +setenv = + PYTHONPATH = {toxinidir} + UID = 82 + + +[testenv:python2.7-2.6.4-master-mysql_myisam] +commands = + sh -c "mysql -u root -e 'drop database if exists pytest_django_83; create database pytest_django_83'" || exit 0 + py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs} +basepython = python2.7 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/master.zip + django-configurations==0.8 + south==1.0 + mysql-python==1.2.5 +setenv = + PYTHONPATH = {toxinidir} + UID = 83 + + +[testenv:python2.7-2.6.4-master-postgres] +commands = + sh -c "dropdb pytest_django_84; createdb pytest_django_84 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python2.7 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/master.zip + django-configurations==0.8 + south==1.0 + psycopg2==2.5.2 +setenv = + PYTHONPATH = {toxinidir} + UID = 84 + + +[testenv:python2.7-2.6.4-master-sqlite] +commands = + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python2.7 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/master.zip + django-configurations==0.8 + south==1.0 +setenv = + PYTHONPATH = {toxinidir} + UID = 85 + + +[testenv:python2.7-2.6.4-master-sqlite_file] +commands = + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python2.7 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/master.zip + django-configurations==0.8 + south==1.0 +setenv = + PYTHONPATH = {toxinidir} + UID = 86 + + +[testenv:python3.2-2.6.4-1.5-postgres] +commands = + sh -c "dropdb pytest_django_87; createdb pytest_django_87 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python3.2 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 + django-configurations==0.8 + psycopg2==2.5.2 +setenv = + PYTHONPATH = {toxinidir} + UID = 87 + + +[testenv:python3.2-2.6.4-1.5-sqlite] +commands = + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python3.2 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 88 + + +[testenv:python3.2-2.6.4-1.5-sqlite_file] +commands = + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python3.2 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 89 + + +[testenv:python3.2-2.6.4-1.6-postgres] +commands = + sh -c "dropdb pytest_django_90; createdb pytest_django_90 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python3.2 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 + django-configurations==0.8 + psycopg2==2.5.2 +setenv = + PYTHONPATH = {toxinidir} + UID = 90 + + +[testenv:python3.2-2.6.4-1.6-sqlite] +commands = + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python3.2 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 91 + + +[testenv:python3.2-2.6.4-1.6-sqlite_file] +commands = + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python3.2 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 92 + + +[testenv:python3.2-2.6.4-1.7-postgres] +commands = + sh -c "dropdb pytest_django_93; createdb pytest_django_93 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python3.2 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.7,<1.8 + django-configurations==0.8 + psycopg2==2.5.2 +setenv = + PYTHONPATH = {toxinidir} + UID = 93 + + +[testenv:python3.2-2.6.4-1.7-sqlite] +commands = + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python3.2 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.7,<1.8 + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 94 + + +[testenv:python3.2-2.6.4-1.7-sqlite_file] +commands = + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python3.2 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.7,<1.8 + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 95 + + +[testenv:python3.2-2.6.4-1.8-postgres] +commands = + sh -c "dropdb pytest_django_96; createdb pytest_django_96 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python3.2 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/stable/1.8.x.zip + django-configurations==0.8 + psycopg2==2.5.2 +setenv = + PYTHONPATH = {toxinidir} + UID = 96 + + +[testenv:python3.2-2.6.4-1.8-sqlite] +commands = + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python3.2 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/stable/1.8.x.zip + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 97 + + +[testenv:python3.2-2.6.4-1.8-sqlite_file] +commands = + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python3.2 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/stable/1.8.x.zip + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 98 + + +[testenv:python3.2-2.6.4-master-postgres] +commands = + sh -c "dropdb pytest_django_99; createdb pytest_django_99 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python3.2 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/master.zip + django-configurations==0.8 + psycopg2==2.5.2 +setenv = + PYTHONPATH = {toxinidir} + UID = 99 + + +[testenv:python3.2-2.6.4-master-sqlite] +commands = + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python3.2 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/master.zip + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 100 + + +[testenv:python3.2-2.6.4-master-sqlite_file] +commands = + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python3.2 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/master.zip + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 101 + + +[testenv:python3.3-2.6.4-1.5-postgres] +commands = + sh -c "dropdb pytest_django_102; createdb pytest_django_102 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python3.3 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 + django-configurations==0.8 + psycopg2==2.5.2 +setenv = + PYTHONPATH = {toxinidir} + UID = 102 + + +[testenv:python3.3-2.6.4-1.5-sqlite] +commands = + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python3.3 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 103 + + +[testenv:python3.3-2.6.4-1.5-sqlite_file] +commands = + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python3.3 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 104 + + +[testenv:python3.3-2.6.4-1.6-postgres] +commands = + sh -c "dropdb pytest_django_105; createdb pytest_django_105 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python3.3 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 + django-configurations==0.8 + psycopg2==2.5.2 +setenv = + PYTHONPATH = {toxinidir} + UID = 105 + + +[testenv:python3.3-2.6.4-1.6-sqlite] +commands = + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python3.3 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 106 + + +[testenv:python3.3-2.6.4-1.6-sqlite_file] +commands = + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python3.3 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 107 + + +[testenv:python3.3-2.6.4-1.7-postgres] +commands = + sh -c "dropdb pytest_django_108; createdb pytest_django_108 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python3.3 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.7,<1.8 + django-configurations==0.8 + psycopg2==2.5.2 +setenv = + PYTHONPATH = {toxinidir} + UID = 108 + + +[testenv:python3.3-2.6.4-1.7-sqlite] +commands = + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python3.3 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.7,<1.8 + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 109 + + +[testenv:python3.3-2.6.4-1.7-sqlite_file] +commands = + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python3.3 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.7,<1.8 + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 110 + + +[testenv:python3.3-2.6.4-1.8-postgres] +commands = + sh -c "dropdb pytest_django_111; createdb pytest_django_111 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python3.3 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/stable/1.8.x.zip + django-configurations==0.8 + psycopg2==2.5.2 +setenv = + PYTHONPATH = {toxinidir} + UID = 111 + + +[testenv:python3.3-2.6.4-1.8-sqlite] +commands = + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python3.3 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/stable/1.8.x.zip + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 112 + + +[testenv:python3.3-2.6.4-1.8-sqlite_file] +commands = + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python3.3 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/stable/1.8.x.zip + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 113 + + +[testenv:python3.3-2.6.4-master-postgres] +commands = + sh -c "dropdb pytest_django_114; createdb pytest_django_114 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python3.3 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/master.zip + django-configurations==0.8 + psycopg2==2.5.2 +setenv = + PYTHONPATH = {toxinidir} + UID = 114 + + +[testenv:python3.3-2.6.4-master-sqlite] +commands = + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python3.3 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/master.zip + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 115 + + +[testenv:python3.3-2.6.4-master-sqlite_file] +commands = + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python3.3 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/master.zip + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 116 + + +[testenv:python3.4-2.6.4-1.5-postgres] +commands = + sh -c "dropdb pytest_django_117; createdb pytest_django_117 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python3.4 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 + django-configurations==0.8 + psycopg2==2.5.2 +setenv = + PYTHONPATH = {toxinidir} + UID = 117 + + +[testenv:python3.4-2.6.4-1.5-sqlite] +commands = + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python3.4 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 118 + + +[testenv:python3.4-2.6.4-1.5-sqlite_file] +commands = + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python3.4 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.5,<1.6 + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 119 + + +[testenv:python3.4-2.6.4-1.6-postgres] +commands = + sh -c "dropdb pytest_django_120; createdb pytest_django_120 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python3.4 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 + django-configurations==0.8 + psycopg2==2.5.2 +setenv = + PYTHONPATH = {toxinidir} + UID = 120 + + +[testenv:python3.4-2.6.4-1.6-sqlite] +commands = + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python3.4 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 121 + + +[testenv:python3.4-2.6.4-1.6-sqlite_file] +commands = + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python3.4 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.6,<1.7 + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 122 + + +[testenv:python3.4-2.6.4-1.7-postgres] +commands = + sh -c "dropdb pytest_django_123; createdb pytest_django_123 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python3.4 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.7,<1.8 + django-configurations==0.8 + psycopg2==2.5.2 +setenv = + PYTHONPATH = {toxinidir} + UID = 123 + + +[testenv:python3.4-2.6.4-1.7-sqlite] +commands = + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python3.4 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.7,<1.8 + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 124 + + +[testenv:python3.4-2.6.4-1.7-sqlite_file] +commands = + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python3.4 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + Django>=1.7,<1.8 + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 125 + + +[testenv:python3.4-2.6.4-1.8-postgres] +commands = + sh -c "dropdb pytest_django_126; createdb pytest_django_126 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python3.4 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/stable/1.8.x.zip + django-configurations==0.8 + psycopg2==2.5.2 +setenv = + PYTHONPATH = {toxinidir} + UID = 126 + + +[testenv:python3.4-2.6.4-1.8-sqlite] +commands = + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python3.4 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/stable/1.8.x.zip + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 127 + + +[testenv:python3.4-2.6.4-1.8-sqlite_file] +commands = + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python3.4 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/stable/1.8.x.zip + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 128 + + +[testenv:python3.4-2.6.4-master-postgres] +commands = + sh -c "dropdb pytest_django_129; createdb pytest_django_129 || exit 0" + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} +basepython = python3.4 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/master.zip + django-configurations==0.8 + psycopg2==2.5.2 +setenv = + PYTHONPATH = {toxinidir} + UID = 129 + + +[testenv:python3.4-2.6.4-master-sqlite] +commands = + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} +basepython = python3.4 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/master.zip + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 130 + + +[testenv:python3.4-2.6.4-master-sqlite_file] +commands = + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} +basepython = python3.4 +deps = + pytest==2.6.4 + pytest-xdist==1.11 + https://github.com/django/django/archive/master.zip + django-configurations==0.8 +setenv = + PYTHONPATH = {toxinidir} + UID = 131 From 2eefcd95b78831f37b2ed5becbcc177c3a0401d2 Mon Sep 17 00:00:00 2001 From: Alexander Karev Date: Thu, 21 May 2015 03:49:40 +0300 Subject: [PATCH 4/4] revert to current master --- .travis.yml | 56 +- Makefile | 9 +- README.rst | 7 + docs/changelog.rst | 4 +- docs/faq.rst | 4 +- docs/managing_python_path.rst | 4 +- generate_configurations.py | 54 +- pytest_django/db_reuse.py | 6 +- pytest_django/fixtures.py | 166 ++-- pytest_django/lazy_django.py | 4 +- pytest_django/live_server_helper.py | 4 +- pytest_django/plugin.py | 50 +- pytest_django_test/db_helpers.py | 4 +- requirements.txt | 1 - setup.cfg | 2 +- setup.py | 1 + tests/conftest.py | 41 +- tests/test_database.py | 43 +- tests/test_db_setup.py | 176 +++- tests/test_django_configurations.py | 15 +- tests/test_django_settings_module.py | 59 +- tests/test_environment.py | 88 +- tests/test_fixtures.py | 12 +- tests/test_manage_py_scan.py | 3 + tests/test_unittest.py | 69 ++ tox.ini | 1204 +++++++++++++------------- 26 files changed, 1231 insertions(+), 855 deletions(-) diff --git a/.travis.yml b/.travis.yml index c1192be50..aa32c1a45 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,31 +1,43 @@ +# Use container-based environment (faster startup, allows caches). +sudo: false language: python python: - "3.4" env: - - TESTENV=pypy-2.6.4-master-sqlite_file - - TESTENV=pypy3-2.6.4-master-sqlite_file - - TESTENV=python2.6-2.6.4-1.6-sqlite_file - - TESTENV=python2.7-2.6.4-1.3-sqlite_file - - TESTENV=python2.7-2.6.4-1.4-sqlite_file - - TESTENV=python2.7-2.6.4-master-mysql_innodb - - TESTENV=python2.7-2.6.4-master-mysql_myisam - - TESTENV=python2.7-2.6.4-master-sqlite_file - - TESTENV=python3.2-2.6.4-master-sqlite_file - - TESTENV=python3.3-2.6.4-master-sqlite_file - - TESTENV=python3.4-2.6.4-1.5-sqlite_file - - TESTENV=python3.4-2.6.4-1.6-sqlite_file - - TESTENV=python3.4-2.6.4-1.7-sqlite_file - - TESTENV=python3.4-2.6.4-1.8-sqlite_file - - TESTENV=python3.4-2.6.4-master-postgres - - TESTENV=python3.4-2.6.4-master-sqlite - - TESTENV=python3.4-2.6.4-master-sqlite_file - - TESTENV=checkqa-python2.6 + - 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.2 - - TESTENV=checkqa-python3.3 - TESTENV=checkqa-python3.4 - - TESTENV=checkqa-pypy - - TESTENV=checkqa-pypy3 +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 \ No newline at end of file diff --git a/Makefile b/Makefile index 063ec03ef..efbc011f7 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,12 @@ .PHONY: docs test clean isort -export DJANGO_SETTINGS_MODULE?=tests.settings_sqlite +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 . @@ -12,10 +15,6 @@ 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 diff --git a/README.rst b/README.rst index c700fa595..e3a69a60c 100644 --- a/README.rst +++ b/README.rst @@ -26,6 +26,13 @@ pytest-django allows you to test your Django project/applications with the * `Issue tracker `_ * `Python Package Index (PyPI) `_ +Install pytest-django +--------------------- + +:: + + pip install pytest-django + Why would I use this instead of Django's `manage.py test` command? ------------------------------------------------------------------ diff --git a/docs/changelog.rst b/docs/changelog.rst index a5774fad8..4d9884e51 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -157,11 +157,11 @@ 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``. diff --git a/docs/faq.rst b/docs/faq.rst index d69d4c0aa..a9851fe84 100644 --- a/docs/faq.rst +++ b/docs/faq.rst @@ -10,7 +10,7 @@ pytest-django tries to automatically add your project to the Python path by looking for a ``manage.py`` file and adding its path to the Python path. If this for some reason fails for you, you have to manage your Python paths -explicilty. See the documentation on :ref:`managing_the_python_path_explicilty` +explicitly. See the documentation on :ref:`managing_the_python_path_explicitly` for more information. How can I make sure that all my tests run with a specific locale? @@ -50,7 +50,7 @@ pytest-django detects South and applies its monkey-patch, which gets fixed to handle initial data properly (which South would skip otherwise, because of a bug). -The ``SOUTH_TESTS_MIGRATE`` Django setting can be used to control wheter or not +The ``SOUTH_TESTS_MIGRATE`` Django setting can be used to control whether migrations are used to construct the test database. Does pytest-django work with the pytest-xdist plugin? diff --git a/docs/managing_python_path.rst b/docs/managing_python_path.rst index 3ba5927b4..6340f5f40 100644 --- a/docs/managing_python_path.rst +++ b/docs/managing_python_path.rst @@ -28,9 +28,9 @@ in your project, the automatic detection may not be correct. See :ref:`managing_the_python_path_explicilty` for more details on how to configure your environment in that case. -.. _managing_the_python_path_explicilty: +.. _managing_the_python_path_explicitly: -Managing the Python path explicilty +Managing the Python path explicitly ----------------------------------- First, disable the automatic Django project finder. Add this to diff --git a/generate_configurations.py b/generate_configurations.py index 3e90fe104..7795c691b 100755 --- a/generate_configurations.py +++ b/generate_configurations.py @@ -24,9 +24,10 @@ def is_pypy(self): # Python to run tox. RUN_PYTHON = '3.4' +PYTHON_MAIN_VERSIONS = ['python2.7', 'python3.4'] PYTHON_VERSIONS = ['python2.6', 'python2.7', 'python3.2', 'python3.3', 'python3.4', 'pypy', 'pypy3'] -PYTEST_VERSIONS = ['2.6.4'] +PYTEST_VERSIONS = ['2.7.0'] DJANGO_VERSIONS = ['1.3', '1.4', '1.5', '1.6', '1.7', '1.8', 'master'] SETTINGS = ['sqlite', 'sqlite_file', 'mysql_myisam', 'mysql_innodb', 'postgres'] @@ -36,8 +37,8 @@ def is_pypy(self): '1.5': 'Django>=1.5,<1.6', '1.6': 'Django>=1.6,<1.7', '1.7': 'Django>=1.7,<1.8', - '1.8': 'https://github.com/django/django/archive/stable/1.8.x.zip', - 'master': 'https://github.com/django/django/archive/master.zip', + '1.8': 'https://github.com/django/django/archive/stable/1.8.x.tar.gz', + 'master': 'https://github.com/django/django/archive/master.tar.gz', } TOX_TESTENV_TEMPLATE = dedent(""" @@ -77,12 +78,12 @@ def is_valid_env(env): def requirements(env): yield 'pytest==%s' % (env.pytest_version) - yield 'pytest-xdist==1.11' + yield 'pytest-xdist==1.12' yield DJANGO_REQUIREMENTS[env.django_version] yield 'django-configurations==0.8' if env.is_py2(): - yield 'south==1.0' + yield 'south==1.0.2' if env.settings == 'postgres': # Django 1.3 does not work with recent psycopg2 versions @@ -109,10 +110,12 @@ def commands(uid, env): yield 'sh -c "dropdb %(name)s;' \ ' createdb %(name)s || exit 0"' % {'name': db_name} - yield 'py.test --ds=pytest_django_test.settings_%s --strict -r fEsxXw {posargs}' % env.settings + yield 'py.test --ds=pytest_django_test.settings_%s --strict -r fEsxXw {posargs:tests}' % env.settings def testenv_name(env): + if len(PYTEST_VERSIONS) == 1: + env = [getattr(env, x) for x in env._fields if x != 'pytest_version'] return '-'.join(env) @@ -136,8 +139,8 @@ def generate_all_envs(): products = itertools.product(PYTHON_VERSIONS, PYTEST_VERSIONS, DJANGO_VERSIONS, SETTINGS) - for idx, (python_version, pytest_version, django_version, settings) \ - in enumerate(products): + for (python_version, pytest_version, django_version, settings) \ + in products: env = TestEnv(python_version, pytest_version, django_version, settings) if is_valid_env(env): @@ -153,11 +156,19 @@ def generate_default_envs(envs): def find_and_add(variations, env_getter): for variation in variations: + for existing in result: + if env_getter(existing) == variation: + return + for env in reversed(envs): if env_getter(env) == variation: result.add(env) break + # Add all Django versions for each main python version (2.x and 3.x). + find_and_add(itertools.product(PYTHON_MAIN_VERSIONS, DJANGO_VERSIONS), + lambda env: (env.python_version, env.django_version)) + find_and_add(PYTHON_VERSIONS, lambda env: env.python_version) find_and_add(PYTEST_VERSIONS, lambda env: env.pytest_version) find_and_add(DJANGO_VERSIONS, lambda env: env.django_version) @@ -168,7 +179,8 @@ def find_and_add(variations, env_getter): def make_tox_ini(envs, default_envs): default_env_names = ([testenv_name(env) for env in default_envs] + - ['checkqa-%s' % python_version for python_version in PYTHON_VERSIONS]) + ['checkqa-%s' % python_version for python_version in + PYTHON_MAIN_VERSIONS]) contents = [dedent(''' [tox] @@ -207,23 +219,45 @@ def make_tox_ini(envs, default_envs): def make_travis_yml(envs): contents = dedent(""" + # Use container-based environment (faster startup, allows caches). + sudo: false language: python python: - "%(RUN_PYTHON)s" env: %(testenvs)s %(checkenvs)s + matrix: + allow_failures: + %(allow_failures)s 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 """).strip("\n") testenvs = '\n'.join(' - TESTENV=%s' % testenv_name(env) for env in envs) checkenvs = '\n'.join(' - TESTENV=checkqa-%s' % - python for python in PYTHON_VERSIONS) + python for python in PYTHON_MAIN_VERSIONS) + allow_failures = '\n'.join(' - env: TESTENV=%s' % + testenv_name(env) for env in envs + if env.django_version == 'master') return contents % { 'testenvs': testenvs, 'checkenvs': checkenvs, + 'allow_failures': allow_failures, 'RUN_PYTHON': RUN_PYTHON, } diff --git a/pytest_django/db_reuse.py b/pytest_django/db_reuse.py index 6517dd62a..0dcff90b1 100644 --- a/pytest_django/db_reuse.py +++ b/pytest_django/db_reuse.py @@ -75,9 +75,9 @@ def monkey_patch_creation_for_db_suffix(suffix=None): if suffix is not None: def _get_test_db_name(self): - """ - Internal implementation - returns the name of the test DB that will - be created. Only useful when called from create_test_db() and + """Internal: return the name of the test DB that will be created. + + This is only useful when called from create_test_db() and _create_test_db() and when no external munging is done with the 'NAME' or 'TEST_NAME' settings. """ diff --git a/pytest_django/fixtures.py b/pytest_django/fixtures.py index 1381940d5..462bb49be 100644 --- a/pytest_django/fixtures.py +++ b/pytest_django/fixtures.py @@ -32,10 +32,7 @@ def _django_db_setup(request, # xdist if hasattr(request.config, 'slaveinput'): - if request.config.getvalue('xdist_one_db'): - db_suffix = None - else: - db_suffix = request.config.slaveinput['slaveid'] + db_suffix = request.config.slaveinput['slaveid'] else: db_suffix = None @@ -53,7 +50,8 @@ def _django_db_setup(request, monkey_patch_creation_for_db_reuse() # Create the database - db_cfg = setup_databases(verbosity=0, interactive=False) + db_cfg = setup_databases(verbosity=pytest.config.option.verbose, + interactive=False) def teardown_database(): with _django_cursor_wrapper: @@ -67,72 +65,86 @@ def _django_db_fixture_helper(transactional, request, _django_cursor_wrapper): if is_django_unittest(request): return + if not transactional and 'live_server' in request.funcargnames: + # Do nothing, we get called with transactional=True, too. + return + + django_case = None + + _django_cursor_wrapper.enable() + request.addfinalizer(_django_cursor_wrapper.disable) + if transactional: - _django_cursor_wrapper.enable() - - def flushdb(): - """Flush the database and close database connections""" - # Django does this by default *before* each test - # instead of after. - from django.db import connections - from django.core.management import call_command - - for db in connections: - call_command('flush', verbosity=0, - interactive=False, database=db) - for conn in connections.all(): - conn.close() - - request.addfinalizer(_django_cursor_wrapper.disable) - request.addfinalizer(flushdb) + from django import get_version + + if get_version() >= '1.5': + from django.test import TransactionTestCase as django_case + + else: + # Django before 1.5 flushed the DB during setUp. + # Use pytest-django's old behavior with it. + def flushdb(): + """Flush the database and close database connections""" + # Django does this by default *before* each test + # instead of after. + from django.db import connections + from django.core.management import call_command + + for db in connections: + call_command('flush', interactive=False, database=db, + verbosity=pytest.config.option.verbose) + for conn in connections.all(): + conn.close() + request.addfinalizer(flushdb) + else: - if 'live_server' in request.funcargnames: - return - from django.test import TestCase + from django.test import TestCase as django_case - _django_cursor_wrapper.enable() - _django_cursor_wrapper._is_transactional = False - case = TestCase(methodName='__init__') + if django_case: + case = django_case(methodName='__init__') case._pre_setup() - request.addfinalizer(_django_cursor_wrapper.disable) request.addfinalizer(case._post_teardown) def _handle_south(): from django.conf import settings - if 'south' in settings.INSTALLED_APPS: - # Handle south. - from django.core import management - - try: - # if `south` >= 0.7.1 we can use the test helper - from south.management.commands import patch_for_test_db_setup - except ImportError: - # if `south` < 0.7.1 make sure it's migrations are disabled - management.get_commands() - management._commands['syncdb'] = 'django.core' - else: - # Monkey-patch south.hacks.django_1_0.SkipFlushCommand to load - # initial data. - # Ref: http://south.aeracode.org/ticket/1395#comment:3 - import south.hacks.django_1_0 - from django.core.management.commands.flush import ( - Command as FlushCommand) - - class SkipFlushCommand(FlushCommand): - def handle_noargs(self, **options): + + # NOTE: Django 1.7 does not have `management._commands` anymore, which + # is used by South's `patch_for_test_db_setup` and the code below. + if 'south' not in settings.INSTALLED_APPS or get_django_version() > (1, 7): + return + + from django.core import management + + try: + # if `south` >= 0.7.1 we can use the test helper + from south.management.commands import patch_for_test_db_setup + except ImportError: + # if `south` < 0.7.1 make sure its migrations are disabled + management.get_commands() + management._commands['syncdb'] = 'django.core' + else: + # Monkey-patch south.hacks.django_1_0.SkipFlushCommand to load + # initial data. + # Ref: http://south.aeracode.org/ticket/1395#comment:3 + import south.hacks.django_1_0 + from django.core.management.commands.flush import ( + Command as FlushCommand) + + class SkipFlushCommand(FlushCommand): + def handle_noargs(self, **options): + # Reinstall the initial_data fixture. + from django.core.management import call_command + # `load_initial_data` got introduces with Django 1.5. + load_initial_data = options.get('load_initial_data', None) + if load_initial_data or load_initial_data is None: # Reinstall the initial_data fixture. - from django.core.management import call_command - # `load_initial_data` got introduces with Django 1.5. - load_initial_data = options.get('load_initial_data', None) - if load_initial_data or load_initial_data is None: - # Reinstall the initial_data fixture. - call_command('loaddata', 'initial_data', **options) - # no-op to avoid calling flush - return - south.hacks.django_1_0.SkipFlushCommand = SkipFlushCommand + call_command('loaddata', 'initial_data', **options) + # no-op to avoid calling flush + return + south.hacks.django_1_0.SkipFlushCommand = SkipFlushCommand - patch_for_test_db_setup() + patch_for_test_db_setup() def _disable_native_migrations(): @@ -151,17 +163,19 @@ def _disable_native_migrations(): def db(request, _django_db_setup, _django_cursor_wrapper): """Require a django test database - This database will be setup with the default fixtures and will - have the transaction management disabled. At the end of the test - the transaction will be rolled back to undo any changes to the - database. This is more limited than the ``transactional_db`` - resource but faster. + This database will be setup with the default fixtures and will have + the transaction management disabled. At the end of the test the outer + transaction that wraps the test itself will be rolled back to undo any + changes to the database (in case the backend supports transactions). + This is more limited than the ``transactional_db`` resource but + faster. If both this and ``transactional_db`` are requested then the database setup will behave as only ``transactional_db`` was requested. """ - if 'transactional_db' in request.funcargnames: + if 'transactional_db' in request.funcargnames \ + or 'live_server' in request.funcargnames: return request.getfuncargvalue('transactional_db') return _django_db_fixture_helper(False, request, _django_cursor_wrapper) @@ -193,9 +207,7 @@ def client(): @pytest.fixture() def django_user_model(db): - """ - The class of Django's user model. - """ + """The class of Django's user model.""" try: from django.contrib.auth import get_user_model except ImportError: @@ -208,9 +220,7 @@ def django_user_model(db): @pytest.fixture() def django_username_field(django_user_model): - """ - The fieldname for the username used with Django's user model. - """ + """The fieldname for the username used with Django's user model.""" try: return django_user_model.USERNAME_FIELD except AttributeError: @@ -220,8 +230,7 @@ def django_username_field(django_user_model): @pytest.fixture() def admin_user(db, django_user_model, django_username_field): - """ - A Django admin user. + """A Django admin user. This uses an existing user with username "admin", or creates a new one with password "password". @@ -242,10 +251,7 @@ def admin_user(db, django_user_model, django_username_field): @pytest.fixture() def admin_client(db, admin_user): - """ - A Django test client logged in as an admin user (via the ``admin_user`` - fixture). - """ + """A Django test client logged in as an admin user.""" from django.test.client import Client client = Client() @@ -281,7 +287,7 @@ def __delattr__(self, attr): @pytest.fixture() -def settings(request, monkeypatch): +def settings(monkeypatch): """A Django settings object which restores changes after the testrun""" skip_if_no_django() @@ -329,7 +335,7 @@ def live_server(request): @pytest.fixture(autouse=True, scope='function') def _live_server_helper(request): - """Helper to make live_server work, internal to pytest-django + """Helper to make live_server work, internal to pytest-django. This helper will dynamically request the transactional_db fixture for a test which uses the live_server fixture. This allows the diff --git a/pytest_django/lazy_django.py b/pytest_django/lazy_django.py index f68993512..4ba4d5aa7 100644 --- a/pytest_django/lazy_django.py +++ b/pytest_django/lazy_django.py @@ -17,13 +17,11 @@ def skip_if_no_django(): def django_settings_is_configured(): # Avoid importing Django if it has not yet been imported if not os.environ.get('DJANGO_SETTINGS_MODULE') \ - and 'django' not in sys.modules: + and 'django.conf' not in sys.modules: return False # If DJANGO_SETTINGS_MODULE is defined at this point, Django is assumed to # always be loaded. - from django.conf import settings - assert settings.configured is True return True diff --git a/pytest_django/live_server_helper.py b/pytest_django/live_server_helper.py index 3d64c2b4b..f3002fba4 100644 --- a/pytest_django/live_server_helper.py +++ b/pytest_django/live_server_helper.py @@ -30,8 +30,8 @@ def __init__(self, addr): for conn in connections.all(): # If using in-memory sqlite databases, pass the connections to # the server thread. - if (conn.settings_dict['ENGINE'] == 'django.db.backends.sqlite3' - and conn.settings_dict['NAME'] == ':memory:'): + if (conn.settings_dict['ENGINE'] == 'django.db.backends.sqlite3' and + conn.settings_dict['NAME'] == ':memory:'): # Explicitly enable thread-shareability for this connection conn.allow_thread_sharing = True connections_override[conn.alias] = conn diff --git a/pytest_django/plugin.py b/pytest_django/plugin.py index 96ecb2c25..111e1c078 100644 --- a/pytest_django/plugin.py +++ b/pytest_django/plugin.py @@ -4,12 +4,13 @@ test database and provides some useful text fixtures. """ -import os - import contextlib +import os +import sys +import types +import py import pytest -import types from .django_compat import is_django_unittest from .fixtures import (_django_db_setup, _live_server_helper, admin_client, @@ -41,9 +42,6 @@ def pytest_addoption(parser): action='store_true', dest='create_db', default=False, help='Re-create the database, even if it exists. This ' 'option will be ignored if not --reuse-db is given.') - group._addoption('--xdist-one-db', - action='store_true', dest='xdist_one_db', default=False, - help='Use only one database with xdist plugin.') group._addoption('--ds', action='store', type='string', dest='ds', default=None, help='Set DJANGO_SETTINGS_MODULE.') @@ -65,9 +63,6 @@ def pytest_addoption(parser): 'Python path.', default=True) -import py -import sys - def _exists(path, ignore=EnvironmentError): try: @@ -79,11 +74,11 @@ def _exists(path, ignore=EnvironmentError): PROJECT_FOUND = ('pytest-django found a Django project in %s ' '(it contains manage.py) and added it to the Python path.\n' 'If this is wrong, add "django_find_project = false" to ' - 'pytest.ini and expliclity manage your Python path.') + 'pytest.ini and explicitly manage your Python path.') PROJECT_NOT_FOUND = ('pytest-django could not find a Django project ' '(no manage.py file could be found). You must ' - 'expliclity add your Django project to the Python path ' + 'explicitly add your Django project to the Python path ' 'to have it picked up.') PROJECT_SCAN_DISABLED = ('pytest-django did not search for Django ' @@ -177,13 +172,13 @@ def pytest_load_initial_conftests(early_config, parser, args): # Configure DJANGO_SETTINGS_MODULE ds = (options.ds or - early_config.getini(SETTINGS_MODULE_ENV) or - os.environ.get(SETTINGS_MODULE_ENV)) + os.environ.get(SETTINGS_MODULE_ENV) or + early_config.getini(SETTINGS_MODULE_ENV)) # Configure DJANGO_CONFIGURATION dc = (options.dc or - early_config.getini(CONFIGURATION_ENV) or - os.environ.get(CONFIGURATION_ENV)) + os.environ.get(CONFIGURATION_ENV) or + early_config.getini(CONFIGURATION_ENV)) if ds: os.environ[SETTINGS_MODULE_ENV] = ds @@ -229,7 +224,7 @@ def pytest_runtest_setup(item): @pytest.fixture(autouse=True, scope='session') def _django_test_environment(request): """ - Ensure that Django is loaded and has its testing environment setup + Ensure that Django is loaded and has its testing environment setup. XXX It is a little dodgy that this is an autouse fixture. Perhaps an email fixture should be requested in order to be able to @@ -248,7 +243,7 @@ def _django_test_environment(request): @pytest.fixture(autouse=True, scope='session') def _django_cursor_wrapper(request): - """The django cursor wrapper, internal to pytest-django + """The django cursor wrapper, internal to pytest-django. This will globally disable all database access. The object returned has a .enable() and a .disable() method which can be used @@ -273,7 +268,7 @@ def _django_cursor_wrapper(request): @pytest.fixture(autouse=True) def _django_db_marker(request): - """Implement the django_db marker, internal to pytest-django + """Implement the django_db marker, internal to pytest-django. This will dynamically request the ``db`` or ``transactional_db`` fixtures as required by the django_db marker. @@ -289,7 +284,7 @@ def _django_db_marker(request): @pytest.fixture(autouse=True, scope='class') def _django_setup_unittest(request, _django_cursor_wrapper): - """Setup a django unittest, internal to pytest-django""" + """Setup a django unittest, internal to pytest-django.""" if django_settings_is_configured() and is_django_unittest(request): request.getfuncargvalue('_django_test_environment') request.getfuncargvalue('_django_db_setup') @@ -305,8 +300,8 @@ def teardown(): @pytest.fixture(autouse=True, scope='function') -def _django_clear_outbox(request): - """Clear the django outbox, internal to pytest-django""" +def _django_clear_outbox(): + """Clear the django outbox, internal to pytest-django.""" if django_settings_is_configured(): from django.core import mail mail.outbox = [] @@ -314,7 +309,7 @@ def _django_clear_outbox(request): @pytest.fixture(autouse=True, scope='function') def _django_set_urlconf(request): - """Apply the @pytest.mark.urls marker, internal to pytest-django""" + """Apply the @pytest.mark.urls marker, internal to pytest-django.""" marker = request.keywords.get('urls', None) if marker: skip_if_no_django() @@ -336,7 +331,7 @@ def restore(): class CursorManager(object): - """Manager for django.db.backends.util.CursorWrapper + """Manager for django.db.backends.util.CursorWrapper. This is the object returned by _django_cursor_wrapper. @@ -356,14 +351,15 @@ def _blocking_wrapper(*args, **kwargs): __tracebackhide__ = True __tracebackhide__ # Silence pyflakes pytest.fail('Database access not allowed, ' - 'use the "django_db" mark to enable') + 'use the "django_db" mark to enable it.') def enable(self): - """Enable access to the django database""" + """Enable access to the Django database.""" self._save_active_wrapper() self._dbutil.CursorWrapper = self._real_wrapper def disable(self): + """Disable access to the Django database.""" self._save_active_wrapper() self._dbutil.CursorWrapper = self._blocking_wrapper @@ -378,7 +374,7 @@ def __exit__(self, exc_type, exc_value, traceback): def validate_django_db(marker): - """This function validates the django_db marker + """Validate the django_db marker. It checks the signature and creates the `transaction` attribute on the marker which will have the correct value. @@ -389,7 +385,7 @@ def apifun(transaction=False): def validate_urls(marker): - """This function validates the urls marker + """Validate the urls marker. It checks the signature and creates the `urls` attribute on the marker which will have the correct value. diff --git a/pytest_django_test/db_helpers.py b/pytest_django_test/db_helpers.py index 3e91eb2b3..bdfcd1122 100644 --- a/pytest_django_test/db_helpers.py +++ b/pytest_django_test/db_helpers.py @@ -95,8 +95,8 @@ def drop_database(name=TEST_DB_NAME, suffix=None): if get_db_engine() == 'mysql': r = run_mysql('-e', 'DROP DATABASE %s' % name) - assert ('database doesn\'t exist' in force_text(r.std_err) - or r.status_code == 0) + assert ('database doesn\'t exist' in force_text(r.std_err) or + r.status_code == 0) return if get_db_engine() == 'sqlite3': diff --git a/requirements.txt b/requirements.txt index e03faf4a3..8be6171e3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,4 +6,3 @@ tox wheel twine south -isort diff --git a/setup.cfg b/setup.cfg index 9c4bcba53..cce520287 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ # --strict: warnings become errors. # -r fEsxXw: show extra test summary info for everything. addopts = --ignore lib/ --ignore build/ --ignore include/ --ignore local/ --ignore src/ --strict -r fEsxXw -DJANGO_SETTINGS_MODULE = pytest_django_test.settings_sqlite +DJANGO_SETTINGS_MODULE = pytest_django_test.settings_sqlite_file [wheel] universal = 1 diff --git a/setup.py b/setup.py index 30b30e119..13210c251 100755 --- a/setup.py +++ b/setup.py @@ -25,6 +25,7 @@ def read(fname): maintainer="Andreas Pelme", maintainer_email="andreas@pelme.se", url='http://pytest-django.readthedocs.org/', + license='BSD-3-Clause', packages=['pytest_django'], long_description=read('README.rst'), install_requires=['pytest>=2.5'], diff --git a/tests/conftest.py b/tests/conftest.py index 992138fd9..04f381167 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -101,10 +101,14 @@ def django_testdir(request, testdir, monkeypatch): monkeypatch.setenv('DJANGO_SETTINGS_MODULE', 'tpkg.the_settings') def create_test_module(test_code, filename='test_the_test.py'): - tpkg_path.join(filename).write(dedent(test_code), ensure=True) + r = tpkg_path.join(filename) + r.write(dedent(test_code), ensure=True) + return r def create_app_file(code, filename): - test_app_path.join(filename).write(dedent(code), ensure=True) + r = test_app_path.join(filename) + r.write(dedent(code), ensure=True) + return r testdir.create_test_module = create_test_module testdir.create_app_file = create_app_file @@ -123,4 +127,37 @@ def django_testdir_initial(django_testdir): "fields": { "name": "mark_initial_data" } }]""") + def _create_initial_south_migration(): + """ + Create initial South migration for pytest_django_test/app/models.py. + """ + django_testdir.mkpydir('tpkg/app/south_migrations') + django_testdir.create_app_file(""" + from south.v2 import SchemaMigration + from south.db import db + + class Migration(SchemaMigration): + def forwards(self, orm): + db.create_table(u'app_item', ( + (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=100)), + )) + db.send_create_signal(u'app', ['Item']) + print("mark_south_migration_forwards"), + + def backwards(self, orm): + db.delete_table(u'app_item') + + models = { + u'app.item': { + 'Meta': {'object_name': 'Item'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) + } + } + + complete_apps = ['app'] + """, 'south_migrations/0001_initial.py') + django_testdir.create_initial_south_migration = _create_initial_south_migration + return django_testdir diff --git a/tests/test_database.py b/tests/test_database.py index e041d5ffb..0a2449cd1 100644 --- a/tests/test_database.py +++ b/tests/test_database.py @@ -131,6 +131,7 @@ def test_trans_db(self, fixture_with_transdb, fixture_with_db): class TestDatabaseMarker: + "Tests for the django_db marker." @pytest.mark.django_db def test_access(self): @@ -138,7 +139,7 @@ def test_access(self): @pytest.mark.django_db def test_clean_db(self): - # Relies on the order: test_access created an object + # Relies on the order: test_access created an object. assert Item.objects.count() == 0 @pytest.mark.django_db @@ -161,3 +162,43 @@ def test_transactions_enabled(self): pytest.skip('transactions required for this test') assert not noop_transactions() + + +def test_unittest_interaction(django_testdir): + "Test that (non-Django) unittests cannot access the DB." + + django_testdir.create_test_module(''' + import pytest + import unittest + from .app.models import Item + + class TestCase_setupClass(unittest.TestCase): + @classmethod + def setUpClass(cls): + Item.objects.create(name='foo') + + def test_db_access_1(self): + Item.objects.count() == 1 + + class TestCase_setUp(unittest.TestCase): + @classmethod + def setUp(cls): + Item.objects.create(name='foo') + + def test_db_access_2(self): + Item.objects.count() == 1 + + class TestCase(unittest.TestCase): + def test_db_access_3(self): + Item.objects.count() == 1 + ''') + + result = django_testdir.runpytest('-v', '--reuse-db') + result.stdout.fnmatch_lines([ + "*test_db_access_1 ERROR*", + "*test_db_access_2 FAILED*", + "*test_db_access_3 FAILED*", + "*ERROR at setup of TestCase_setupClass.test_db_access_1*", + "*no such table: app_item*", + "*Failed: Database access not allowed, use the \"django_db\" mark to enable*", + ]) diff --git a/tests/test_db_setup.py b/tests/test_db_setup.py index b6a3c97b6..9f0150db4 100644 --- a/tests/test_db_setup.py +++ b/tests/test_db_setup.py @@ -24,6 +24,7 @@ def test_db_can_be_accessed(): ''') result = django_testdir.runpytest('-v', '--reuse-db') + assert result.ret == 0 result.stdout.fnmatch_lines([ "*test_db_can_be_accessed PASSED*", ]) @@ -55,6 +56,7 @@ def test_db_can_be_accessed(): # Do not pass in --create-db to make sure it is created when it # does not exist result_first = django_testdir.runpytest('-v', '--reuse-db') + assert result_first.ret == 0 result_first.stdout.fnmatch_lines([ "*test_db_can_be_accessed PASSED*", @@ -65,6 +67,7 @@ def test_db_can_be_accessed(): assert mark_exists() result_second = django_testdir.runpytest('-v', '--reuse-db') + assert result_second.ret == 0 result_second.stdout.fnmatch_lines([ "*test_db_can_be_accessed PASSED*", ]) @@ -73,6 +76,7 @@ def test_db_can_be_accessed(): assert mark_exists() result_third = django_testdir.runpytest('-v', '--reuse-db', '--create-db') + assert result_third.ret == 0 result_third.stdout.fnmatch_lines([ "*test_db_can_be_accessed PASSED*", ]) @@ -116,6 +120,7 @@ def test_a(): ''' % (self.db_name_17, self.db_name_before_17)) result = django_testdir.runpytest('--tb=short', '-v') + assert result.ret == 0 result.stdout.fnmatch_lines(['*test_a*PASSED*']) @@ -160,6 +165,7 @@ def test_d(settings): ''') result = django_testdir.runpytest('-vv', '-n2', '-s', '--reuse-db') + assert result.ret == 0 result.stdout.fnmatch_lines(['*PASSED*test_a*']) result.stdout.fnmatch_lines(['*PASSED*test_b*']) result.stdout.fnmatch_lines(['*PASSED*test_c*']) @@ -169,6 +175,7 @@ def test_d(settings): assert db_exists('gw1') result = django_testdir.runpytest('-vv', '-n2', '-s', '--reuse-db') + assert result.ret == 0 result.stdout.fnmatch_lines(['*PASSED*test_a*']) result.stdout.fnmatch_lines(['*PASSED*test_b*']) result.stdout.fnmatch_lines(['*PASSED*test_c*']) @@ -176,39 +183,13 @@ def test_d(settings): result = django_testdir.runpytest('-vv', '-n2', '-s', '--reuse-db', '--create-db') + assert result.ret == 0 result.stdout.fnmatch_lines(['*PASSED*test_a*']) result.stdout.fnmatch_lines(['*PASSED*test_b*']) result.stdout.fnmatch_lines(['*PASSED*test_c*']) result.stdout.fnmatch_lines(['*PASSED*test_d*']) -@skip_on_python32 -def test_xdist_one_db(django_testdir): - skip_if_sqlite_in_memory() - - django_testdir.create_test_module(''' - import pytest - from .app.models import Item - def _check(settings): - # Make sure that the database name looks correct - db_name = settings.DATABASES['default']['NAME'] - assert not 'gw' in db_name - assert Item.objects.count() == 0 - Item.objects.create(name='foo') - assert Item.objects.count() == 1 - @pytest.mark.django_db - def test_a(settings): - _check(settings) - @pytest.mark.django_db - def test_b(settings): - _check(settings) - ''') - - result = django_testdir.runpytest('-vv', '-n2', '-s', '--reuse-db', '--xdist-one-db') - result.stdout.fnmatch_lines(['*PASSED*test_a*']) - result.stdout.fnmatch_lines(['*PASSED*test_b*']) - - class TestSqliteWithXdist: pytestmark = skip_on_python32 @@ -233,6 +214,7 @@ def test_a(): ''') result = django_testdir.runpytest('--tb=short', '-vv', '-n1') + assert result.ret == 0 result.stdout.fnmatch_lines(['*PASSED*test_a*']) @@ -253,6 +235,7 @@ def test_inner_south(): ''') result = django_testdir_initial.runpytest('--tb=short', '-v') + assert result.ret == 0 result.stdout.fnmatch_lines(['*test_inner_south*PASSED*']) @@ -263,16 +246,16 @@ def test_inner_south(): @pytest.mark.skipif(sys.version_info[0] == 3, reason='South is not properly supported on Python 3') class TestSouth: - """Test interaction with initial_data and South.""" + """Test interaction with South, with and without initial_data.""" @pytest.mark.django_project(extra_settings=""" INSTALLED_APPS += [ 'south', ] SOUTH_TESTS_MIGRATE = True SOUTH_MIGRATION_MODULES = { - 'app': 'app.south_migrations', + 'app': 'tpkg.app.south_migrations', } """) - def test_initial_data_south(self, django_testdir_initial): + def test_initial_data_south_no_migrations(self, django_testdir_initial): django_testdir_initial.create_test_module(''' import pytest @@ -284,8 +267,41 @@ def test_inner_south(): == ["mark_initial_data"] ''') - result = django_testdir_initial.runpytest('--tb=short', '-v') - result.stdout.fnmatch_lines(['*test_inner_south*PASSED*']) + result = django_testdir_initial.runpytest('--tb=short', '-v', '-s') + result.stdout.fnmatch_lines_random([ + "tpkg/test_the_test.py::test_inner_south*", + "*PASSED*", + "*Destroying test database for alias 'default'...*"]) + + @pytest.mark.django_project(extra_settings=""" + INSTALLED_APPS += [ 'south', ] + SOUTH_TESTS_MIGRATE = True + SOUTH_MIGRATION_MODULES = { + 'app': 'tpkg.app.south_migrations', + } + """) + def test_initial_data_south_with_migrations(self, django_testdir_initial): + """ + If migrations exists, there should be an error if they do not create + the DB table. + """ + django_testdir_initial.create_test_module(''' + import pytest + + from .app.models import Item + + @pytest.mark.django_db + def test_inner_south(): + assert [x.name for x in Item.objects.all()] \ + == ["mark_initial_data"] + ''') + django_testdir_initial.mkpydir('tpkg/app/south_migrations') + + result = django_testdir_initial.runpytest('--tb=short', '-v', '-s') + assert result.ret != 0 + # Can be OperationalError or DatabaseError (Django 1.4). + result.stdout.fnmatch_lines([ + '*Error:* no such table: app_item*']) @pytest.mark.django_project(extra_settings=""" INSTALLED_APPS += [ 'south', ] @@ -295,6 +311,8 @@ def test_inner_south(): } """) def test_initial_south_migrations(self, django_testdir_initial): + """This should fail, because it has no real migration that + would create the table, and so no initial data can be loaded.""" testdir = django_testdir_initial testdir.create_test_module(''' import pytest @@ -304,6 +322,53 @@ def test_inner_south(): pass ''') + testdir.create_initial_south_migration() + + result = testdir.runpytest('--tb=short', '-v', '-s') + assert result.ret == 0 + result.stdout.fnmatch_lines(['*mark_south_migration_forwards*']) + + @pytest.mark.django_project(extra_settings=""" + INSTALLED_APPS += [ 'south', ] + SOUTH_TESTS_MIGRATE = True + SOUTH_MIGRATION_MODULES = { + 'app': 'tpkg.app.south_migrations', + } + """) + def test_initial_without_south_migrations(self, django_testdir_initial): + """Using South, but without any migrations should still load the + initial data.""" + django_testdir_initial.create_test_module(''' + import pytest + + @pytest.mark.django_db + def test_inner_south(): + pass + ''') + + result = django_testdir_initial.runpytest('--tb=short', '-v', '-s') + assert result.ret == 0 + result.stdout.fnmatch_lines(['*PASSED*']) + assert 'mark_south_migration_forwards' not in result.stdout.str() + + @pytest.mark.django_project(extra_settings=""" + INSTALLED_APPS += [ 'south', ] + SOUTH_TESTS_MIGRATE = True + SOUTH_MIGRATION_MODULES = { + 'app': 'tpkg.app.south_migrations', + } + """) + def test_south_migrations(self, django_testdir): + """South migration with a normal testdir (no initial data).""" + testdir = django_testdir + testdir.create_test_module(''' + import pytest + + @pytest.mark.django_db + def test_inner_south(): + pass + ''') + testdir.mkpydir('tpkg/app/south_migrations') testdir.create_app_file(""" from south.v2 import SchemaMigration @@ -313,6 +378,7 @@ def forwards(self, orm): print("mark_south_migration_forwards") """, 'south_migrations/0001_initial.py') result = testdir.runpytest('--tb=short', '-v', '-s') + assert result.ret == 0 result.stdout.fnmatch_lines(['*mark_south_migration_forwards*']) @pytest.mark.django_project(extra_settings=""" @@ -338,8 +404,48 @@ def test_inner_south(): p.write('raise Exception("This should not get imported.")', ensure=True) - result = testdir.runpytest('--tb=short', '-v') - result.stdout.fnmatch_lines(['*test_inner_south*PASSED*']) + result = testdir.runpytest('--tb=short', '-v', '-s') + assert result.ret == 0 + result.stdout.fnmatch_lines_random([ + "tpkg/test_the_test.py::test_inner_south*", + "*PASSED*", + "*Destroying test database for alias 'default'...*"]) + + @pytest.mark.django_project(extra_settings=""" + INSTALLED_APPS += [ 'south', ] + SOUTH_TESTS_MIGRATE = True + SOUTH_MIGRATION_MODULES = { + 'app': 'tpkg.app.south_migrations', + } + """) + def test_south_migrations_python_files_star(self, django_testdir_initial): + """ + Test for South migrations and tests imported via `*.py`. + + This is meant to reproduce + https://github.com/pytest-dev/pytest-django/issues/158, but does not + fail. + """ + testdir = django_testdir_initial + testdir.create_test_module(''' + import pytest + + @pytest.mark.django_db + def test_inner_south(): + pass + ''', 'test.py') + testdir.create_initial_south_migration() + + pytest_ini = testdir.create_test_module(""" + [pytest] + python_files=*.py""", 'pytest.ini') + + result = testdir.runpytest('--tb=short', '-v', '-s', '-c', pytest_ini) + assert result.ret == 0 + result.stdout.fnmatch_lines_random([ + "tpkg/test.py::test_inner_south*", + "*mark_south_migration_forwards*", + "*PASSED*"]) class TestNativeMigrations(object): @@ -364,6 +470,7 @@ def test_inner_migrations(): ensure=True) result = testdir.runpytest('--nomigrations', '--tb=short', '-v') + assert result.ret == 0 result.stdout.fnmatch_lines(['*test_inner_migrations*PASSED*']) @pytest.mark.skipif(get_django_version() < (1, 7), @@ -409,4 +516,5 @@ class Migration(migrations.Migration): ] """, 'migrations/0001_initial.py') result = testdir.runpytest('--tb=short', '-v', '-s') + assert result.ret == 0 result.stdout.fnmatch_lines(['*mark_migrations_run*']) diff --git a/tests/test_django_configurations.py b/tests/test_django_configurations.py index f3e5afce4..f4f0584c6 100644 --- a/tests/test_django_configurations.py +++ b/tests/test_django_configurations.py @@ -46,29 +46,31 @@ def test_settings(): """) result = testdir.runpytest() result.stdout.fnmatch_lines(['*1 passed*']) + assert result.ret == 0 def test_dc_ini(testdir, monkeypatch): - monkeypatch.setenv('DJANGO_SETTINGS_MODULE', 'DO_NOT_USE') - monkeypatch.setenv('DJANGO_CONFIGURATION', 'DO_NOT_USE') + monkeypatch.setenv('DJANGO_SETTINGS_MODULE', 'tpkg.settings_env') + monkeypatch.setenv('DJANGO_CONFIGURATION', 'MySettings') testdir.makeini(""" [pytest] - DJANGO_SETTINGS_MODULE = tpkg.settings_ini - DJANGO_CONFIGURATION = MySettings + DJANGO_SETTINGS_MODULE = DO_NOT_USE_ini + DJANGO_CONFIGURATION = DO_NOT_USE_ini """) pkg = testdir.mkpydir('tpkg') - settings = pkg.join('settings_ini.py') + settings = pkg.join('settings_env.py') settings.write(BARE_SETTINGS) testdir.makepyfile(""" import os def test_ds(): - assert os.environ['DJANGO_SETTINGS_MODULE'] == 'tpkg.settings_ini' + assert os.environ['DJANGO_SETTINGS_MODULE'] == 'tpkg.settings_env' assert os.environ['DJANGO_CONFIGURATION'] == 'MySettings' """) result = testdir.runpytest() result.stdout.fnmatch_lines(['*1 passed*']) + assert result.ret == 0 def test_dc_option(testdir, monkeypatch): @@ -92,3 +94,4 @@ def test_ds(): """) result = testdir.runpytest('--ds=tpkg.settings_opt', '--dc=MySettings') result.stdout.fnmatch_lines(['*1 passed*']) + assert result.ret == 0 diff --git a/tests/test_django_settings_module.py b/tests/test_django_settings_module.py index 57246772d..7a697b60d 100644 --- a/tests/test_django_settings_module.py +++ b/tests/test_django_settings_module.py @@ -32,13 +32,15 @@ def test_settings(): """) result = testdir.runpytest() result.stdout.fnmatch_lines(['*1 passed*']) + assert result.ret == 0 def test_ds_ini(testdir, monkeypatch): - monkeypatch.setenv('DJANGO_SETTINGS_MODULE', 'DO_NOT_USE') + "DSM env should override ini." + monkeypatch.setenv('DJANGO_SETTINGS_MODULE', 'tpkg.settings_ini') testdir.makeini("""\ [pytest] - DJANGO_SETTINGS_MODULE = tpkg.settings_ini + DJANGO_SETTINGS_MODULE = DO_NOT_USE_ini """) pkg = testdir.mkpydir('tpkg') settings = pkg.join('settings_ini.py') @@ -51,6 +53,7 @@ def test_ds(): """) result = testdir.runpytest() result.stdout.fnmatch_lines(['*1 passed*']) + assert result.ret == 0 def test_ds_option(testdir, monkeypatch): @@ -70,6 +73,7 @@ def test_ds(): """) result = testdir.runpytest('--ds=tpkg.settings_opt') result.stdout.fnmatch_lines(['*1 passed*']) + assert result.ret == 0 def test_ds_non_existent(testdir, monkeypatch): @@ -81,6 +85,7 @@ def test_ds_non_existent(testdir, monkeypatch): testdir.makepyfile('def test_ds(): pass') result = testdir.runpytest() result.stderr.fnmatch_lines(["*ImportError:*DOES_NOT_EXIST*"]) + assert result.ret != 0 def test_ds_after_user_conftest(testdir, monkeypatch): @@ -94,6 +99,26 @@ def test_ds_after_user_conftest(testdir, monkeypatch): # testdir.makeconftest("import sys; print(sys.path)") result = testdir.runpytest('-v') result.stdout.fnmatch_lines(['*1 passed*']) + assert result.ret == 0 + + +def test_ds_in_pytest_configure(testdir, monkeypatch): + monkeypatch.delenv('DJANGO_SETTINGS_MODULE') + pkg = testdir.mkpydir('tpkg') + settings = pkg.join('settings_ds.py') + settings.write(BARE_SETTINGS) + testdir.makeconftest(""" + import os + + from django.conf import settings + + def pytest_configure(): + if not settings.configured: + os.environ.setdefault('DJANGO_SETTINGS_MODULE', + 'tpkg.settings_ds') + """) + r = testdir.runpytest() + assert r.ret == 0 def test_django_settings_configure(testdir, monkeypatch): @@ -192,6 +217,7 @@ def test_settings(): """) result = testdir.runpytest() result.stdout.fnmatch_lines(['*1 passed*']) + assert result.ret == 0 def test_debug_false(testdir, monkeypatch): @@ -230,9 +256,6 @@ def test_django_setup_sequence(django_testdir): django_testdir.create_app_file(""" from django.apps import apps, AppConfig - from django.contrib.auth.models import AbstractUser - from django.db import models - class TestApp(AppConfig): name = 'tpkg.app' @@ -263,3 +286,29 @@ def test_anything(): result.stdout.fnmatch_lines(['*IMPORT: populating=True,ready=False*']) result.stdout.fnmatch_lines(['*READY(): populating=True*']) result.stdout.fnmatch_lines(['*TEST: populating=False,ready=True*']) + assert result.ret == 0 + + +def test_no_ds_but_django_imported(testdir, monkeypatch): + """pytest-django should not bail out, if "django" has been imported + somewhere, e.g. via pytest-splinter.""" + + monkeypatch.delenv('DJANGO_SETTINGS_MODULE') + + testdir.makepyfile(""" + import os + import django + + from pytest_django.lazy_django import django_settings_is_configured + + def test_django_settings_is_configured(): + assert django_settings_is_configured() is False + + def test_env(): + assert 'DJANGO_SETTINGS_MODULE' not in os.environ + + def test_cfg(pytestconfig): + assert pytestconfig.option.ds is None + """) + r = testdir.runpytest('-s') + assert r.ret == 0 diff --git a/tests/test_environment.py b/tests/test_environment.py index b7c40ce7b..0a548bebe 100644 --- a/tests/test_environment.py +++ b/tests/test_environment.py @@ -50,39 +50,55 @@ def test_database_noaccess(): Item.objects.count() -def test_django_testrunner_verbosity_from_pytest(django_testdir): - """ - Test that Django's code to setup and teardown the databases uses pytest's - verbosity level. - """ - django_testdir.create_test_module(''' - import pytest - - @pytest.mark.django_db - def test_inner_testrunner(): - pass - ''') - - # Not verbose by default. - result = django_testdir.runpytest('-s') - result.stdout.fnmatch_lines([ - "tpkg/test_the_test.py ."]) - - # -v and -q results in verbosity 0. - result = django_testdir.runpytest('-s', '-v', '-q') - result.stdout.fnmatch_lines([ - "tpkg/test_the_test.py ."]) - - # Verbose output with '-v'. - result = django_testdir.runpytest('-s', '-v') - result.stdout.fnmatch_lines_random([ - "tpkg/test_the_test.py:*", - "*PASSED*", - "*Destroying test database for alias 'default'...*"]) - - # More verbose output with '-v -v'. - result = django_testdir.runpytest('-s', '-v', '-v') - result.stdout.fnmatch_lines_random([ - "tpkg/test_the_test.py:*", - "*PASSED*", - "*Destroying test database for alias 'default' ('*')...*"]) +class TestrunnerVerbosity: + """Test that Django's code to setup and teardown the databases uses + pytest's verbosity level.""" + + @pytest.fixture + def testdir(self, django_testdir): + print("testdir") + django_testdir.create_test_module(''' + import pytest + + @pytest.mark.django_db + def test_inner_testrunner(): + pass + ''') + return django_testdir + + def test_default(self, testdir): + """Not verbose by default.""" + result = testdir.runpytest('-s') + result.stdout.fnmatch_lines([ + "tpkg/test_the_test.py ."]) + + def test_vq_verbosity_0(self, testdir): + """-v and -q results in verbosity 0.""" + result = testdir.runpytest('-s', '-v', '-q') + result.stdout.fnmatch_lines([ + "tpkg/test_the_test.py ."]) + + def test_verbose_with_v(self, testdir): + """Verbose output with '-v'.""" + result = testdir.runpytest('-s', '-v') + result.stdout.fnmatch_lines_random([ + "tpkg/test_the_test.py:*", + "*PASSED*", + "*Destroying test database for alias 'default'...*"]) + + def test_more_verbose_with_vv(self, testdir): + """More verbose output with '-v -v'.""" + result = testdir.runpytest('-s', '-v', '-v') + result.stdout.fnmatch_lines([ + "tpkg/test_the_test.py:*Creating test database for alias*", + "*Creating table app_item*", + "*PASSED*Destroying test database for alias 'default' ('*')...*"]) + + def test_more_verbose_with_vv_and_reusedb(self, testdir): + """More verbose output with '-v -v', and --reuse-db.""" + result = testdir.runpytest('-s', '-v', '-v', '--reuse-db') + result.stdout.fnmatch_lines([ + "tpkg/test_the_test.py:*Creating test database for alias*", + "*PASSED*"]) + assert ("*Destroying test database for alias 'default' ('*')...*" + not in result.stdout.str()) diff --git a/tests/test_fixtures.py b/tests/test_fixtures.py index 9fa564272..9a9bda724 100644 --- a/tests/test_fixtures.py +++ b/tests/test_fixtures.py @@ -118,15 +118,11 @@ def test_fixture_transactional_db(self, transactional_db, live_server): @pytest.fixture def item(self): - # This has not requested database access so should fail. - # Unfortunately the _live_server_helper autouse fixture makes this - # test work. - with pytest.raises(pytest.fail.Exception): - Item.objects.create(name='foo') + # This has not requested database access explicitly, but the + # live_server fixture auto-uses the transactional_db fixture. + Item.objects.create(name='foo') - @pytest.mark.xfail def test_item(self, item, live_server): - # test should fail/pass in setup pass @pytest.fixture @@ -193,6 +189,7 @@ def test_a(self, live_server, settings): """) result = django_testdir.runpytest('--tb=short', '-v') result.stdout.fnmatch_lines(['*test_a*PASSED*']) + assert result.ret == 0 @pytest.mark.skipif(get_django_version() < (1, 7), reason="Django >= 1.7 required") @@ -309,3 +306,4 @@ class Migration(migrations.Migration): result = django_testdir.runpytest('-s') result.stdout.fnmatch_lines(['*1 passed*']) + assert result.ret == 0 diff --git a/tests/test_manage_py_scan.py b/tests/test_manage_py_scan.py index b9a8fce1a..34c168c94 100644 --- a/tests/test_manage_py_scan.py +++ b/tests/test_manage_py_scan.py @@ -29,6 +29,8 @@ def test_django_project_found_invalid_settings(django_testdir, monkeypatch): monkeypatch.setenv('DJANGO_SETTINGS_MODULE', 'DOES_NOT_EXIST') result = django_testdir.runpytest('django_project_root') + assert result.ret != 0 + result.stderr.fnmatch_lines(['*ImportError:*DOES_NOT_EXIST*']) result.stderr.fnmatch_lines(['*pytest-django found a Django project*']) @@ -43,6 +45,7 @@ def test_django_project_scan_disabled_invalid_settings(django_testdir, ''') result = django_testdir.runpytest('django_project_root') + assert result.ret != 0 result.stderr.fnmatch_lines(['*ImportError*DOES_NOT_EXIST*']) result.stderr.fnmatch_lines(['*pytest-django did not search for ' diff --git a/tests/test_unittest.py b/tests/test_unittest.py index 5e3e9d2f4..a2cb5e2ae 100644 --- a/tests/test_unittest.py +++ b/tests/test_unittest.py @@ -96,6 +96,75 @@ def test_foo(self): assert result.ret == 0 +class TestUnittestMethods: + "Test that setup/teardown methods of unittests are being called." + def test_django(self, django_testdir): + django_testdir.create_test_module(''' + from django.test import TestCase + + class TestFoo(TestCase): + @classmethod + def setUpClass(self): + print('\\nCALLED: setUpClass') + + def setUp(self): + print('\\nCALLED: setUp') + + def tearDown(self): + print('\\nCALLED: tearDown') + + @classmethod + def tearDownClass(self): + print('\\nCALLED: tearDownClass') + + def test_pass(self): + pass + ''') + + result = django_testdir.runpytest('-v', '-s') + result.stdout.fnmatch_lines([ + "CALLED: setUpClass", + "CALLED: setUp", + "CALLED: tearDown", + "PASSED", + "CALLED: tearDownClass", + ]) + assert result.ret == 0 + + def test_unittest(self, django_testdir): + django_testdir.create_test_module(''' + from unittest import TestCase + + class TestFoo(TestCase): + @classmethod + def setUpClass(self): + print('\\nCALLED: setUpClass') + + def setUp(self): + print('\\nCALLED: setUp') + + def tearDown(self): + print('\\nCALLED: tearDown') + + @classmethod + def tearDownClass(self): + print('\\nCALLED: tearDownClass') + + def test_pass(self): + pass + ''') + + result = django_testdir.runpytest('-v', '-s') + result.stdout.fnmatch_lines([ + "CALLED: setUpClass", + "CALLED: setUp", + "CALLED: tearDown", + "PASSED", + "CALLED: tearDownClass", + ]) + assert result.ret == 0 + + class TestCaseWithDbFixture(TestCase): pytestmark = pytest.mark.usefixtures('db') diff --git a/tox.ini b/tox.ini index 2f3d1b9e7..3f00662d3 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = pypy-2.6.4-master-sqlite_file,pypy3-2.6.4-master-sqlite_file,python2.6-2.6.4-1.6-sqlite_file,python2.7-2.6.4-1.3-sqlite_file,python2.7-2.6.4-1.4-sqlite_file,python2.7-2.6.4-master-mysql_innodb,python2.7-2.6.4-master-mysql_myisam,python2.7-2.6.4-master-sqlite_file,python3.2-2.6.4-master-sqlite_file,python3.3-2.6.4-master-sqlite_file,python3.4-2.6.4-1.5-sqlite_file,python3.4-2.6.4-1.6-sqlite_file,python3.4-2.6.4-1.7-sqlite_file,python3.4-2.6.4-1.8-sqlite_file,python3.4-2.6.4-master-postgres,python3.4-2.6.4-master-sqlite,python3.4-2.6.4-master-sqlite_file,checkqa-python2.6,checkqa-python2.7,checkqa-python3.2,checkqa-python3.3,checkqa-python3.4,checkqa-pypy,checkqa-pypy3 +envlist = python2.6-1.6-sqlite_file,python2.7-1.3-sqlite_file,python2.7-1.4-sqlite_file,python2.7-1.5-sqlite_file,python2.7-1.6-sqlite_file,python2.7-1.7-sqlite_file,python2.7-1.8-sqlite_file,python2.7-master-sqlite_file,python3.4-1.5-sqlite_file,python3.4-1.6-sqlite_file,python3.4-1.7-sqlite_file,python3.4-1.8-sqlite_file,python3.4-master-sqlite,python3.4-master-sqlite_file,checkqa-python2.7,checkqa-python3.4 [testenv] whitelist_externals = @@ -76,223 +76,223 @@ deps = setenv = UID = 7 -[testenv:pypy-2.6.4-1.3-sqlite] +[testenv:pypy-1.3-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = pypy deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.3,<1.4 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 8 -[testenv:pypy-2.6.4-1.3-sqlite_file] +[testenv:pypy-1.3-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = pypy deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.3,<1.4 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 9 -[testenv:pypy-2.6.4-1.4-sqlite] +[testenv:pypy-1.4-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = pypy deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.4,<1.5 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 10 -[testenv:pypy-2.6.4-1.4-sqlite_file] +[testenv:pypy-1.4-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = pypy deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.4,<1.5 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 11 -[testenv:pypy-2.6.4-1.5-sqlite] +[testenv:pypy-1.5-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = pypy deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 12 -[testenv:pypy-2.6.4-1.5-sqlite_file] +[testenv:pypy-1.5-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = pypy deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 13 -[testenv:pypy-2.6.4-1.6-sqlite] +[testenv:pypy-1.6-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = pypy deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 14 -[testenv:pypy-2.6.4-1.6-sqlite_file] +[testenv:pypy-1.6-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = pypy deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 15 -[testenv:pypy-2.6.4-1.7-sqlite] +[testenv:pypy-1.7-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = pypy deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.7,<1.8 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 16 -[testenv:pypy-2.6.4-1.7-sqlite_file] +[testenv:pypy-1.7-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = pypy deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.7,<1.8 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 17 -[testenv:pypy-2.6.4-1.8-sqlite] +[testenv:pypy-1.8-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = pypy deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/stable/1.8.x.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/stable/1.8.x.tar.gz django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 18 -[testenv:pypy-2.6.4-1.8-sqlite_file] +[testenv:pypy-1.8-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = pypy deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/stable/1.8.x.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/stable/1.8.x.tar.gz django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 19 -[testenv:pypy-2.6.4-master-sqlite] +[testenv:pypy-master-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = pypy deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/master.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/master.tar.gz django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 20 -[testenv:pypy-2.6.4-master-sqlite_file] +[testenv:pypy-master-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = pypy deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/master.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/master.tar.gz django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 21 -[testenv:pypy3-2.6.4-1.5-sqlite] +[testenv:pypy3-1.5-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = pypy3 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 setenv = @@ -300,13 +300,13 @@ setenv = UID = 22 -[testenv:pypy3-2.6.4-1.5-sqlite_file] +[testenv:pypy3-1.5-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = pypy3 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 setenv = @@ -314,13 +314,13 @@ setenv = UID = 23 -[testenv:pypy3-2.6.4-1.6-sqlite] +[testenv:pypy3-1.6-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = pypy3 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 setenv = @@ -328,13 +328,13 @@ setenv = UID = 24 -[testenv:pypy3-2.6.4-1.6-sqlite_file] +[testenv:pypy3-1.6-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = pypy3 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 setenv = @@ -342,13 +342,13 @@ setenv = UID = 25 -[testenv:pypy3-2.6.4-1.7-sqlite] +[testenv:pypy3-1.7-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = pypy3 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.7,<1.8 django-configurations==0.8 setenv = @@ -356,13 +356,13 @@ setenv = UID = 26 -[testenv:pypy3-2.6.4-1.7-sqlite_file] +[testenv:pypy3-1.7-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = pypy3 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.7,<1.8 django-configurations==0.8 setenv = @@ -370,961 +370,961 @@ setenv = UID = 27 -[testenv:pypy3-2.6.4-1.8-sqlite] +[testenv:pypy3-1.8-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = pypy3 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/stable/1.8.x.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/stable/1.8.x.tar.gz django-configurations==0.8 setenv = PYTHONPATH = {toxinidir} UID = 28 -[testenv:pypy3-2.6.4-1.8-sqlite_file] +[testenv:pypy3-1.8-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = pypy3 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/stable/1.8.x.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/stable/1.8.x.tar.gz django-configurations==0.8 setenv = PYTHONPATH = {toxinidir} UID = 29 -[testenv:pypy3-2.6.4-master-sqlite] +[testenv:pypy3-master-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = pypy3 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/master.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/master.tar.gz django-configurations==0.8 setenv = PYTHONPATH = {toxinidir} UID = 30 -[testenv:pypy3-2.6.4-master-sqlite_file] +[testenv:pypy3-master-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = pypy3 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/master.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/master.tar.gz django-configurations==0.8 setenv = PYTHONPATH = {toxinidir} UID = 31 -[testenv:python2.6-2.6.4-1.3-mysql_innodb] +[testenv:python2.6-1.3-mysql_innodb] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_32; create database pytest_django_32'" || exit 0 - py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs:tests} basepython = python2.6 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.3,<1.4 django-configurations==0.8 - south==1.0 + south==1.0.2 mysql-python==1.2.5 setenv = PYTHONPATH = {toxinidir} UID = 32 -[testenv:python2.6-2.6.4-1.3-mysql_myisam] +[testenv:python2.6-1.3-mysql_myisam] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_33; create database pytest_django_33'" || exit 0 - py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs:tests} basepython = python2.6 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.3,<1.4 django-configurations==0.8 - south==1.0 + south==1.0.2 mysql-python==1.2.5 setenv = PYTHONPATH = {toxinidir} UID = 33 -[testenv:python2.6-2.6.4-1.3-postgres] +[testenv:python2.6-1.3-postgres] commands = sh -c "dropdb pytest_django_34; createdb pytest_django_34 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python2.6 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.3,<1.4 django-configurations==0.8 - south==1.0 + south==1.0.2 psycopg2==2.4.1 setenv = PYTHONPATH = {toxinidir} UID = 34 -[testenv:python2.6-2.6.4-1.3-sqlite] +[testenv:python2.6-1.3-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python2.6 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.3,<1.4 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 35 -[testenv:python2.6-2.6.4-1.3-sqlite_file] +[testenv:python2.6-1.3-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python2.6 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.3,<1.4 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 36 -[testenv:python2.6-2.6.4-1.4-mysql_innodb] +[testenv:python2.6-1.4-mysql_innodb] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_37; create database pytest_django_37'" || exit 0 - py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs:tests} basepython = python2.6 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.4,<1.5 django-configurations==0.8 - south==1.0 + south==1.0.2 mysql-python==1.2.5 setenv = PYTHONPATH = {toxinidir} UID = 37 -[testenv:python2.6-2.6.4-1.4-mysql_myisam] +[testenv:python2.6-1.4-mysql_myisam] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_38; create database pytest_django_38'" || exit 0 - py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs:tests} basepython = python2.6 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.4,<1.5 django-configurations==0.8 - south==1.0 + south==1.0.2 mysql-python==1.2.5 setenv = PYTHONPATH = {toxinidir} UID = 38 -[testenv:python2.6-2.6.4-1.4-postgres] +[testenv:python2.6-1.4-postgres] commands = sh -c "dropdb pytest_django_39; createdb pytest_django_39 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python2.6 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.4,<1.5 django-configurations==0.8 - south==1.0 + south==1.0.2 psycopg2==2.5.2 setenv = PYTHONPATH = {toxinidir} UID = 39 -[testenv:python2.6-2.6.4-1.4-sqlite] +[testenv:python2.6-1.4-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python2.6 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.4,<1.5 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 40 -[testenv:python2.6-2.6.4-1.4-sqlite_file] +[testenv:python2.6-1.4-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python2.6 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.4,<1.5 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 41 -[testenv:python2.6-2.6.4-1.5-mysql_innodb] +[testenv:python2.6-1.5-mysql_innodb] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_42; create database pytest_django_42'" || exit 0 - py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs:tests} basepython = python2.6 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 - south==1.0 + south==1.0.2 mysql-python==1.2.5 setenv = PYTHONPATH = {toxinidir} UID = 42 -[testenv:python2.6-2.6.4-1.5-mysql_myisam] +[testenv:python2.6-1.5-mysql_myisam] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_43; create database pytest_django_43'" || exit 0 - py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs:tests} basepython = python2.6 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 - south==1.0 + south==1.0.2 mysql-python==1.2.5 setenv = PYTHONPATH = {toxinidir} UID = 43 -[testenv:python2.6-2.6.4-1.5-postgres] +[testenv:python2.6-1.5-postgres] commands = sh -c "dropdb pytest_django_44; createdb pytest_django_44 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python2.6 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 - south==1.0 + south==1.0.2 psycopg2==2.5.2 setenv = PYTHONPATH = {toxinidir} UID = 44 -[testenv:python2.6-2.6.4-1.5-sqlite] +[testenv:python2.6-1.5-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python2.6 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 45 -[testenv:python2.6-2.6.4-1.5-sqlite_file] +[testenv:python2.6-1.5-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python2.6 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 46 -[testenv:python2.6-2.6.4-1.6-mysql_innodb] +[testenv:python2.6-1.6-mysql_innodb] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_47; create database pytest_django_47'" || exit 0 - py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs:tests} basepython = python2.6 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 - south==1.0 + south==1.0.2 mysql-python==1.2.5 setenv = PYTHONPATH = {toxinidir} UID = 47 -[testenv:python2.6-2.6.4-1.6-mysql_myisam] +[testenv:python2.6-1.6-mysql_myisam] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_48; create database pytest_django_48'" || exit 0 - py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs:tests} basepython = python2.6 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 - south==1.0 + south==1.0.2 mysql-python==1.2.5 setenv = PYTHONPATH = {toxinidir} UID = 48 -[testenv:python2.6-2.6.4-1.6-postgres] +[testenv:python2.6-1.6-postgres] commands = sh -c "dropdb pytest_django_49; createdb pytest_django_49 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python2.6 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 - south==1.0 + south==1.0.2 psycopg2==2.5.2 setenv = PYTHONPATH = {toxinidir} UID = 49 -[testenv:python2.6-2.6.4-1.6-sqlite] +[testenv:python2.6-1.6-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python2.6 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 50 -[testenv:python2.6-2.6.4-1.6-sqlite_file] +[testenv:python2.6-1.6-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python2.6 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 51 -[testenv:python2.7-2.6.4-1.3-mysql_innodb] +[testenv:python2.7-1.3-mysql_innodb] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_52; create database pytest_django_52'" || exit 0 - py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.3,<1.4 django-configurations==0.8 - south==1.0 + south==1.0.2 mysql-python==1.2.5 setenv = PYTHONPATH = {toxinidir} UID = 52 -[testenv:python2.7-2.6.4-1.3-mysql_myisam] +[testenv:python2.7-1.3-mysql_myisam] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_53; create database pytest_django_53'" || exit 0 - py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.3,<1.4 django-configurations==0.8 - south==1.0 + south==1.0.2 mysql-python==1.2.5 setenv = PYTHONPATH = {toxinidir} UID = 53 -[testenv:python2.7-2.6.4-1.3-postgres] +[testenv:python2.7-1.3-postgres] commands = sh -c "dropdb pytest_django_54; createdb pytest_django_54 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.3,<1.4 django-configurations==0.8 - south==1.0 + south==1.0.2 psycopg2==2.4.1 setenv = PYTHONPATH = {toxinidir} UID = 54 -[testenv:python2.7-2.6.4-1.3-sqlite] +[testenv:python2.7-1.3-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.3,<1.4 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 55 -[testenv:python2.7-2.6.4-1.3-sqlite_file] +[testenv:python2.7-1.3-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.3,<1.4 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 56 -[testenv:python2.7-2.6.4-1.4-mysql_innodb] +[testenv:python2.7-1.4-mysql_innodb] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_57; create database pytest_django_57'" || exit 0 - py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.4,<1.5 django-configurations==0.8 - south==1.0 + south==1.0.2 mysql-python==1.2.5 setenv = PYTHONPATH = {toxinidir} UID = 57 -[testenv:python2.7-2.6.4-1.4-mysql_myisam] +[testenv:python2.7-1.4-mysql_myisam] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_58; create database pytest_django_58'" || exit 0 - py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.4,<1.5 django-configurations==0.8 - south==1.0 + south==1.0.2 mysql-python==1.2.5 setenv = PYTHONPATH = {toxinidir} UID = 58 -[testenv:python2.7-2.6.4-1.4-postgres] +[testenv:python2.7-1.4-postgres] commands = sh -c "dropdb pytest_django_59; createdb pytest_django_59 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.4,<1.5 django-configurations==0.8 - south==1.0 + south==1.0.2 psycopg2==2.5.2 setenv = PYTHONPATH = {toxinidir} UID = 59 -[testenv:python2.7-2.6.4-1.4-sqlite] +[testenv:python2.7-1.4-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.4,<1.5 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 60 -[testenv:python2.7-2.6.4-1.4-sqlite_file] +[testenv:python2.7-1.4-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.4,<1.5 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 61 -[testenv:python2.7-2.6.4-1.5-mysql_innodb] +[testenv:python2.7-1.5-mysql_innodb] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_62; create database pytest_django_62'" || exit 0 - py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 - south==1.0 + south==1.0.2 mysql-python==1.2.5 setenv = PYTHONPATH = {toxinidir} UID = 62 -[testenv:python2.7-2.6.4-1.5-mysql_myisam] +[testenv:python2.7-1.5-mysql_myisam] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_63; create database pytest_django_63'" || exit 0 - py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 - south==1.0 + south==1.0.2 mysql-python==1.2.5 setenv = PYTHONPATH = {toxinidir} UID = 63 -[testenv:python2.7-2.6.4-1.5-postgres] +[testenv:python2.7-1.5-postgres] commands = sh -c "dropdb pytest_django_64; createdb pytest_django_64 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 - south==1.0 + south==1.0.2 psycopg2==2.5.2 setenv = PYTHONPATH = {toxinidir} UID = 64 -[testenv:python2.7-2.6.4-1.5-sqlite] +[testenv:python2.7-1.5-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 65 -[testenv:python2.7-2.6.4-1.5-sqlite_file] +[testenv:python2.7-1.5-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 66 -[testenv:python2.7-2.6.4-1.6-mysql_innodb] +[testenv:python2.7-1.6-mysql_innodb] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_67; create database pytest_django_67'" || exit 0 - py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 - south==1.0 + south==1.0.2 mysql-python==1.2.5 setenv = PYTHONPATH = {toxinidir} UID = 67 -[testenv:python2.7-2.6.4-1.6-mysql_myisam] +[testenv:python2.7-1.6-mysql_myisam] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_68; create database pytest_django_68'" || exit 0 - py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 - south==1.0 + south==1.0.2 mysql-python==1.2.5 setenv = PYTHONPATH = {toxinidir} UID = 68 -[testenv:python2.7-2.6.4-1.6-postgres] +[testenv:python2.7-1.6-postgres] commands = sh -c "dropdb pytest_django_69; createdb pytest_django_69 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 - south==1.0 + south==1.0.2 psycopg2==2.5.2 setenv = PYTHONPATH = {toxinidir} UID = 69 -[testenv:python2.7-2.6.4-1.6-sqlite] +[testenv:python2.7-1.6-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 70 -[testenv:python2.7-2.6.4-1.6-sqlite_file] +[testenv:python2.7-1.6-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 71 -[testenv:python2.7-2.6.4-1.7-mysql_innodb] +[testenv:python2.7-1.7-mysql_innodb] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_72; create database pytest_django_72'" || exit 0 - py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.7,<1.8 django-configurations==0.8 - south==1.0 + south==1.0.2 mysql-python==1.2.5 setenv = PYTHONPATH = {toxinidir} UID = 72 -[testenv:python2.7-2.6.4-1.7-mysql_myisam] +[testenv:python2.7-1.7-mysql_myisam] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_73; create database pytest_django_73'" || exit 0 - py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.7,<1.8 django-configurations==0.8 - south==1.0 + south==1.0.2 mysql-python==1.2.5 setenv = PYTHONPATH = {toxinidir} UID = 73 -[testenv:python2.7-2.6.4-1.7-postgres] +[testenv:python2.7-1.7-postgres] commands = sh -c "dropdb pytest_django_74; createdb pytest_django_74 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.7,<1.8 django-configurations==0.8 - south==1.0 + south==1.0.2 psycopg2==2.5.2 setenv = PYTHONPATH = {toxinidir} UID = 74 -[testenv:python2.7-2.6.4-1.7-sqlite] +[testenv:python2.7-1.7-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.7,<1.8 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 75 -[testenv:python2.7-2.6.4-1.7-sqlite_file] +[testenv:python2.7-1.7-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.7,<1.8 django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 76 -[testenv:python2.7-2.6.4-1.8-mysql_innodb] +[testenv:python2.7-1.8-mysql_innodb] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_77; create database pytest_django_77'" || exit 0 - py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/stable/1.8.x.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/stable/1.8.x.tar.gz django-configurations==0.8 - south==1.0 + south==1.0.2 mysql-python==1.2.5 setenv = PYTHONPATH = {toxinidir} UID = 77 -[testenv:python2.7-2.6.4-1.8-mysql_myisam] +[testenv:python2.7-1.8-mysql_myisam] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_78; create database pytest_django_78'" || exit 0 - py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/stable/1.8.x.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/stable/1.8.x.tar.gz django-configurations==0.8 - south==1.0 + south==1.0.2 mysql-python==1.2.5 setenv = PYTHONPATH = {toxinidir} UID = 78 -[testenv:python2.7-2.6.4-1.8-postgres] +[testenv:python2.7-1.8-postgres] commands = sh -c "dropdb pytest_django_79; createdb pytest_django_79 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/stable/1.8.x.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/stable/1.8.x.tar.gz django-configurations==0.8 - south==1.0 + south==1.0.2 psycopg2==2.5.2 setenv = PYTHONPATH = {toxinidir} UID = 79 -[testenv:python2.7-2.6.4-1.8-sqlite] +[testenv:python2.7-1.8-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/stable/1.8.x.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/stable/1.8.x.tar.gz django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 80 -[testenv:python2.7-2.6.4-1.8-sqlite_file] +[testenv:python2.7-1.8-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/stable/1.8.x.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/stable/1.8.x.tar.gz django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 81 -[testenv:python2.7-2.6.4-master-mysql_innodb] +[testenv:python2.7-master-mysql_innodb] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_82; create database pytest_django_82'" || exit 0 - py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_mysql_innodb --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/master.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/master.tar.gz django-configurations==0.8 - south==1.0 + south==1.0.2 mysql-python==1.2.5 setenv = PYTHONPATH = {toxinidir} UID = 82 -[testenv:python2.7-2.6.4-master-mysql_myisam] +[testenv:python2.7-master-mysql_myisam] commands = sh -c "mysql -u root -e 'drop database if exists pytest_django_83; create database pytest_django_83'" || exit 0 - py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_mysql_myisam --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/master.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/master.tar.gz django-configurations==0.8 - south==1.0 + south==1.0.2 mysql-python==1.2.5 setenv = PYTHONPATH = {toxinidir} UID = 83 -[testenv:python2.7-2.6.4-master-postgres] +[testenv:python2.7-master-postgres] commands = sh -c "dropdb pytest_django_84; createdb pytest_django_84 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/master.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/master.tar.gz django-configurations==0.8 - south==1.0 + south==1.0.2 psycopg2==2.5.2 setenv = PYTHONPATH = {toxinidir} UID = 84 -[testenv:python2.7-2.6.4-master-sqlite] +[testenv:python2.7-master-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/master.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/master.tar.gz django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 85 -[testenv:python2.7-2.6.4-master-sqlite_file] +[testenv:python2.7-master-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python2.7 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/master.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/master.tar.gz django-configurations==0.8 - south==1.0 + south==1.0.2 setenv = PYTHONPATH = {toxinidir} UID = 86 -[testenv:python3.2-2.6.4-1.5-postgres] +[testenv:python3.2-1.5-postgres] commands = sh -c "dropdb pytest_django_87; createdb pytest_django_87 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python3.2 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 psycopg2==2.5.2 @@ -1333,13 +1333,13 @@ setenv = UID = 87 -[testenv:python3.2-2.6.4-1.5-sqlite] +[testenv:python3.2-1.5-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python3.2 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 setenv = @@ -1347,13 +1347,13 @@ setenv = UID = 88 -[testenv:python3.2-2.6.4-1.5-sqlite_file] +[testenv:python3.2-1.5-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python3.2 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 setenv = @@ -1361,14 +1361,14 @@ setenv = UID = 89 -[testenv:python3.2-2.6.4-1.6-postgres] +[testenv:python3.2-1.6-postgres] commands = sh -c "dropdb pytest_django_90; createdb pytest_django_90 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python3.2 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 psycopg2==2.5.2 @@ -1377,13 +1377,13 @@ setenv = UID = 90 -[testenv:python3.2-2.6.4-1.6-sqlite] +[testenv:python3.2-1.6-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python3.2 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 setenv = @@ -1391,13 +1391,13 @@ setenv = UID = 91 -[testenv:python3.2-2.6.4-1.6-sqlite_file] +[testenv:python3.2-1.6-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python3.2 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 setenv = @@ -1405,14 +1405,14 @@ setenv = UID = 92 -[testenv:python3.2-2.6.4-1.7-postgres] +[testenv:python3.2-1.7-postgres] commands = sh -c "dropdb pytest_django_93; createdb pytest_django_93 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python3.2 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.7,<1.8 django-configurations==0.8 psycopg2==2.5.2 @@ -1421,13 +1421,13 @@ setenv = UID = 93 -[testenv:python3.2-2.6.4-1.7-sqlite] +[testenv:python3.2-1.7-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python3.2 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.7,<1.8 django-configurations==0.8 setenv = @@ -1435,13 +1435,13 @@ setenv = UID = 94 -[testenv:python3.2-2.6.4-1.7-sqlite_file] +[testenv:python3.2-1.7-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python3.2 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.7,<1.8 django-configurations==0.8 setenv = @@ -1449,15 +1449,15 @@ setenv = UID = 95 -[testenv:python3.2-2.6.4-1.8-postgres] +[testenv:python3.2-1.8-postgres] commands = sh -c "dropdb pytest_django_96; createdb pytest_django_96 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python3.2 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/stable/1.8.x.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/stable/1.8.x.tar.gz django-configurations==0.8 psycopg2==2.5.2 setenv = @@ -1465,43 +1465,43 @@ setenv = UID = 96 -[testenv:python3.2-2.6.4-1.8-sqlite] +[testenv:python3.2-1.8-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python3.2 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/stable/1.8.x.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/stable/1.8.x.tar.gz django-configurations==0.8 setenv = PYTHONPATH = {toxinidir} UID = 97 -[testenv:python3.2-2.6.4-1.8-sqlite_file] +[testenv:python3.2-1.8-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python3.2 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/stable/1.8.x.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/stable/1.8.x.tar.gz django-configurations==0.8 setenv = PYTHONPATH = {toxinidir} UID = 98 -[testenv:python3.2-2.6.4-master-postgres] +[testenv:python3.2-master-postgres] commands = sh -c "dropdb pytest_django_99; createdb pytest_django_99 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python3.2 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/master.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/master.tar.gz django-configurations==0.8 psycopg2==2.5.2 setenv = @@ -1509,42 +1509,42 @@ setenv = UID = 99 -[testenv:python3.2-2.6.4-master-sqlite] +[testenv:python3.2-master-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python3.2 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/master.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/master.tar.gz django-configurations==0.8 setenv = PYTHONPATH = {toxinidir} UID = 100 -[testenv:python3.2-2.6.4-master-sqlite_file] +[testenv:python3.2-master-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python3.2 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/master.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/master.tar.gz django-configurations==0.8 setenv = PYTHONPATH = {toxinidir} UID = 101 -[testenv:python3.3-2.6.4-1.5-postgres] +[testenv:python3.3-1.5-postgres] commands = sh -c "dropdb pytest_django_102; createdb pytest_django_102 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python3.3 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 psycopg2==2.5.2 @@ -1553,13 +1553,13 @@ setenv = UID = 102 -[testenv:python3.3-2.6.4-1.5-sqlite] +[testenv:python3.3-1.5-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python3.3 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 setenv = @@ -1567,13 +1567,13 @@ setenv = UID = 103 -[testenv:python3.3-2.6.4-1.5-sqlite_file] +[testenv:python3.3-1.5-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python3.3 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 setenv = @@ -1581,14 +1581,14 @@ setenv = UID = 104 -[testenv:python3.3-2.6.4-1.6-postgres] +[testenv:python3.3-1.6-postgres] commands = sh -c "dropdb pytest_django_105; createdb pytest_django_105 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python3.3 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 psycopg2==2.5.2 @@ -1597,13 +1597,13 @@ setenv = UID = 105 -[testenv:python3.3-2.6.4-1.6-sqlite] +[testenv:python3.3-1.6-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python3.3 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 setenv = @@ -1611,13 +1611,13 @@ setenv = UID = 106 -[testenv:python3.3-2.6.4-1.6-sqlite_file] +[testenv:python3.3-1.6-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python3.3 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 setenv = @@ -1625,14 +1625,14 @@ setenv = UID = 107 -[testenv:python3.3-2.6.4-1.7-postgres] +[testenv:python3.3-1.7-postgres] commands = sh -c "dropdb pytest_django_108; createdb pytest_django_108 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python3.3 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.7,<1.8 django-configurations==0.8 psycopg2==2.5.2 @@ -1641,13 +1641,13 @@ setenv = UID = 108 -[testenv:python3.3-2.6.4-1.7-sqlite] +[testenv:python3.3-1.7-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python3.3 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.7,<1.8 django-configurations==0.8 setenv = @@ -1655,13 +1655,13 @@ setenv = UID = 109 -[testenv:python3.3-2.6.4-1.7-sqlite_file] +[testenv:python3.3-1.7-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python3.3 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.7,<1.8 django-configurations==0.8 setenv = @@ -1669,15 +1669,15 @@ setenv = UID = 110 -[testenv:python3.3-2.6.4-1.8-postgres] +[testenv:python3.3-1.8-postgres] commands = sh -c "dropdb pytest_django_111; createdb pytest_django_111 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python3.3 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/stable/1.8.x.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/stable/1.8.x.tar.gz django-configurations==0.8 psycopg2==2.5.2 setenv = @@ -1685,43 +1685,43 @@ setenv = UID = 111 -[testenv:python3.3-2.6.4-1.8-sqlite] +[testenv:python3.3-1.8-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python3.3 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/stable/1.8.x.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/stable/1.8.x.tar.gz django-configurations==0.8 setenv = PYTHONPATH = {toxinidir} UID = 112 -[testenv:python3.3-2.6.4-1.8-sqlite_file] +[testenv:python3.3-1.8-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python3.3 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/stable/1.8.x.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/stable/1.8.x.tar.gz django-configurations==0.8 setenv = PYTHONPATH = {toxinidir} UID = 113 -[testenv:python3.3-2.6.4-master-postgres] +[testenv:python3.3-master-postgres] commands = sh -c "dropdb pytest_django_114; createdb pytest_django_114 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python3.3 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/master.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/master.tar.gz django-configurations==0.8 psycopg2==2.5.2 setenv = @@ -1729,42 +1729,42 @@ setenv = UID = 114 -[testenv:python3.3-2.6.4-master-sqlite] +[testenv:python3.3-master-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python3.3 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/master.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/master.tar.gz django-configurations==0.8 setenv = PYTHONPATH = {toxinidir} UID = 115 -[testenv:python3.3-2.6.4-master-sqlite_file] +[testenv:python3.3-master-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python3.3 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/master.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/master.tar.gz django-configurations==0.8 setenv = PYTHONPATH = {toxinidir} UID = 116 -[testenv:python3.4-2.6.4-1.5-postgres] +[testenv:python3.4-1.5-postgres] commands = sh -c "dropdb pytest_django_117; createdb pytest_django_117 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python3.4 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 psycopg2==2.5.2 @@ -1773,13 +1773,13 @@ setenv = UID = 117 -[testenv:python3.4-2.6.4-1.5-sqlite] +[testenv:python3.4-1.5-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python3.4 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 setenv = @@ -1787,13 +1787,13 @@ setenv = UID = 118 -[testenv:python3.4-2.6.4-1.5-sqlite_file] +[testenv:python3.4-1.5-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python3.4 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.5,<1.6 django-configurations==0.8 setenv = @@ -1801,14 +1801,14 @@ setenv = UID = 119 -[testenv:python3.4-2.6.4-1.6-postgres] +[testenv:python3.4-1.6-postgres] commands = sh -c "dropdb pytest_django_120; createdb pytest_django_120 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python3.4 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 psycopg2==2.5.2 @@ -1817,13 +1817,13 @@ setenv = UID = 120 -[testenv:python3.4-2.6.4-1.6-sqlite] +[testenv:python3.4-1.6-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python3.4 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 setenv = @@ -1831,13 +1831,13 @@ setenv = UID = 121 -[testenv:python3.4-2.6.4-1.6-sqlite_file] +[testenv:python3.4-1.6-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python3.4 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.6,<1.7 django-configurations==0.8 setenv = @@ -1845,14 +1845,14 @@ setenv = UID = 122 -[testenv:python3.4-2.6.4-1.7-postgres] +[testenv:python3.4-1.7-postgres] commands = sh -c "dropdb pytest_django_123; createdb pytest_django_123 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python3.4 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.7,<1.8 django-configurations==0.8 psycopg2==2.5.2 @@ -1861,13 +1861,13 @@ setenv = UID = 123 -[testenv:python3.4-2.6.4-1.7-sqlite] +[testenv:python3.4-1.7-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python3.4 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.7,<1.8 django-configurations==0.8 setenv = @@ -1875,13 +1875,13 @@ setenv = UID = 124 -[testenv:python3.4-2.6.4-1.7-sqlite_file] +[testenv:python3.4-1.7-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python3.4 deps = - pytest==2.6.4 - pytest-xdist==1.11 + pytest==2.7.0 + pytest-xdist==1.12 Django>=1.7,<1.8 django-configurations==0.8 setenv = @@ -1889,15 +1889,15 @@ setenv = UID = 125 -[testenv:python3.4-2.6.4-1.8-postgres] +[testenv:python3.4-1.8-postgres] commands = sh -c "dropdb pytest_django_126; createdb pytest_django_126 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python3.4 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/stable/1.8.x.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/stable/1.8.x.tar.gz django-configurations==0.8 psycopg2==2.5.2 setenv = @@ -1905,43 +1905,43 @@ setenv = UID = 126 -[testenv:python3.4-2.6.4-1.8-sqlite] +[testenv:python3.4-1.8-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python3.4 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/stable/1.8.x.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/stable/1.8.x.tar.gz django-configurations==0.8 setenv = PYTHONPATH = {toxinidir} UID = 127 -[testenv:python3.4-2.6.4-1.8-sqlite_file] +[testenv:python3.4-1.8-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python3.4 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/stable/1.8.x.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/stable/1.8.x.tar.gz django-configurations==0.8 setenv = PYTHONPATH = {toxinidir} UID = 128 -[testenv:python3.4-2.6.4-master-postgres] +[testenv:python3.4-master-postgres] commands = sh -c "dropdb pytest_django_129; createdb pytest_django_129 || exit 0" - py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_postgres --strict -r fEsxXw {posargs:tests} basepython = python3.4 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/master.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/master.tar.gz django-configurations==0.8 psycopg2==2.5.2 setenv = @@ -1949,28 +1949,28 @@ setenv = UID = 129 -[testenv:python3.4-2.6.4-master-sqlite] +[testenv:python3.4-master-sqlite] commands = - py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite --strict -r fEsxXw {posargs:tests} basepython = python3.4 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/master.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/master.tar.gz django-configurations==0.8 setenv = PYTHONPATH = {toxinidir} UID = 130 -[testenv:python3.4-2.6.4-master-sqlite_file] +[testenv:python3.4-master-sqlite_file] commands = - py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs} + py.test --ds=pytest_django_test.settings_sqlite_file --strict -r fEsxXw {posargs:tests} basepython = python3.4 deps = - pytest==2.6.4 - pytest-xdist==1.11 - https://github.com/django/django/archive/master.zip + pytest==2.7.0 + pytest-xdist==1.12 + https://github.com/django/django/archive/master.tar.gz django-configurations==0.8 setenv = PYTHONPATH = {toxinidir}