|
7 | 7 | import pytest |
8 | 8 |
|
9 | 9 |
|
10 | | -def check_viewcode_output(app, status, warning): |
11 | | - app.builder.build_all() |
12 | | - |
| 10 | +def check_viewcode_output(app, warning): |
13 | 11 | warnings = re.sub(r'\\+', '/', warning.getvalue()) |
14 | 12 | assert re.findall( |
15 | 13 | r"index.rst:\d+: WARNING: Object named 'func1' not found in include " + |
@@ -48,15 +46,21 @@ def check_viewcode_output(app, status, warning): |
48 | 46 |
|
49 | 47 | @pytest.mark.sphinx(testroot='ext-viewcode', freshenv=True, |
50 | 48 | 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) |
53 | 54 | assert '<span class="linenos"> 1</span>' in result |
54 | 55 |
|
55 | 56 |
|
56 | 57 | @pytest.mark.sphinx(testroot='ext-viewcode', freshenv=True, |
57 | 58 | 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) |
60 | 64 | assert 'class="linenos">' not in result |
61 | 65 |
|
62 | 66 |
|
|
0 commit comments