diff options
author | tk0miya <i.tkomiya@gmail.com> | 2014-09-15 22:10:13 +0900 |
---|---|---|
committer | tk0miya <i.tkomiya@gmail.com> | 2014-09-15 22:10:13 +0900 |
commit | f16f85b45bf2641a42b5a827eb1da1627f32520f (patch) | |
tree | 709d738a5f3dda87003b280dae66cab196c371f1 /tests | |
parent | 03b51255e177a5fb60b0f7ebf38f55dac8743b54 (diff) | |
download | sphinx-f16f85b45bf2641a42b5a827eb1da1627f32520f.tar.gz |
Fix #1512 env.record_dependency crashes on multibyte directories
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_env.py | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/test_env.py b/tests/test_env.py index eaaa212f..c5a091cd 100644 --- a/tests/test_env.py +++ b/tests/test_env.py @@ -8,9 +8,11 @@ :copyright: Copyright 2007-2014 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ +import os import sys +import tempfile -from util import TestApp, remove_unicode_literals, path +from util import TestApp, test_root, remove_unicode_literals, path from sphinx.builders.html import StandaloneHTMLBuilder from sphinx.builders.latex import LaTeXBuilder @@ -95,6 +97,29 @@ def test_second_update(): assert 'autodoc' not in env.all_docs assert 'autodoc' not in env.found_docs + +def test_record_dependency_on_multibyte_directory(): + app = None + olddir = os.getcwd() + try: + tmproot = path(os.path.abspath(tempfile.mkdtemp())) + tmpdir = tmproot / u'ใในใ' + test_root.copytree(tmpdir) + os.chdir(tmpdir) + tmpdir = path(os.getcwd()) # for MacOSX; tmpdir is based on symlinks + + app = TestApp(srcdir=tmpdir, freshenv=True) + (app.srcdir / 'test.txt').write_text('.. include:: test.inc') + (app.srcdir / 'test.inc').write_text('hello sphinx') + _, _, it = app.env.update(app.config, app.srcdir, app.doctreedir, app) + list(it) # take all from iterator + finally: + tmproot.rmtree(ignore_errors=True) + os.chdir(olddir) + if app: + app.cleanup() + + def test_object_inventory(): refs = env.domaindata['py']['objects'] |