From 268b0090171642f86a287ff8cc190945e5617b35 Mon Sep 17 00:00:00 2001 From: Jonathan Waltman Date: Sat, 5 Jan 2013 20:14:48 -0600 Subject: [PATCH] Move "only" directive tests to a seperate test root. --- tests/root/contents.txt | 1 - tests/roots/test-only-directive/conf.py | 2 ++ tests/roots/test-only-directive/contents.rst | 6 ++++++ tests/{root/only.txt => roots/test-only-directive/only.rst} | 0 tests/test_only_directive.py | 4 ++-- tests/util.py | 5 ++++- 6 files changed, 14 insertions(+), 4 deletions(-) create mode 100644 tests/roots/test-only-directive/conf.py create mode 100644 tests/roots/test-only-directive/contents.rst rename tests/{root/only.txt => roots/test-only-directive/only.rst} (100%) diff --git a/tests/root/contents.txt b/tests/root/contents.txt index 67384351b..0fbd68236 100644 --- a/tests/root/contents.txt +++ b/tests/root/contents.txt @@ -27,7 +27,6 @@ Contents: doctest extensions versioning/index - only footnote i18n/index diff --git a/tests/roots/test-only-directive/conf.py b/tests/roots/test-only-directive/conf.py new file mode 100644 index 000000000..bcb4305da --- /dev/null +++ b/tests/roots/test-only-directive/conf.py @@ -0,0 +1,2 @@ + +project = 'test-only-directive' diff --git a/tests/roots/test-only-directive/contents.rst b/tests/roots/test-only-directive/contents.rst new file mode 100644 index 000000000..9a93be9e7 --- /dev/null +++ b/tests/roots/test-only-directive/contents.rst @@ -0,0 +1,6 @@ +test-only-directive +=================== + +.. toctree:: + + only diff --git a/tests/root/only.txt b/tests/roots/test-only-directive/only.rst similarity index 100% rename from tests/root/only.txt rename to tests/roots/test-only-directive/only.rst diff --git a/tests/test_only_directive.py b/tests/test_only_directive.py index 2396046e4..af1462c03 100644 --- a/tests/test_only_directive.py +++ b/tests/test_only_directive.py @@ -17,10 +17,10 @@ from util import * def teardown_module(): - (test_root / '_build').rmtree(True) + (test_roots / 'test-only-directive' / '_build').rmtree(True) -@with_app(buildername='text') +@with_app(buildername='text', srcdir=(test_roots / 'test-only-directive')) def test_sectioning(app): def getsects(section): diff --git a/tests/util.py b/tests/util.py index 817f218f0..3e17d3626 100644 --- a/tests/util.py +++ b/tests/util.py @@ -30,7 +30,7 @@ from nose import tools, SkipTest __all__ = [ - 'test_root', 'raises', 'raises_msg', + 'test_root', 'test_roots', 'raises', 'raises_msg', 'skip_if', 'skip_unless', 'skip_unless_importable', 'Struct', 'ListOutput', 'TestApp', 'with_app', 'gen_with_app', 'path', 'with_tempdir', 'write_file', @@ -39,6 +39,7 @@ __all__ = [ test_root = path(__file__).parent.joinpath('root').abspath() +test_roots = path(__file__).parent.joinpath('roots').abspath() def _excstr(exc): @@ -153,6 +154,8 @@ class TestApp(application.Sphinx): self.cleanup_trees.insert(0, outdir) if doctreedir is None: doctreedir = srcdir.joinpath(srcdir, self.builddir, 'doctrees') + if not doctreedir.isdir(): + doctreedir.makedirs() if cleanenv: self.cleanup_trees.insert(0, doctreedir) if confoverrides is None: