diff options
author | Martin Liška <mliska@suse.cz> | 2023-04-06 23:40:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-06 22:40:33 +0100 |
commit | c1c2d758c9b54b5ecdc6eb14043f19fcf1caf6df (patch) | |
tree | ac63d5b910f77118dd7eb5100853783f8c45ccde /tests | |
parent | f25a36d0563b1beda3d2bad76e1b10dac4471512 (diff) | |
download | sphinx-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.py | 6 |
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': |