Skip to content

Commit

Permalink
test: fix instability in test_ext_viewcode
Browse files Browse the repository at this point in the history
Use `freshenv` argument and remove `outdir` for one tests
as the previous one can leave an unexpected leftover.

Related: sphinx-doc#11285.
  • Loading branch information
marxin committed Apr 6, 2023
1 parent 9299003 commit 813bbe5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/test_ext_viewcode.py
Original file line number Diff line number Diff line change
@@ -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()

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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':
Expand Down

0 comments on commit 813bbe5

Please sign in to comment.