Skip to content

Commit 49819bb

Browse files
committed
clear directory
1 parent ccfbbd0 commit 49819bb

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

tests/test_ext_viewcode.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
import pytest
88

99

10-
def check_viewcode_output(app, status, warning):
11-
app.builder.build_all()
12-
10+
def check_viewcode_output(app, warning):
1311
warnings = re.sub(r'\\+', '/', warning.getvalue())
1412
assert re.findall(
1513
r"index.rst:\d+: WARNING: Object named 'func1' not found in include " +
@@ -48,15 +46,21 @@ def check_viewcode_output(app, status, warning):
4846

4947
@pytest.mark.sphinx(testroot='ext-viewcode', freshenv=True,
5048
confoverrides={"viewcode_line_numbers": True})
51-
def test_viewcode_linenos(app, status, warning):
52-
result = check_viewcode_output(app, status, warning)
49+
def test_viewcode_linenos(app, warning):
50+
shutil.rmtree(app.outdir / '_modules', ignore_errors=True)
51+
app.builder.build_all()
52+
53+
result = check_viewcode_output(app, warning)
5354
assert '<span class="linenos"> 1</span>' in result
5455

5556

5657
@pytest.mark.sphinx(testroot='ext-viewcode', freshenv=True,
5758
confoverrides={"viewcode_line_numbers": False})
58-
def test_viewcode(app, status, warning):
59-
result = check_viewcode_output(app, status, warning)
59+
def test_viewcode(app, warning):
60+
shutil.rmtree(app.outdir / '_modules', ignore_errors=True)
61+
app.builder.build_all()
62+
63+
result = check_viewcode_output(app, warning)
6064
assert 'class="linenos">' not in result
6165

6266

0 commit comments

Comments
 (0)