Skip to content

Commit

Permalink
tests: Remove 'tests/run.py'
Browse files Browse the repository at this point in the history
This is no longer necessary. One test needs to be modified to deal with
how 'python -m pytest' modifies the PATH.

Signed-off-by: Stephen Finucane <stephen@that.guru>
  • Loading branch information
stephenfin committed Dec 29, 2017
1 parent 529c96a commit 7c0723f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ test_script:
if (-not $test_ignore) { $test_ignore = '' }
$tests = $env:TEST
if (-not $tests) { $tests = '' }
& "C:\Python$($env:PYTHON)\python.exe" run.py $test_ignore.Split(' ') --junitxml .junit.xml $tests.Split(' ')
& "C:\Python$($env:PYTHON)\python.exe" -m pytest $test_ignore.Split(' ') --junitxml .junit.xml $tests.Split(' ')
Pop-Location
if ($LastExitCode -eq 1) { Write-Host "Test Failures Occurred, leaving for test result parsing" }
elseif ($LastExitCode -ne 0) { Write-Host "Other Error Occurred, aborting"; exit $LastExitCode }
Expand Down
19 changes: 11 additions & 8 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -317,14 +317,17 @@ There are a couple reasons that code in Sphinx might be deprecated:
no longer needs to support the older version of Python that doesn't include
the library, the library will be deprecated in Sphinx.

As the :ref:`deprecation-policy` describes,
the first release of Sphinx that deprecates a feature (``A.B``) should raise a
``RemovedInSphinxXXWarning`` (where XX is the Sphinx version where the feature
will be removed) when the deprecated feature is invoked. Assuming we have good
test coverage, these warnings are converted to errors when running the test
suite with warnings enabled: ``python -Wall tests/run.py``. Thus, when adding
a ``RemovedInSphinxXXWarning`` you need to eliminate or silence any warnings
generated when running the tests.
As the :ref:`deprecation-policy` describes, the first release of Sphinx that
deprecates a feature (``A.B``) should raise a ``RemovedInSphinxXXWarning``
(where ``XX`` is the Sphinx version where the feature will be removed) when the
deprecated feature is invoked. Assuming we have good test coverage, these
warnings are converted to errors when running the test suite with warnings
enabled::

pytest -Wall

Thus, when adding a ``RemovedInSphinxXXWarning`` you need to eliminate or
silence any warnings generated when running the tests.

.. _deprecation-policy:

Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ reindent:

.PHONY: test
test:
@cd tests; $(PYTHON) run.py -v $(TEST)
@$(PYTHON) -m pytest -v $(TEST)

.PHONY: test-async
test-async:
@echo "This target no longer does anything and will be removed imminently"

.PHONY: covertest
covertest:
@cd tests; $(PYTHON) run.py -v --cov=sphinx --junitxml=.junit.xml $(TEST)
@$(PYTHON) -m pytest -v --cov=sphinx --junitxml=.junit.xml $(TEST)

.PHONY: build
build:
Expand Down
16 changes: 0 additions & 16 deletions tests/run.py

This file was deleted.

3 changes: 2 additions & 1 deletion tests/test_pycode.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def test_ModuleAnalyzer_for_file():
def test_ModuleAnalyzer_for_module():
analyzer = ModuleAnalyzer.for_module('sphinx')
assert analyzer.modname == 'sphinx'
assert analyzer.srcname == SPHINX_MODULE_PATH
assert analyzer.srcname in (SPHINX_MODULE_PATH,
os.path.abspath(SPHINX_MODULE_PATH))
assert analyzer.encoding == 'utf-8'


Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ deps =
setenv =
SPHINX_TEST_TEMPDIR = {envdir}/testbuild
commands=
{envpython} -Wall tests/run.py --durations 25 {posargs}
pytest -Wall --durations 25 {posargs}

[testenv:flake8]
description =
Expand Down

0 comments on commit 7c0723f

Please sign in to comment.