Skip to content

Commit

Permalink
Remove _build directory for each test (#58)
Browse files Browse the repository at this point in the history
Remove _build directory for each test
  • Loading branch information
humitos committed Jun 17, 2019
2 parents 454bc5f + 2a0452a commit 5bf894f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/test_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import pytest
import sphinx
import shutil

srcdir = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
Expand All @@ -16,9 +17,15 @@
'404rst',
)

@pytest.fixture(autouse=True, scope='function')
def remove_sphinx_build_output():
"""Remove _build/ folder, if exist."""
for path in (srcdir, rstsrcdir):
build_path = os.path.join(path, '_build')
if os.path.exists(build_path):
shutil.rmtree(build_path)


# NOTE: ``SphinxTestApp`` unfortunately does not accept ``outdir`` to use a
# different one per test run
@pytest.mark.sphinx(srcdir=srcdir)
def test_404_page_created(app, status, warning):
app.build()
Expand Down

0 comments on commit 5bf894f

Please sign in to comment.