Skip to content

Commit 7e10c81

Browse files
authored
Added link checking to tox and release.py (#5614)
Added link checking to tox and release.py
2 parents 4ee984f + ceeb7bd commit 7e10c81

15 files changed

+57
-29
lines changed

CHANGELOG.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3695,7 +3695,7 @@ Deprecations and Removals
36953695

36963696
- ``pytest.approx`` no longer supports ``>``, ``>=``, ``<`` and ``<=``
36973697
operators to avoid surprising/inconsistent behavior. See `the approx docs
3698-
<https://docs.pytest.org/en/latest/builtin.html#pytest.approx>`_ for more
3698+
<https://docs.pytest.org/en/latest/reference.html#pytest-approx>`_ for more
36993699
information. (`#2003 <https://github.com/pytest-dev/pytest/issues/2003>`_)
37003700

37013701
- All old-style specific behavior in current classes in the pytest's API is
@@ -5052,7 +5052,7 @@ time or change existing behaviors in order to make them less surprising/more use
50525052
* Fix (`#1422`_): junit record_xml_property doesn't allow multiple records
50535053
with same name.
50545054

5055-
.. _`traceback style docs`: https://pytest.org/latest/usage.html#modifying-python-traceback-printing
5055+
.. _`traceback style docs`: https://pytest.org/en/latest/usage.html#modifying-python-traceback-printing
50565056

50575057
.. _#1609: https://github.com/pytest-dev/pytest/issues/1609
50585058
.. _#1422: https://github.com/pytest-dev/pytest/issues/1422
@@ -5570,7 +5570,7 @@ time or change existing behaviors in order to make them less surprising/more use
55705570
- add ability to set command line options by environment variable PYTEST_ADDOPTS.
55715571

55725572
- added documentation on the new pytest-dev teams on bitbucket and
5573-
github. See https://pytest.org/latest/contributing.html .
5573+
github. See https://pytest.org/en/latest/contributing.html .
55745574
Thanks to Anatoly for pushing and initial work on this.
55755575

55765576
- fix issue650: new option ``--docttest-ignore-import-errors`` which
@@ -6311,7 +6311,7 @@ Bug fixes:
63116311
- yielded test functions will now have autouse-fixtures active but
63126312
cannot accept fixtures as funcargs - it's anyway recommended to
63136313
rather use the post-2.0 parametrize features instead of yield, see:
6314-
http://pytest.org/latest/example/parametrize.html
6314+
http://pytest.org/en/latest/example/parametrize.html
63156315
- fix autouse-issue where autouse-fixtures would not be discovered
63166316
if defined in an a/conftest.py file and tests in a/tests/test_some.py
63176317
- fix issue226 - LIFO ordering for fixture teardowns
@@ -6444,7 +6444,7 @@ Bug fixes:
64446444
- pluginmanager.register(...) now raises ValueError if the
64456445
plugin has been already registered or the name is taken
64466446

6447-
- fix issue159: improve http://pytest.org/latest/faq.html
6447+
- fix issue159: improve http://pytest.org/en/latest/faq.html
64486448
especially with respect to the "magic" history, also mention
64496449
pytest-django, trial and unittest integration.
64506450

@@ -6557,7 +6557,7 @@ Bug fixes:
65576557
or through plugin hooks. Also introduce a "--strict" option which
65586558
will treat unregistered markers as errors
65596559
allowing to avoid typos and maintain a well described set of markers
6560-
for your test suite. See exaples at http://pytest.org/latest/mark.html
6560+
for your test suite. See exaples at http://pytest.org/en/latest/mark.html
65616561
and its links.
65626562
- issue50: introduce "-m marker" option to select tests based on markers
65636563
(this is a stricter and more predictable version of '-k' in that "-m"
@@ -6740,7 +6740,7 @@ Bug fixes:
67406740
- refinements to "collecting" output on non-ttys
67416741
- refine internal plugin registration and --traceconfig output
67426742
- introduce a mechanism to prevent/unregister plugins from the
6743-
command line, see http://pytest.org/plugins.html#cmdunregister
6743+
command line, see http://pytest.org/en/latest/plugins.html#cmdunregister
67446744
- activate resultlog plugin by default
67456745
- fix regression wrt yielded tests which due to the
67466746
collection-before-running semantics were not

doc/en/announce/release-2.0.0.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ see below for summary and detailed lists. A lot of long-deprecated code
77
has been removed, resulting in a much smaller and cleaner
88
implementation. See the new docs with examples here:
99

10-
http://pytest.org/2.0.0/index.html
10+
http://pytest.org/en/latest/index.html
1111

1212
A note on packaging: pytest used to part of the "py" distribution up
1313
until version py-1.3.4 but this has changed now: pytest-2.0.0 only
@@ -36,12 +36,12 @@ New Features
3636

3737
import pytest ; pytest.main(arglist, pluginlist)
3838

39-
see http://pytest.org/2.0.0/usage.html for details.
39+
see http://pytest.org/en/latest/usage.html for details.
4040

4141
- new and better reporting information in assert expressions
4242
if comparing lists, sequences or strings.
4343

44-
see http://pytest.org/2.0.0/assert.html#newreport
44+
see http://pytest.org/en/latest/assert.html#newreport
4545

4646
- new configuration through ini-files (setup.cfg or tox.ini recognized),
4747
for example::
@@ -50,7 +50,7 @@ New Features
5050
norecursedirs = .hg data* # don't ever recurse in such dirs
5151
addopts = -x --pyargs # add these command line options by default
5252

53-
see http://pytest.org/2.0.0/customize.html
53+
see http://pytest.org/en/latest/customize.html
5454

5555
- improved standard unittest support. In general py.test should now
5656
better be able to run custom unittest.TestCases like twisted trial

doc/en/announce/release-2.0.1.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Changes between 2.0.0 and 2.0.1
5757
- refinements to "collecting" output on non-ttys
5858
- refine internal plugin registration and --traceconfig output
5959
- introduce a mechanism to prevent/unregister plugins from the
60-
command line, see http://pytest.org/latest/plugins.html#cmdunregister
60+
command line, see http://pytest.org/en/latest/plugins.html#cmdunregister
6161
- activate resultlog plugin by default
6262
- fix regression wrt yielded tests which due to the
6363
collection-before-running semantics were not

doc/en/announce/release-2.2.0.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ with these improvements:
99

1010
- new @pytest.mark.parametrize decorator to run tests with different arguments
1111
- new metafunc.parametrize() API for parametrizing arguments independently
12-
- see examples at http://pytest.org/latest/example/parametrize.html
12+
- see examples at http://pytest.org/en/latest/example/parametrize.html
1313
- NOTE that parametrize() related APIs are still a bit experimental
1414
and might change in future releases.
1515

@@ -18,7 +18,7 @@ with these improvements:
1818
- "-m markexpr" option for selecting tests according to their mark
1919
- a new "markers" ini-variable for registering test markers for your project
2020
- the new "--strict" bails out with an error if using unregistered markers.
21-
- see examples at http://pytest.org/latest/example/markers.html
21+
- see examples at http://pytest.org/en/latest/example/markers.html
2222

2323
* duration profiling: new "--duration=N" option showing the N slowest test
2424
execution or setup/teardown calls. This is most useful if you want to
@@ -78,7 +78,7 @@ Changes between 2.1.3 and 2.2.0
7878
or through plugin hooks. Also introduce a "--strict" option which
7979
will treat unregistered markers as errors
8080
allowing to avoid typos and maintain a well described set of markers
81-
for your test suite. See examples at http://pytest.org/latest/mark.html
81+
for your test suite. See examples at http://pytest.org/en/latest/mark.html
8282
and its links.
8383
- issue50: introduce "-m marker" option to select tests based on markers
8484
(this is a stricter and more predictable version of "-k" in that "-m"

doc/en/announce/release-2.3.0.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ re-useable fixture design.
1313

1414
For detailed info and tutorial-style examples, see:
1515

16-
http://pytest.org/latest/fixture.html
16+
http://pytest.org/en/latest/fixture.html
1717

1818
Moreover, there is now support for using pytest fixtures/funcargs with
1919
unittest-style suites, see here for examples:
2020

21-
http://pytest.org/latest/unittest.html
21+
http://pytest.org/en/latest/unittest.html
2222

2323
Besides, more unittest-test suites are now expected to "simply work"
2424
with pytest.
@@ -29,11 +29,11 @@ pytest-2.2.4.
2929

3030
If you are interested in the precise reasoning (including examples) of the
3131
pytest-2.3 fixture evolution, please consult
32-
http://pytest.org/latest/funcarg_compare.html
32+
http://pytest.org/en/latest/funcarg_compare.html
3333

3434
For general info on installation and getting started:
3535

36-
http://pytest.org/latest/getting-started.html
36+
http://pytest.org/en/latest/getting-started.html
3737

3838
Docs and PDF access as usual at:
3939

@@ -94,7 +94,7 @@ Changes between 2.2.4 and 2.3.0
9494
- pluginmanager.register(...) now raises ValueError if the
9595
plugin has been already registered or the name is taken
9696

97-
- fix issue159: improve http://pytest.org/latest/faq.html
97+
- fix issue159: improve http://pytest.org/en/latest/faq.html
9898
especially with respect to the "magic" history, also mention
9999
pytest-django, trial and unittest integration.
100100

doc/en/announce/release-2.3.4.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ comes with the following fixes and features:
1616
- yielded test functions will now have autouse-fixtures active but
1717
cannot accept fixtures as funcargs - it's anyway recommended to
1818
rather use the post-2.0 parametrize features instead of yield, see:
19-
http://pytest.org/latest/example/parametrize.html
19+
http://pytest.org/en/latest/example/parametrize.html
2020
- fix autouse-issue where autouse-fixtures would not be discovered
2121
if defined in an a/conftest.py file and tests in a/tests/test_some.py
2222
- fix issue226 - LIFO ordering for fixture teardowns

doc/en/announce/release-2.4.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ from a few supposedly very minor incompatibilities. See below for
77
a full list of details. A few feature highlights:
88

99
- new yield-style fixtures `pytest.yield_fixture
10-
<http://pytest.org/latest/yieldfixture.html>`_, allowing to use
10+
<http://pytest.org/en/latest/yieldfixture.html>`_, allowing to use
1111
existing with-style context managers in fixture functions.
1212

1313
- improved pdb support: ``import pdb ; pdb.set_trace()`` now works

doc/en/announce/release-2.7.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ holger krekel
5252
- add ability to set command line options by environment variable PYTEST_ADDOPTS.
5353

5454
- added documentation on the new pytest-dev teams on bitbucket and
55-
github. See https://pytest.org/latest/contributing.html .
55+
github. See https://pytest.org/en/latest/contributing.html .
5656
Thanks to Anatoly for pushing and initial work on this.
5757

5858
- fix issue650: new option ``--docttest-ignore-import-errors`` which

doc/en/announce/release-2.9.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ The py.test Development Team
131131
with same name.
132132

133133

134-
.. _`traceback style docs`: https://pytest.org/latest/usage.html#modifying-python-traceback-printing
134+
.. _`traceback style docs`: https://pytest.org/en/latest/usage.html#modifying-python-traceback-printing
135135

136136
.. _#1422: https://github.com/pytest-dev/pytest/issues/1422
137137
.. _#1379: https://github.com/pytest-dev/pytest/issues/1379

doc/en/conf.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,19 @@
112112
# A list of ignored prefixes for module index sorting.
113113
# modindex_common_prefix = []
114114

115+
# A list of regular expressions that match URIs that should not be checked when
116+
# doing a linkcheck.
117+
linkcheck_ignore = [
118+
"https://github.com/numpy/numpy/blob/master/doc/release/1.16.0-notes.rst#new-deprecations",
119+
"https://blogs.msdn.microsoft.com/bharry/2017/06/28/testing-in-a-cloud-delivery-cadence/",
120+
"http://pythontesting.net/framework/pytest-introduction/",
121+
r"https://github.com/pytest-dev/pytest/issues/\d+",
122+
r"https://github.com/pytest-dev/pytest/pull/\d+",
123+
]
124+
125+
# The number of worker threads to use when checking links (default=5).
126+
linkcheck_workers = 5
127+
115128

116129
# -- Options for HTML output ---------------------------------------------------
117130

doc/en/fixture.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ pytest fixtures: explicit, modular, scalable
99

1010

1111

12-
.. _`xUnit`: http://en.wikipedia.org/wiki/XUnit
13-
.. _`purpose of test fixtures`: http://en.wikipedia.org/wiki/Test_fixture#Software
14-
.. _`Dependency injection`: http://en.wikipedia.org/wiki/Dependency_injection
12+
.. _`xUnit`: https://en.wikipedia.org/wiki/XUnit
13+
.. _`purpose of test fixtures`: https://en.wikipedia.org/wiki/Test_fixture#Software
14+
.. _`Dependency injection`: https://en.wikipedia.org/wiki/Dependency_injection
1515

1616
The `purpose of test fixtures`_ is to provide a fixed baseline
1717
upon which tests can reliably and repeatedly execute. pytest fixtures

doc/en/projects.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ Some organisations using pytest
7373

7474
* `Square Kilometre Array, Cape Town <http://ska.ac.za/>`_
7575
* `Some Mozilla QA people <http://www.theautomatedtester.co.uk/blog/2011/pytest_and_xdist_plugin.html>`_ use pytest to distribute their Selenium tests
76-
* `Tandberg <http://www.tandberg.com/>`_
7776
* `Shootq <http://web.shootq.com/>`_
7877
* `Stups department of Heinrich Heine University Duesseldorf <http://www.stups.uni-duesseldorf.de/projects.php>`_
7978
* cellzome

doc/en/talks.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Talks and blog postings
6464
- `pytest introduction from Brian Okken (January 2013)
6565
<http://pythontesting.net/framework/pytest-introduction/>`_
6666

67-
- pycon australia 2012 pytest talk from Brianna Laugher (`video <http://www.youtube.com/watch?v=DTNejE9EraI>`_, `slides <http://www.slideshare.net/pfctdayelise/funcargs-other-fun-with-pytest>`_, `code <https://gist.github.com/3386951>`_)
67+
- pycon australia 2012 pytest talk from Brianna Laugher (`video <http://www.youtube.com/watch?v=DTNejE9EraI>`_, `slides <https://www.slideshare.net/pfctdayelise/funcargs-other-fun-with-pytest>`_, `code <https://gist.github.com/3386951>`_)
6868
- `pycon 2012 US talk video from Holger Krekel <http://www.youtube.com/watch?v=9LVqBQcFmyw>`_
6969

7070
- `monkey patching done right`_ (blog post, consult `monkeypatch plugin`_ for up-to-date API)

scripts/release.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,19 @@ def fix_formatting():
7979
call(["pre-commit", "run", "--all-files"])
8080

8181

82+
def check_links():
83+
"""Runs sphinx-build to check links"""
84+
print(f"{Fore.CYAN}[generate.check_links] {Fore.RESET}Checking links")
85+
check_call(["tox", "-e", "docs-checklinks"])
86+
87+
8288
def pre_release(version):
8389
"""Generates new docs, release announcements and creates a local tag."""
8490
announce(version)
8591
regen()
8692
changelog(version, write_out=True)
8793
fix_formatting()
94+
check_links()
8895

8996
msg = "Preparing release version {}".format(version)
9097
check_call(["git", "commit", "-a", "-m", msg])

tox.ini

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ envlist =
1515
doctesting
1616
py37-freeze
1717
docs
18+
docs-checklinks
1819

1920
[testenv]
2021
commands =
@@ -63,6 +64,14 @@ deps = -r{toxinidir}/doc/en/requirements.txt
6364
commands =
6465
sphinx-build -W -b html . _build
6566

67+
[testenv:docs-checklinks]
68+
basepython = python3
69+
usedevelop = True
70+
changedir = doc/en
71+
deps = -r{toxinidir}/doc/en/requirements.txt
72+
commands =
73+
sphinx-build -W -q --keep-going -b linkcheck . _build
74+
6675
[testenv:doctesting]
6776
basepython = python3
6877
skipsdist = True

0 commit comments

Comments
 (0)