14
0
Files
python-sphinx-removed-in/remove-sphinx-testing.patch

69 lines
2.2 KiB
Diff

Index: sphinx-removed-in-0.2.1/Makefile
===================================================================
--- sphinx-removed-in-0.2.1.orig/Makefile
+++ sphinx-removed-in-0.2.1/Makefile
@@ -1,6 +1,6 @@
test:
flake8 setup.py sphinx_removed_in tests
- python -m unittest discover -v
+ python -m pytest -v
build: test
./setup.py sdist
Index: sphinx-removed-in-0.2.1/tests/requirements.txt
===================================================================
--- sphinx-removed-in-0.2.1.orig/tests/requirements.txt
+++ sphinx-removed-in-0.2.1/tests/requirements.txt
@@ -1,4 +1,4 @@
Sphinx
flake8
coverage
-sphinx-testing
+pytest
Index: sphinx-removed-in-0.2.1/tests/test_extension.py
===================================================================
--- sphinx-removed-in-0.2.1.orig/tests/test_extension.py
+++ sphinx-removed-in-0.2.1/tests/test_extension.py
@@ -1,22 +1,21 @@
import os
import sys
-import unittest
-from sphinx_testing import with_app
+import pytest
-sys.path.insert(0,
- os.path.join(os.path.dirname(os.path.abspath(__file__)), '..'))
+PARENT = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')
+sys.path.insert(0, PARENT)
-class TestExtension(unittest.TestCase):
- @with_app(buildername='html', srcdir='./docs', copy_srcdir_to_tmpdir=True)
- def test_sphinx_build(self, app, status, warning):
- app.build()
+@pytest.mark.sphinx(buildername='html', srcdir=os.path.join(PARENT, 'docs'))
+def test_sphinx_build(app, status, warning):
+ app.build()
+ try:
html = (app.outdir / 'index.html').read_text()
+ except AttributeError:
+ # an older version of sphinx (used e.g. on Python 2)
+ # use the now deprecated API instead
+ html = (app.outdir / 'index.html').text()
- self.assertIn('Removed in version 1.2', html)
- self.assertIn('Removed in version 3.2', html)
-
-
-if __name__ == "__main__":
- unittest.main()
+ assert 'Removed in version 1.2' in html
+ assert 'Removed in version 3.2' in html
Index: sphinx-removed-in-0.2.1/tests/conftest.py
===================================================================
--- /dev/null
+++ sphinx-removed-in-0.2.1/tests/conftest.py
@@ -0,0 +1 @@
+pytest_plugins = 'sphinx.testing.fixtures'