Skip to content

Commit 5aa9790

Browse files
authored
Merge branch 'master' into testpaths-for-managepy-check
2 parents a835c2e + 781daae commit 5aa9790

20 files changed

+157
-108
lines changed

.coveragerc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[run]
22
parallel = true
3-
source = pytest_django
3+
source = pytest_django,pytest_django_test,tests
44
branch = true

.gitignore

-5
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ _build
1010
/.coverage.*
1111
/.coverage
1212
/htmlcov/
13-
/bin/
14-
/include/
15-
/lib/
16-
/src/
17-
/share/
1813
.cache
1914
.Python
2015
.eggs

.travis.yml

+42-30
Original file line numberDiff line numberDiff line change
@@ -5,62 +5,55 @@ language: python
55
matrix:
66
fast_finish: true
77
include:
8-
98
- python: 3.6
10-
env: TOXENV=py36-pytest30-djangomaster-postgres
9+
env: TOXENV=py36-pytest3-djangomaster-postgres
1110
- python: 3.6
12-
env: TOXENV=py36-pytest30-django1.11-postgres
11+
env: TOXENV=py36-pytest3-django1.11-postgres
1312
- python: 3.6
14-
env: TOXENV=py36-pytest30-django1.10-postgres
13+
env: TOXENV=py36-pytest3-django1.10-postgres
1514
- python: 3.6
16-
env: TOXENV=py36-pytest30-django1.9-postgres
15+
env: TOXENV=py36-pytest3-django1.9-postgres
1716
- python: 3.6
18-
env: TOXENV=py36-pytest30-django1.8-postgres
17+
env: TOXENV=py36-pytest3-django1.8-postgres
1918
- python: 3.6
2019
env: TOXENV=py36-checkqa
2120

2221
- python: 3.5
23-
env: TOXENV=py35-pytest30-django1.11-postgres
22+
env: TOXENV=py35-pytest3-django1.11-postgres
2423

2524
- python: 3.4
26-
env: TOXENV=py34-pytest30-django1.11-postgres
25+
env: TOXENV=py34-pytest3-django1.11-postgres
2726

2827
- python: 3.3
29-
env: TOXENV=py34-pytest30-django1.8-postgres
28+
env: TOXENV=py34-pytest3-django1.8-postgres
3029

3130
- python: 2.7
32-
env: TOXENV=py27-pytest30-django1.11-mysql_innodb
31+
env: TOXENV=py27-pytest3-django1.11-mysql_innodb
3332
- python: 2.7
34-
env: TOXENV=py27-pytest30-django1.11-mysql_myisam
33+
env: TOXENV=py27-pytest3-django1.11-mysql_myisam
3534
- python: 2.7
36-
env: TOXENV=py27-pytest30-django1.11-postgres
35+
env: TOXENV=py27-pytest3-django1.11-postgres
3736
- python: 2.7
38-
env: TOXENV=py27-pytest30-django1.10-postgres
37+
env: TOXENV=py27-pytest3-django1.10-postgres
3938
- python: 2.7
40-
env: TOXENV=py27-pytest30-django1.9-postgres
39+
env: TOXENV=py27-pytest3-django1.9-postgres
4140
- python: 2.7
42-
env: TOXENV=py27-pytest30-django1.8-postgres
41+
env: TOXENV=py27-pytest3-django1.8-postgres
4342
- python: 2.7
44-
env: TOXENV=py27-pytest30-django1.7-postgres
43+
env: TOXENV=py27-pytest3-django1.7-postgres
4544
- python: 2.7
4645
env: TOXENV=py27-checkqa
4746

4847
- python: pypy
49-
env: TOXENV=pypy-pytest30-django1.11-sqlite_file
48+
env: TOXENV=pypy-pytest3-django1.11-sqlite_file
5049

5150
- python: pypy3
52-
env: TOXENV=pypy3-pytest30-django1.8-sqlite
51+
env: TOXENV=pypy3-pytest3-django1.8-sqlite
5352
- python: pypy3
54-
env: TOXENV=pypy3-pytest30-django1.10-sqlite_file
53+
env: TOXENV=pypy3-pytest3-django1.10-sqlite_file
5554

5655
allow_failures:
57-
- env: TOXENV=py36-pytest30-djangomaster-postgres
58-
59-
# Temporary.
60-
# https://github.com/pytest-dev/pytest-django/pull/445
61-
# https://github.com/pytest-dev/pytest-django/issues/448
62-
- env: TOXENV=pypy3-pytest30-django1.8-sqlite
63-
- env: TOXENV=pypy3-pytest30-django1.10-sqlite_file
56+
- env: TOXENV=py36-pytest3-djangomaster-postgres
6457

