Jon Waltman avatar Jon Waltman committed 200f0e3

Move "only" directive tests to a seperate test root.

Comments (0)

Files changed (7)

tests/root/contents.txt

    doctest
    extensions
    versioning/index
-   only
    footnote
    i18n/index
 

tests/root/only.txt

-
-1. Sections in only directives
-==============================
-
-Testing sections in only directives.
-
-.. only:: nonexisting_tag
-
-   Skipped Section
-   ---------------
-   Should not be here.
-
-.. only:: not nonexisting_tag
-
-   1.1. Section
-   ------------
-   Should be here.
-
-1.2. Section
-------------
-
-.. only:: not nonexisting_tag
-
-   1.2.1. Subsection
-   ~~~~~~~~~~~~~~~~~
-   Should be here.
-
-.. only:: nonexisting_tag
-
-   Skipped Subsection
-   ~~~~~~~~~~~~~~~~~~
-   Should not be here.
-
-1.3. Section
-------------
-
-1.3.1. Subsection
-~~~~~~~~~~~~~~~~~
-Should be here.
-
-1.4. Section
-------------
-
-.. only:: not nonexisting_tag
-
-   1.4.1. Subsection
-   ~~~~~~~~~~~~~~~~~
-   Should be here.
-
-1.5. Section
-------------
-
-.. only:: not nonexisting_tag
-
-   1.5.1. Subsection
-   ~~~~~~~~~~~~~~~~~
-   Should be here.
-
-1.5.2. Subsection
-~~~~~~~~~~~~~~~~~
-Should be here.
-
-1.6. Section
-------------
-
-1.6.1. Subsection
-~~~~~~~~~~~~~~~~~
-Should be here.
-
-.. only:: not nonexisting_tag
-
-   1.6.2. Subsection
-   ~~~~~~~~~~~~~~~~~
-   Should be here.
-
-1.6.3. Subsection
-~~~~~~~~~~~~~~~~~
-Should be here.
-
-1.7. Section
-------------
-
-1.7.1. Subsection
-~~~~~~~~~~~~~~~~~
-Should be here.
-
-.. only:: not nonexisting_tag
-
-   1.7.1.1. Subsubsection
-   ......................
-   Should be here.
-
-1.8. Section
-------------
-
-1.8.1. Subsection
-~~~~~~~~~~~~~~~~~
-Should be here.
-
-1.8.1.1. Subsubsection
-......................
-Should be here.
-
-.. only:: not nonexisting_tag
-
-   1.8.1.2. Subsubsection
-   ......................
-   Should be here.
-
-1.9. Section
-------------
-
-.. only:: nonexisting_tag
-
-   Skipped Subsection
-   ~~~~~~~~~~~~~~~~~~
-
-1.9.1. Subsection
-~~~~~~~~~~~~~~~~~
-Should be here.
-
-1.9.1.1. Subsubsection
-......................
-Should be here.
-
-.. only:: not nonexisting_tag
-
-   1.10. Section
-   -------------
-   Should be here.
-
-1.11. Section
--------------
-
-Text before subsection 11.1.
-
-.. only:: not nonexisting_tag
-
-   More text before subsection 11.1.
-
-   1.11.1. Subsection
-   ~~~~~~~~~~~~~~~~~~
-   Should be here.
-
-Text after subsection 11.1.
-
-.. only:: not nonexisting_tag
-
-   1.12. Section
-   -------------
-   Should be here.
-
-   1.12.1. Subsection
-   ~~~~~~~~~~~~~~~~~~
-   Should be here.
-
-   1.13. Section
-   -------------
-   Should be here.
-
-.. only:: not nonexisting_tag
-
-   1.14. Section
-   -------------
-   Should be here.
-
-   .. only:: not nonexisting_tag
-
-      1.14.1. Subsection
-      ~~~~~~~~~~~~~~~~~~
-      Should be here.
-
-   1.15. Section
-   -------------
-   Should be here.
-
-.. only:: nonexisting_tag
-
-   Skipped document level heading
-   ==============================
-   Should not be here.
-
-.. only:: not nonexisting_tag
-
-   2. Included document level heading
-   ==================================
-   Should be here.
-
-3. Document level heading
-=========================
-Should be here.
-
-.. only:: nonexisting_tag
-
-   Skipped document level heading
-   ==============================
-   Should not be here.
-
-.. only:: not nonexisting_tag
-
-   4. Another included document level heading
-   ==========================================
-   Should be here.

tests/roots/test-only-directive/conf.py

+
+project = 'test-only-directive'

tests/roots/test-only-directive/contents.rst

