summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMartin Liška <mliska@suse.cz>2023-04-06 23:40:33 +0200
committerGitHub <noreply@github.com>2023-04-06 22:40:33 +0100
commitc1c2d758c9b54b5ecdc6eb14043f19fcf1caf6df (patch)
treeac63d5b910f77118dd7eb5100853783f8c45ccde /tests
parentf25a36d0563b1beda3d2bad76e1b10dac4471512 (diff)
downloadsphinx-git-c1c2d758c9b54b5ecdc6eb14043f19fcf1caf6df.tar.gz
Fix instability in ``test_ext_viewcode`` (#11297)
Use ``freshenv`` argument and remove ``outdir`` for one test as the previous one can leave an unexpected leftover.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_ext_viewcode.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/test_ext_viewcode.py b/tests/test_ext_viewcode.py
index 6f2c9ce80..444f2f348 100644
--- a/tests/test_ext_viewcode.py
+++ b/tests/test_ext_viewcode.py
@@ -1,12 +1,13 @@
"""Test sphinx.ext.viewcode extension."""
import re
+import shutil
import pygments
import pytest
-@pytest.mark.sphinx(testroot='ext-viewcode')
+@pytest.mark.sphinx(testroot='ext-viewcode', freshenv=True)
def test_viewcode(app, status, warning):
app.builder.build_all()
@@ -52,6 +53,7 @@ def test_viewcode(app, status, warning):
@pytest.mark.sphinx('epub', testroot='ext-viewcode')
def test_viewcode_epub_default(app, status, warning):
+ shutil.rmtree(app.outdir)
app.builder.build_all()
assert not (app.outdir / '_modules/spam/mod1.xhtml').exists()
@@ -83,7 +85,7 @@ def test_linkcode(app, status, warning):
assert 'http://foobar/cpp/' in stuff
-@pytest.mark.sphinx(testroot='ext-viewcode-find')
+@pytest.mark.sphinx(testroot='ext-viewcode-find', freshenv=True)
def test_local_source_files(app, status, warning):
def find_source(app, modname):
if modname == 'not_a_package':