6558
cache:
6659
directories:
@@ -76,12 +69,31 @@ install:
7669
- printf '\necho "Using pip-wrapper.." >&2\ntravis_retry pip "$@"' >> bin/travis_retry_pip
7770
- chmod +x bin/travis_retry_pip
7871
- sed -i.bak 's/^\[testenv\]/\0\ninstall_command = travis_retry_pip install {opts} {packages}/' tox.ini
79-
- diff tox.ini tox.ini.bak && return 1 || true
80-
- sed -i.bak 's/whitelist_externals =/\0\n travis_retry_pip/' tox.ini
81-
- diff tox.ini tox.ini.bak && return 1 || true
72+
- if diff tox.ini tox.ini.bak; then exit 1; fi
73+
- printf '\nwhitelist_externals = travis_retry_pip' >> tox.ini
8274

83-
- pip install tox==2.3.1
75+
- pip install tox==2.7.0
76+
- |
77+
if [[ "${TOXENV%-checkqa}" == "$TOXENV" ]]; then
78+
export PYTEST_ADDOPTS='--cov=pytest_django --cov=tests --cov=pytest_django_test --cov-report=term-missing:skip-covered'
79+
export _PYTESTDJANGO_TOX_EXTRA_DEPS=pytest-cov
80+
fi
8481
8582
script:
8683
- tox
8784
- "find ${TRAVIS_BUILD_DIR}/.tox -name 'log' -o -name '__pycache__' -type d | xargs -I {} rm -rf {}"
85+
86+
after_success:
87+
- |
88+
set -ex
89+
if [[ "${TOXENV%-checkqa}" == "$TOXENV" ]]; then
90+
pip install codecov
91+
coverage combine
92+
coverage xml
93+
coverage report -m --skip-covered
94+
95+
codecov_flags=${TOXENV//./}
96+
codecov_flags=${codecov_flags//-/ }
97+
codecov --required -X search gcov pycov -f coverage.xml --flags $codecov_flags
98+
fi
99+
set +x

Makefile

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
.PHONY: docs test clean isort
22

3+
VENV:=build/venv
4+
35
export DJANGO_SETTINGS_MODULE?=pytest_django_test.settings_sqlite_file
46

5-
testenv: bin/py.test
7+
testenv: $(VENV)/bin/pytest
68

7-
test: bin/py.test
8-
bin/pip install -e .
9-
bin/py.test
9+
test: $(VENV)/bin/pytest
10+
$(VENV)/bin/pip install -e .
11+
$(VENV)/bin/py.test
1012

11-
bin/python bin/pip:
12-
virtualenv .
13+
$(VENV)/bin/python $(VENV)/bin/pip:
14+
virtualenv $(VENV)
1315

14-
bin/py.test: bin/python requirements.txt
15-
bin/pip install -Ur requirements.txt
16+
$(VENV)/bin/pytest: $(VENV)/bin/python requirements.txt
17+
$(VENV)/bin/pip install -Ur requirements.txt
1618
touch $@
1719

18-
bin/sphinx-build: bin/pip
19-
bin/pip install sphinx
20+
$(VENV)/bin/sphinx-build: $(VENV)/bin/pip
21+
$(VENV)/bin/pip install sphinx
2022

21-
docs: bin/sphinx-build
22-
SPHINXBUILD=../bin/sphinx-build $(MAKE) -C docs html
23+
docs: $(VENV)/bin/sphinx-build
24+
SPHINXBUILD=../$(VENV)/bin/sphinx-build $(MAKE) -C docs html
2325

2426
# See setup.cfg for configuration.
2527
isort:

README.rst

+9-6
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
.. image:: https://img.shields.io/pypi/v/pytest-django.svg?style=flat
55
:alt: PyPI Version
66
:target: https://pypi.python.org/pypi/pytest-django
7+
.. image:: https://img.shields.io/codecov/c/github/pytest-dev/pytest-django.svg?style=flat
8+
:alt: Coverage
9+
:target: https://codecov.io/gh/pytest-dev/pytest-django
710

811
Welcome to pytest-django!
912
=========================
1013

1114
pytest-django allows you to test your Django project/applications with the
12-
`pytest testing tool <http://pytest.org/>`_.
15+
`pytest testing tool <https://pytest.org/>`_.
1316

1417
* `Quick start / tutorial
1518
<https://pytest-django.readthedocs.io/en/latest/tutorial.html>`_
@@ -19,8 +22,8 @@ pytest-django allows you to test your Django project/applications with the
1922
<https://pytest-django.readthedocs.io/en/latest/contributing.html>`_
2023
* Version compatibility:
2124

22-
* Django: 1.7-1.10 and latest master branch (compatible at the time of each release)
23-
* Python: CPython 2.7,3.3-3.5 or PyPy 2,3
25+
* Django: 1.7-1.11 and latest master branch (compatible at the time of each release)
26+
* Python: CPython 2.7,3.3-3.6 or PyPy 2,3
2427
* pytest: >2.9.x
2528

2629
* Licence: BSD
@@ -43,11 +46,11 @@ Why would I use this instead of Django's `manage.py test` command?
4346
Running your test suite with pytest-django allows you to tap into the features
4447
that are already present in pytest. Here are some advantages:
4548

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

53-
See the `pytest documentation <http://pytest.org/latest/>`_ for more information on pytest itself.
56+
See the `pytest documentation <https://pytest.org/en/latest/>`_ for more information on pytest itself.

docs/database.rst

+2-2
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 `pytest marks <http://pytest.org/latest/mark.html>`_ to
15+
You can use `pytest marks <https://pytest.org/en/latest/mark.html>`_ to
1616
tell ``pytest-django`` your test needs database access::
1717

1818
import pytest
@@ -26,7 +26,7 @@ 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.
2727
Just one of these marks would have been sufficient. See the `pytest
2828
documentation
29-
<http://pytest.org/latest/example/markers.html#marking-whole-classes-or-modules>`_
29+
<https://pytest.org/en/latest/example/markers.html#marking-whole-classes-or-modules>`_
3030
for detail::
3131

3232
import pytest

docs/faq.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ for more information.
1616
How can I make sure that all my tests run with a specific locale?
1717
-----------------------------------------------------------------
1818

19-
Create a `pytest fixture <http://pytest.org/latest/fixture.html>`_ that is
19+
Create a `pytest fixture <https://pytest.org/en/latest/fixture.html>`_ that is
2020
automatically run before each test case. To run all tests with the english
2121
locale, put the following code in your project's `conftest.py`_ file:
2222

docs/helpers.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ Markers
99
``pytest-django`` registers and uses markers. See the pytest documentation_
1010
on what marks are and for notes on using_ them.
1111

12-
.. _documentation: http://pytest.org/latest/mark.html
13-
.. _using: http://pytest.org/latest/example/markers.html#marking-whole-classes-or-modules
12+
.. _documentation: https://pytest.org/en/latest/mark.html
13+
.. _using: https://pytest.org/en/latest/example/markers.html#marking-whole-classes-or-modules
1414

1515

1616
``pytest.mark.django_db(transaction=False)`` - request database access
@@ -74,7 +74,7 @@ when trying to access the database.
7474

7575
@pytest.mark.urls('myapp.test_urls')
7676
def test_something(client):
77-
assert 'Success!' in client.get('/some_url_defined_in_test_urls/')
77+
assert 'Success!' in client.get('/some_url_defined_in_test_urls/').content
7878

7979

8080
``pytest.mark.ignore_template_errors`` - ignore invalid template variables
@@ -99,7 +99,7 @@ Fixtures
9999

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

104104

105105
``rf`` - ``RequestFactory``

docs/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pytest-django Documentation
55
pytest-django is a plugin for `pytest`_ that provides a set of useful tools
66
for testing `Django`_ applications and projects.
77

8-
.. _pytest: http://pytest.org/
8+
.. _pytest: https://pytest.org/
99
.. _Django: https://www.djangoproject.com/
1010

1111
Quick Start

docs/tutorial.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Talks, articles and blog posts
2121
John Costa
2222
<http://www.johnmcostaiii.net/2013/django-projects-to-django-apps-converting-the-unit-tests/>`_.
2323

24-
For general information and tutorials on pytest, see the `pytest tutorial page <http://pytest.org/latest/getting-started.html>`_.
24+
For general information and tutorials on pytest, see the `pytest tutorial page <https://pytest.org/en/latest/getting-started.html>`_.
2525

2626

2727
Step 1: Installation
@@ -88,7 +88,7 @@ The :ref:`usage` section describes more ways to interact with your test suites.
8888
pytest-django also provides some :ref:`helpers` to make it easier to write
8989
Django tests.
9090

91-
Consult the `pytest documentation <http://pytest.org/>`_ for more information
91+
Consult the `pytest documentation <https://pytest.org/>`_ for more information
9292
on pytest itself.
9393

9494
Stuck? Need help?

docs/usage.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ the command line::
2020
pytest test_something.py a_directory
2121

2222
See the `pytest documentation on Usage and invocations
23-
<http://pytest.org/latest/usage.html>`_ for more help on available parameters.
23+
<https://pytest.org/en/latest/usage.html>`_ for more help on available parameters.
2424

2525
Additional command line options
2626
-------------------------------
@@ -51,6 +51,6 @@ is set to "foo", the test database with xdist will be "test_foo_gw0",
5151
"test_foo_gw1" etc.
5252

5353
See the full documentation on `pytest-xdist
54-
<http://pytest.org/latest/xdist.html>`_ for more information. Among other
54+
<https://pytest.org/en/latest/xdist.html>`_ for more information. Among other
5555
features, pytest-xdist can distribute/coordinate test execution on remote
5656
machines.

pytest_django/lazy_django.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
def skip_if_no_django():
1212
"""Raises a skip exception when no Django settings are available"""
1313
if not django_settings_is_configured():
14-
pytest.skip('Test skipped since no Django settings is present.')
14+
pytest.skip('no Django settings')
1515

1616

1717
def django_settings_is_configured():

pytest_django/live_server_helper.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
class LiveServer(object):
55
"""The liveserver fixture
66
7-
This is the object which is returned to the actual user when they
8-
request the ``live_server`` fixture. The fixture handles creation
9-
and stopping however.
7+
This is the object that the ``live_server`` fixture returns.
8+
The ``live_server`` fixture that handles creation and stopping.
109
"""
1110

1211
def __init__(self, addr):

0 commit comments

Comments
 (0)