summaryrefslogtreecommitdiff
path: root/tests/test_build.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_build.py')
-rw-r--r--tests/test_build.py40
1 files changed, 17 insertions, 23 deletions
diff --git a/tests/test_build.py b/tests/test_build.py
index fd123e294..c5ce79da3 100644
--- a/tests/test_build.py
+++ b/tests/test_build.py
@@ -22,29 +22,23 @@ def nonascii_srcdir(request, rootdir, sphinx_test_tempdir):
# If supported, build in a non-ASCII source dir
test_name = '\u65e5\u672c\u8a9e'
basedir = sphinx_test_tempdir / request.node.originalname
- try:
- srcdir = basedir / test_name
- if not srcdir.exists():
- (rootdir / 'test-root').copytree(srcdir)
- except UnicodeEncodeError:
- # Now Python 3.7+ follows PEP-540 and uses utf-8 encoding for filesystem by default.
- # So this error handling will be no longer used (after dropping python 3.6 support).
- srcdir = basedir / 'all'
- if not srcdir.exists():
- (rootdir / 'test-root').copytree(srcdir)
- else:
- # add a doc with a non-ASCII file name to the source dir
- (srcdir / (test_name + '.txt')).write_text(dedent("""
- nonascii file name page
- =======================
- """), encoding='utf8')
-
- root_doc = srcdir / 'index.txt'
- root_doc.write_text(root_doc.read_text(encoding='utf8') + dedent("""
- .. toctree::
-
- %(test_name)s/%(test_name)s
- """ % {'test_name': test_name}), encoding='utf8')
+ srcdir = basedir / test_name
+ if not srcdir.exists():
+ (rootdir / 'test-root').copytree(srcdir)
+
+ # add a doc with a non-ASCII file name to the source dir
+ (srcdir / (test_name + '.txt')).write_text(dedent("""
+ nonascii file name page
+ =======================
+ """), encoding='utf8')
+
+ root_doc = srcdir / 'index.txt'
+ root_doc.write_text(root_doc.read_text(encoding='utf8') + dedent("""
+ .. toctree::
+
+ %(test_name)s/%(test_name)s
+ """ % {'test_name': test_name}), encoding='utf8')
+
return srcdir