Skip to content

Commit 313f26d

Browse files
authored
Use/support pytest 3.0.0 (#375)
* Use pytest 3.x in CI tests. * Updated pytest version in README and setup.py * Use tool:pytest in setup.cfg * Change usage/mentions of py.test to pytest. #dropthedot The CI scripts still use py.test to be compatible with running the test suite with pytest 2.9.x.
1 parent 6700f10 commit 313f26d

18 files changed

+1139
-176
lines changed

.travis.yml

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,29 @@ language: python
44
python:
55
- "3.5"
66
env:
7-
- TESTENV=pypy-1.10-sqlite_file
8-
- TESTENV=pypy3-1.8-sqlite
9-
- TESTENV=pypy3-1.8-sqlite_file
10-
- TESTENV=python2.7-1.10-mysql_innodb
11-
- TESTENV=python2.7-1.10-mysql_myisam
12-
- TESTENV=python2.7-1.10-postgres
13-
- TESTENV=python2.7-1.7-postgres
14-
- TESTENV=python2.7-1.8-postgres
15-
- TESTENV=python2.7-1.9-postgres
16-
- TESTENV=python2.7-master-postgres
17-
- TESTENV=python3.3-1.8-postgres
18-
- TESTENV=python3.4-1.10-postgres
19-
- TESTENV=python3.5-1.10-postgres
20-
- TESTENV=python3.5-1.8-postgres
21-
- TESTENV=python3.5-1.9-postgres
22-
- TESTENV=python3.5-master-postgres
7+
- TESTENV=pypy-3.0.0-1.10-sqlite_file
8+
- TESTENV=pypy3-2.9.2-1.8-sqlite_file
9+
- TESTENV=pypy3-3.0.0-1.8-sqlite
10+
- TESTENV=pypy3-3.0.0-1.8-sqlite_file
11+
- TESTENV=python2.7-3.0.0-1.10-mysql_innodb
12+
- TESTENV=python2.7-3.0.0-1.10-mysql_myisam
13+
- TESTENV=python2.7-3.0.0-1.10-postgres
14+
- TESTENV=python2.7-3.0.0-1.7-postgres
15+
- TESTENV=python2.7-3.0.0-1.8-postgres
16+
- TESTENV=python2.7-3.0.0-1.9-postgres
17+
- TESTENV=python2.7-3.0.0-master-postgres
18+
- TESTENV=python3.3-3.0.0-1.8-postgres
19+
- TESTENV=python3.4-3.0.0-1.10-postgres
20+
- TESTENV=python3.5-3.0.0-1.10-postgres
21+
- TESTENV=python3.5-3.0.0-1.8-postgres
22+
- TESTENV=python3.5-3.0.0-1.9-postgres
23+
- TESTENV=python3.5-3.0.0-master-postgres
2324
- TESTENV=checkqa-python2.7
2425
- TESTENV=checkqa-python3.5
2526
matrix:
2627
allow_failures:
27-
- env: TESTENV=python2.7-master-postgres
28-
- env: TESTENV=python3.5-master-postgres
28+
- env: TESTENV=python2.7-3.0.0-master-postgres
29+
- env: TESTENV=python3.5-3.0.0-master-postgres
2930
install:
3031
# Create pip wrapper script, using travis_retry (a function) and
3132
# inject it into tox.ini.

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pytest-django allows you to test your Django project/applications with the
1717

1818
* Django: 1.7-1.10 and latest master branch (compatible at the time of each release)
1919
* Python: CPython 2.7,3.3-3.5 or PyPy 2,3
20-
* pytest: 2.9.x
20+
* pytest: >2.9.x
2121

2222
* Licence: BSD
2323
* Project maintainers: Andreas Pelme, Floris Bruynooghe and Daniel Hahler

docs/configuring_django.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@ Django settings the same way Django does by default.
1515
Example::
1616

1717
$ export DJANGO_SETTINGS_MODULE=test_settings
18-
$ py.test
18+
$ pytest
1919

2020
or::
2121

22-
$ DJANGO_SETTINGS_MODULE=test_settings py.test
22+
$ DJANGO_SETTINGS_MODULE=test_settings pytest
2323

2424

2525
Command line option ``--ds=SETTINGS``
2626
-------------------------------------
2727

2828
Example::
2929

30-
$ py.test --ds=test_settings
30+
$ pytest --ds=test_settings
3131

3232

3333
pytest.ini settings
@@ -59,11 +59,11 @@ flag, or pytest.ini DJANGO_CONFIGURATION.
5959
Environment Variable::
6060

6161
$ export DJANGO_CONFIGURATION=MySettings
62-
$ py.test
62+
$ pytest
6363

6464
Command Line Option::
6565

66-
$ py.test --dc=MySettings
66+
$ pytest --dc=MySettings
6767

6868

6969
INI File Contents::

docs/contributing.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,14 @@ You can manually create the virtualenv using::
117117

118118
$ make testenv
119119

120-
This will install a virtualenv with py.test and the latest stable version of
120+
This will install a virtualenv with pytest and the latest stable version of
121121
Django. The virtualenv can then be activated with::
122122

123123
$ source bin/activate
124124

125-
Then, simply invoke py.test to run the test suite::
125+
Then, simply invoke pytest to run the test suite::
126126

127-
$ py.test --ds=tests.settings_sqlite
127+
$ pytest --ds=tests.settings_sqlite
128128

129129

130130
tox can be used to run the test suite under different configurations by
@@ -164,7 +164,7 @@ but please don't include them in your pull requests.
164164

165165
After this short initial setup you're ready to run tests::
166166

167-
$ COVERAGE_PROCESS_START=`pwd`/.coveragerc COVERAGE_FILE=`pwd`/.coverage PYTHONPATH=`pwd` py.test --ds=tests.postgres_settings
167+
$ COVERAGE_PROCESS_START=`pwd`/.coveragerc COVERAGE_FILE=`pwd`/.coverage PYTHONPATH=`pwd` pytest --ds=tests.postgres_settings
168168

169169
You should repeat the above step for sqlite and mysql before the next step.
170170
This step will create a lot of ``.coverage`` files with additional suffixes for

docs/database.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ what code uses the database and catches any mistakes.
1212
Enabling database access in tests
1313
---------------------------------
1414

15-
You can use `py.test marks <http://pytest.org/latest/mark.html>`_ to
15+
You can use `pytest marks <http://pytest.org/latest/mark.html>`_ to
1616
tell ``pytest-django`` your test needs database access::
1717

1818
import pytest
@@ -24,7 +24,7 @@ tell ``pytest-django`` your test needs database access::
2424

2525
It is also possible to mark all tests in a class or module at once.
2626
This demonstrates all the ways of marking, even though they overlap.
27-
Just one of these marks would have been sufficient. See the `py.test
27+
Just one of these marks would have been sufficient. See the `pytest
2828
documentation
2929
<http://pytest.org/latest/example/markers.html#marking-whole-classes-or-modules>`_
3030
for detail::
@@ -115,10 +115,10 @@ A good way to use ``--reuse-db`` and ``--create-db`` can be:
115115
[pytest]
116116
addopts = --reuse-db
117117

118-
* Just run tests with ``py.test``, on the first run the test database will be
118+
* Just run tests with ``pytest``, on the first run the test database will be
119119
created. The next test run it will be reused.
120120

121-
* When you alter your database schema, run ``py.test --create-db``, to force
121+
* When you alter your database schema, run ``pytest --create-db``, to force
122122
re-creation of the test database.
123123

124124
``--nomigrations`` - Disable Django 1.7+ migrations

docs/faq.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ locale, put the following code in your project's `conftest.py
3131

3232
My tests are not being found. Why not?
3333
-------------------------------------------------------------------------------------
34-
By default, py.test looks for tests in files named ``test_*.py`` (note that
34+
By default, pytest looks for tests in files named ``test_*.py`` (note that
3535
this is not the same as ``test*.py``). If you have your tests in files with
3636
other names, they will not be collected. It is common to put tests under
3737
``app_directory/tests/views.py``. To find those tests, create a ``pytest.ini``
@@ -56,7 +56,7 @@ transactions are tested or not.
5656
How can I use ``manage.py test`` with pytest-django?
5757
----------------------------------------------------
5858

59-
pytest-django is designed to work with the ``py.test`` command, but if you
59+
pytest-django is designed to work with the ``pytest`` command, but if you
6060
really need integration with ``manage.py test``, you can create a simple
6161
test runner like this::
6262

@@ -94,7 +94,7 @@ Add the path to this class in your Django settings::
9494

9595
Usage::
9696

97-
./manage.py test <django args> -- <py.test args>
97+
./manage.py test <django args> -- <pytest args>
9898

9999
**Note**: the pytest-django command line options ``--ds`` and ``--dc`` are not
100100
compatible with this approach, you need to use the standard Django methods of

docs/helpers.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Django helpers
66
Markers
77
-------
88

9-
``pytest-django`` registers and uses markers. See the py.test documentation_
9+
``pytest-django`` registers and uses markers. See the pytest documentation_
1010
on what marks are and for notes on using_ them.
1111

1212
.. _documentation: http://pytest.org/latest/mark.html
@@ -82,7 +82,7 @@ when trying to access the database.
8282

8383
.. py:function:: pytest.mark.ignore_template_errors
8484
85-
If you run py.test using the ``--fail-on-template-vars`` option,
85+
If you run pytest using the ``--fail-on-template-vars`` option,
8686
tests will fail should your templates contain any invalid variables.
8787
This marker will disable this feature by setting ``settings.TEMPLATE_STRING_IF_INVALID=None``
8888
or the ``string_if_invalid`` template option in Django>=1.7
@@ -98,7 +98,7 @@ Fixtures
9898
--------
9999

100100
pytest-django provides some pytest fixtures to provide dependencies for tests.
101-
More information on fixtures is available in the `py.test documentation
101+
More information on fixtures is available in the `pytest documentation
102102
<http://pytest.org/latest/fixture.html>`_.
103103

104104

docs/index.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Welcome to pytest-django's documentation!
22
=========================================
33

4-
pytest-django is a plugin for `py.test <http://pytest.org/>`_ that provides a set of useful tools for testing `Django <http://www.djangoproject.com/>`_ applications and projects.
4+
pytest-django is a plugin for `pytest <http://pytest.org/>`_ that provides a set of useful tools for testing `Django <http://www.djangoproject.com/>`_ applications and projects.
55

66
.. toctree::
77
:maxdepth: 3
@@ -19,7 +19,7 @@ pytest-django is a plugin for `py.test <http://pytest.org/>`_ that provides a se
1919
Why would I use this instead of Django's manage.py test command?
2020
================================================================
2121

22-
Running the test suite with py.test offers some features that are not present in Django's standard test mechanism:
22+
Running the test suite with pytest offers some features that are not present in Django's standard test mechanism:
2323

2424
* Less boilerplate: no need to import unittest, create a subclass with methods. Just write tests as regular functions.
2525
* `Manage test dependencies with fixtures <http://pytest.org/latest/fixture.html>`_
@@ -28,12 +28,12 @@ Running the test suite with py.test offers some features that are not present in
2828
* There are a lot of other nice plugins available for pytest.
2929
* Easy switching: Existing unittest-style tests will still work without any modifications.
3030

31-
See the `py.test documentation <http://pytest.org/latest/>`_ for more information on py.test.
31+
See the `pytest documentation <http://pytest.org/latest/>`_ for more information on pytest.
3232

3333
Quick Start
3434
===========
3535
1. ``pip install pytest-django``
36-
2. Make sure ``DJANGO_SETTINGS_MODULE`` is defined and and run tests with the ``py.test`` command.
36+
2. Make sure ``DJANGO_SETTINGS_MODULE`` is defined and and run tests with the ``pytest`` command.
3737
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 :ref:`faq-tests-not-being-picked-up`.
3838

3939

docs/managing_python_path.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pytest needs to be able to import the code in your project. Normally, when
77
interacting with Django code, the interaction happens via ``manage.py``, which
88
will implicilty add that directory to the Python path.
99

10-
However, when Python is started via the ``py.test`` command, some extra care is
10+
However, when Python is started via the ``pytest`` command, some extra care is
1111
needed to have the Python path setup properly. There are two ways to handle
1212
this problem, described below.
1313

docs/tutorial.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Talks, articles and blog posts
1313

1414
* Talk from DjangoCon Europe 2014: `pytest: helps you write better Django apps, by Andreas Pelme <https://www.youtube.com/watch?v=aaArYVh6XSM>`_
1515

16-
* Talk from EuroPython 2013: `Testing Django application with py.test, by Andreas Pelme <http://www.youtube.com/watch?v=aUf8Fkb7TaY>`_
16+
* Talk from EuroPython 2013: `Testing Django application with pytest, by Andreas Pelme <http://www.youtube.com/watch?v=aUf8Fkb7TaY>`_
1717

1818
* Three part blog post tutorial (part 3 mentions Django integration): `pytest: no-boilerplate testing, by Daniel Greenfeld <http://pydanny.com/pytest-no-boilerplate-testing.html>`_
1919

@@ -56,10 +56,10 @@ full documentation on :ref:`configuring_django_settings`.
5656
Step 3: Run your test suite
5757
---------------------------
5858

59-
Tests are invoked directly with the ``py.test`` command, instead of ``manage.py
59+
Tests are invoked directly with the ``pytest`` command, instead of ``manage.py
6060
test``, that you might be used to::
6161

62-
py.test
62+
pytest
6363

6464
Do you have problems with pytest not finding your code? See the FAQ
6565
:ref:`faq-import-error`.

0 commit comments

Comments
 (0)