+test-only-directive
+===================
+
+.. toctree::
+
+   only

tests/roots/test-only-directive/only.rst

+
+1. Sections in only directives
+==============================
+
+Testing sections in only directives.
+
+.. only:: nonexisting_tag
+
+   Skipped Section
+   ---------------
+   Should not be here.
+
+.. only:: not nonexisting_tag
+
+   1.1. Section
+   ------------
+   Should be here.
+
+1.2. Section
+------------
+
+.. only:: not nonexisting_tag
+
+   1.2.1. Subsection
+   ~~~~~~~~~~~~~~~~~
+   Should be here.
+
+.. only:: nonexisting_tag
+
+   Skipped Subsection
+   ~~~~~~~~~~~~~~~~~~
+   Should not be here.
+
+1.3. Section
+------------
+
+1.3.1. Subsection
+~~~~~~~~~~~~~~~~~
+Should be here.
+
+1.4. Section
+------------
+
+.. only:: not nonexisting_tag
+
+   1.4.1. Subsection
+   ~~~~~~~~~~~~~~~~~
+   Should be here.
+
+1.5. Section
+------------
+
+.. only:: not nonexisting_tag
+
+   1.5.1. Subsection
+   ~~~~~~~~~~~~~~~~~
+   Should be here.
+
+1.5.2. Subsection
+~~~~~~~~~~~~~~~~~
+Should be here.
+
+1.6. Section
+------------
+
+1.6.1. Subsection
+~~~~~~~~~~~~~~~~~
+Should be here.
+
+.. only:: not nonexisting_tag
+
+   1.6.2. Subsection
+   ~~~~~~~~~~~~~~~~~
+   Should be here.
+
+1.6.3. Subsection
+~~~~~~~~~~~~~~~~~
+Should be here.
+
+1.7. Section
+------------
+
+1.7.1. Subsection
+~~~~~~~~~~~~~~~~~
+Should be here.
+
+.. only:: not nonexisting_tag
+
+   1.7.1.1. Subsubsection
+   ......................
+   Should be here.
+
+1.8. Section
+------------
+
+1.8.1. Subsection
+~~~~~~~~~~~~~~~~~
+Should be here.
+
+1.8.1.1. Subsubsection
+......................
+Should be here.
+
+.. only:: not nonexisting_tag
+
+   1.8.1.2. Subsubsection
+   ......................
+   Should be here.
+
+1.9. Section
+------------
+
+.. only:: nonexisting_tag
+
+   Skipped Subsection
+   ~~~~~~~~~~~~~~~~~~
+
+1.9.1. Subsection
+~~~~~~~~~~~~~~~~~
+Should be here.
+
+1.9.1.1. Subsubsection
+......................
+Should be here.
+
+.. only:: not nonexisting_tag
+
+   1.10. Section
+   -------------
+   Should be here.
+
+1.11. Section
+-------------
+
+Text before subsection 11.1.
+
+.. only:: not nonexisting_tag
+
+   More text before subsection 11.1.
+
+   1.11.1. Subsection
+   ~~~~~~~~~~~~~~~~~~
+   Should be here.
+
+Text after subsection 11.1.
+
+.. only:: not nonexisting_tag
+
+   1.12. Section
+   -------------
+   Should be here.
+
+   1.12.1. Subsection
+   ~~~~~~~~~~~~~~~~~~
+   Should be here.
+
+   1.13. Section
+   -------------
+   Should be here.
+
+.. only:: not nonexisting_tag
+
+   1.14. Section
+   -------------
+   Should be here.
+
+   .. only:: not nonexisting_tag
+
+      1.14.1. Subsection
+      ~~~~~~~~~~~~~~~~~~
+      Should be here.
+
+   1.15. Section
+   -------------
+   Should be here.
+
+.. only:: nonexisting_tag
+
+   Skipped document level heading
+   ==============================
+   Should not be here.
+
+.. only:: not nonexisting_tag
+
+   2. Included document level heading
+   ==================================
+   Should be here.
+
+3. Document level heading
+=========================
+Should be here.
+
+.. only:: nonexisting_tag
+
+   Skipped document level heading
+   ==============================
+   Should not be here.
+
+.. only:: not nonexisting_tag
+
+   4. Another included document level heading
+   ==========================================
+   Should be here.

tests/test_only_directive.py

 
 
 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):
 
 
 __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',
 
 
 test_root = path(__file__).parent.joinpath('root').abspath()
+test_roots = path(__file__).parent.joinpath('roots').abspath()
 
 
 def _excstr(exc):
             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:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.