mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #6029 from tk0miya/clear_SPHINX_TEST_TEMPDIR_before_testing
test: clear SPHINX_TEST_TEMPDIR before testing
This commit is contained in:
commit
e24220d504
@ -7,6 +7,7 @@
|
||||
"""
|
||||
|
||||
import os
|
||||
import shutil
|
||||
|
||||
import docutils
|
||||
import pytest
|
||||
@ -37,3 +38,18 @@ def pytest_report_header(config):
|
||||
|
||||
def pytest_assertrepr_compare(op, left, right):
|
||||
comparer.pytest_assertrepr_compare(op, left, right)
|
||||
|
||||
|
||||
def _initialize_test_directory(session):
|
||||
if 'SPHINX_TEST_TEMPDIR' in os.environ:
|
||||
tempdir = os.path.abspath(os.getenv('SPHINX_TEST_TEMPDIR'))
|
||||
print('Temporary files will be placed in %s.' % tempdir)
|
||||
|
||||
if os.path.exists(tempdir):
|
||||
shutil.rmtree(tempdir)
|
||||
|
||||
os.makedirs(tempdir)
|
||||
|
||||
|
||||
def pytest_sessionstart(session):
|
||||
_initialize_test_directory(session)
|
||||
|
Loading…
Reference in New Issue
Block a user