changeset 397:879b6b5647a8

tests: Move all bakes/cli/servings tests files to have a YAML extension.
author Ludovic Chabant <ludovic@chabant.com>
date Mon, 18 May 2015 15:48:45 -0700
parents dc0988d937b3
children af17c143b9ab
files tests/bakes/test_data_provider.bake tests/bakes/test_data_provider.yaml tests/bakes/test_empty.bake tests/bakes/test_empty.yaml tests/bakes/test_pagination.bake tests/bakes/test_pagination.yaml tests/bakes/test_relative_pagination.bake tests/bakes/test_relative_pagination.yaml tests/bakes/test_simple.bake tests/bakes/test_simple.yaml tests/bakes/test_simple_categories.bake tests/bakes/test_simple_categories.yaml tests/bakes/test_simple_tags.bake tests/bakes/test_simple_tags.yaml tests/cli/test_find.chef tests/cli/test_find.yaml tests/conftest.py tests/servings/test_debug_info.serve tests/servings/test_debug_info.yaml
diffstat 19 files changed, 352 insertions(+), 351 deletions(-) [+]
line wrap: on
line diff
--- a/tests/bakes/test_data_provider.bake	Mon May 18 15:35:52 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
----
-in:
-    pages/foo.md: |
-        Foo!
-    pages/bar.md: |
-        Bar!
-    pages/allpages.md: |
-        {% for p in site.pages -%}
-        {{p.url}}
-        {% endfor %}
-outfiles:
-    allpages.html: |
-        /
-        /allpages.html
-        /bar.html
-        /foo.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/bakes/test_data_provider.yaml	Mon May 18 15:48:45 2015 -0700
@@ -0,0 +1,16 @@
+---
+in:
+    pages/foo.md: |
+        Foo!
+    pages/bar.md: |
+        Bar!
+    pages/allpages.md: |
+        {% for p in site.pages -%}
+        {{p.url}}
+        {% endfor %}
+outfiles:
+    allpages.html: |
+        /
+        /allpages.html
+        /bar.html
+        /foo.html
--- a/tests/bakes/test_empty.bake	Mon May 18 15:35:52 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,6 +0,0 @@
----
-in:
-    pages/_index.md: ''
-out:
-    index.html: ''
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/bakes/test_empty.yaml	Mon May 18 15:48:45 2015 -0700
@@ -0,0 +1,6 @@
+---
+in:
+    pages/_index.md: ''
+out:
+    index.html: ''
+
--- a/tests/bakes/test_pagination.bake	Mon May 18 15:35:52 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
----
-config:
-    site:
-        posts_per_page: 3
-        pagination_suffix: /page%num%
-in:
-    posts/2015-03-01_post01.md: "---\ntitle: Post 01\n---\n"
-    posts/2015-03-02_post02.md: "---\ntitle: Post 02\n---\n"
-    posts/2015-03-03_post03.md: "---\ntitle: Post 03\n---\n"
-    posts/2015-03-04_post04.md: "---\ntitle: Post 04\n---\n"
-    posts/2015-03-05_post05.md: "---\ntitle: Post 05\n---\n"
-    posts/2015-03-06_post06.md: "---\ntitle: Post 06\n---\n"
-    posts/2015-03-07_post07.md: "---\ntitle: Post 07\n---\n"
-    pages/_index.md: ''
-    pages/foo.md: |
-        {%- for p in pagination.items -%}
-        {{p.url}} {{p.title}}
-        {% endfor -%}
-        {{pagination.prev_page}}
-        {{pagination.this_page}}
-        {{pagination.next_page}}
-outfiles:
-    foo.html: |
-        /2015/03/07/post07.html Post 07
-        /2015/03/06/post06.html Post 06
-        /2015/03/05/post05.html Post 05
-        None
-        /foo.html
-        /foo/page2.html
-    foo/page2.html: |
-        /2015/03/04/post04.html Post 04
-        /2015/03/03/post03.html Post 03
-        /2015/03/02/post02.html Post 02
-        /foo.html
-        /foo/page2.html
-        /foo/page3.html
-    foo/page3.html: |
-        /2015/03/01/post01.html Post 01
-        /foo/page2.html
-        /foo/page3.html
-        None
----
-config:
-    site:
-        posts_per_page: 3
-in:
-    posts/2015-03-01_post01.md: |
-        ---
-        title: Post 01
-        tags: [foo]
-        ---
-    posts/2015-03-02_post02.md: |
-        ---
-        title: Post 02
-        tags: [foo]
-        ---
-    posts/2015-03-03_post03.md: |
-        ---
-        title: Post 03
-        tags: [foo]
-        ---
-    posts/2015-03-04_post04.md: |
-        ---
-        title: Post 04
-        tags: [foo]
-        ---
-    posts/2015-03-05_post05.md: |
-        ---
-        title: Post 05
-        tags: [foo]
-        ---
-    pages/_index.md: ''
-    pages/_tag.md: |
-        Posts with {{tag}}
-        {% for p in pagination.items -%}
-        {{p.url}} {{p.title}}
-        {% endfor -%}
-        {{pagination.prev_page}}
-        {{pagination.this_page}}
-        {{pagination.next_page}}
-outfiles:
-    tag/foo.html: |
-        Posts with foo
-        /2015/03/05/post05.html Post 05
-        /2015/03/04/post04.html Post 04
-        /2015/03/03/post03.html Post 03
-        None
-        /tag/foo.html
-        /tag/foo/2.html
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/bakes/test_pagination.yaml	Mon May 18 15:48:45 2015 -0700
@@ -0,0 +1,90 @@
+---
+config:
+    site:
+        posts_per_page: 3
+        pagination_suffix: /page%num%
+in:
+    posts/2015-03-01_post01.md: "---\ntitle: Post 01\n---\n"
+    posts/2015-03-02_post02.md: "---\ntitle: Post 02\n---\n"
+    posts/2015-03-03_post03.md: "---\ntitle: Post 03\n---\n"
+    posts/2015-03-04_post04.md: "---\ntitle: Post 04\n---\n"
+    posts/2015-03-05_post05.md: "---\ntitle: Post 05\n---\n"
+    posts/2015-03-06_post06.md: "---\ntitle: Post 06\n---\n"
+    posts/2015-03-07_post07.md: "---\ntitle: Post 07\n---\n"
+    pages/_index.md: ''
+    pages/foo.md: |
+        {%- for p in pagination.items -%}
+        {{p.url}} {{p.title}}
+        {% endfor -%}
+        {{pagination.prev_page}}
+        {{pagination.this_page}}
+        {{pagination.next_page}}
+outfiles:
+    foo.html: |
+        /2015/03/07/post07.html Post 07
+        /2015/03/06/post06.html Post 06
+        /2015/03/05/post05.html Post 05
+        None
+        /foo.html
+        /foo/page2.html
+    foo/page2.html: |
+        /2015/03/04/post04.html Post 04
+        /2015/03/03/post03.html Post 03
+        /2015/03/02/post02.html Post 02
+        /foo.html
+        /foo/page2.html
+        /foo/page3.html
+    foo/page3.html: |
+        /2015/03/01/post01.html Post 01
+        /foo/page2.html
+        /foo/page3.html
+        None
+---
+config:
+    site:
+        posts_per_page: 3
+in:
+    posts/2015-03-01_post01.md: |
+        ---
+        title: Post 01
+        tags: [foo]
+        ---
+    posts/2015-03-02_post02.md: |
+        ---
+        title: Post 02
+        tags: [foo]
+        ---
+    posts/2015-03-03_post03.md: |
+        ---
+        title: Post 03
+        tags: [foo]
+        ---
+    posts/2015-03-04_post04.md: |
+        ---
+        title: Post 04
+        tags: [foo]
+        ---
+    posts/2015-03-05_post05.md: |
+        ---
+        title: Post 05
+        tags: [foo]
+        ---
+    pages/_index.md: ''
+    pages/_tag.md: |
+        Posts with {{tag}}
+        {% for p in pagination.items -%}
+        {{p.url}} {{p.title}}
+        {% endfor -%}
+        {{pagination.prev_page}}
+        {{pagination.this_page}}
+        {{pagination.next_page}}
+outfiles:
+    tag/foo.html: |
+        Posts with foo
+        /2015/03/05/post05.html Post 05
+        /2015/03/04/post04.html Post 04
+        /2015/03/03/post03.html Post 03
+        None
+        /tag/foo.html
+        /tag/foo/2.html
+
--- a/tests/bakes/test_relative_pagination.bake	Mon May 18 15:35:52 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
----
-config:
-    site:
-        default_post_layout: post
-in:
-    posts/2015-03-01_post01.md: "---\ntitle: Post 01\n---\nContent 01"
-    posts/2015-03-02_post02.md: "---\ntitle: Post 02\n---\nContent 02"
-    posts/2015-03-03_post03.md: "---\ntitle: Post 03\n---\nContent 03"
-    templates/post.html: |
-        BLAH {{content|safe}}
-        {{pagination.prev_item.url}} {{pagination.prev_item.title}}
-        {{pagination.next_item.url}} {{pagination.next_item.title}}
-outfiles:
-    2015/03/02/post02.html: |
-        BLAH Content 02
-        /2015/03/01/post01.html Post 01
-        /2015/03/03/post03.html Post 03
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/bakes/test_relative_pagination.yaml	Mon May 18 15:48:45 2015 -0700
@@ -0,0 +1,18 @@
+---
+config:
+    site:
+        default_post_layout: post
+in:
+    posts/2015-03-01_post01.md: "---\ntitle: Post 01\n---\nContent 01"
+    posts/2015-03-02_post02.md: "---\ntitle: Post 02\n---\nContent 02"
+    posts/2015-03-03_post03.md: "---\ntitle: Post 03\n---\nContent 03"
+    templates/post.html: |
+        BLAH {{content|safe}}
+        {{pagination.prev_item.url}} {{pagination.prev_item.title}}
+        {{pagination.next_item.url}} {{pagination.next_item.title}}
+outfiles:
+    2015/03/02/post02.html: |
+        BLAH Content 02
+        /2015/03/01/post01.html Post 01
+        /2015/03/03/post03.html Post 03
+
--- a/tests/bakes/test_simple.bake	Mon May 18 15:35:52 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
----
-in:
-    posts/2010-01-01_post1.md: 'post one'
-    pages/about.md: 'URL: {{page.url}}'
-    pages/_index.md: 'something'
-out:
-    '2010':
-        '01':
-            '01':
-                post1.html: 'post one'
-    about.html: 'URL: /about.html'
-    index.html: 'something'
----
-config:
-    site:
-        root: /whatever
-in:
-    posts/2010-01-01_post1.md: 'post one'
-    pages/about.md: 'URL: {{page.url}}'
-    pages/_index.md: 'something'
-out:
-    '2010':
-        '01':
-            '01':
-                post1.html: 'post one'
-    about.html: 'URL: /whatever/about.html'
-    index.html: 'something'
----
-in:
-    pages/foo.md: |
-        This page is {{page.url}}
-outfiles:
-    foo.html: |
-        This page is /foo.html
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/bakes/test_simple.yaml	Mon May 18 15:48:45 2015 -0700
@@ -0,0 +1,35 @@
+---
+in:
+    posts/2010-01-01_post1.md: 'post one'
+    pages/about.md: 'URL: {{page.url}}'
+    pages/_index.md: 'something'
+out:
+    '2010':
+        '01':
+            '01':
+                post1.html: 'post one'
+    about.html: 'URL: /about.html'
+    index.html: 'something'
+---
+config:
+    site:
+        root: /whatever
+in:
+    posts/2010-01-01_post1.md: 'post one'
+    pages/about.md: 'URL: {{page.url}}'
+    pages/_index.md: 'something'
+out:
+    '2010':
+        '01':
+            '01':
+                post1.html: 'post one'
+    about.html: 'URL: /whatever/about.html'
+    index.html: 'something'
+---
+in:
+    pages/foo.md: |
+        This page is {{page.url}}
+outfiles:
+    foo.html: |
+        This page is /foo.html
+
--- a/tests/bakes/test_simple_categories.bake	Mon May 18 15:35:52 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,45 +0,0 @@
----
-config:
-    site:
-        category_url: cat/%category%
-in:
-    posts/2015-03-01_post01.md: |
-      ---
-      title: Post 01
-      category: foo
-      ---
-    posts/2015-03-02_post02.md: |
-      ---
-      title: Post 02
-      category: bar
-      ---
-    posts/2015-03-03_post03.md: |
-      ---
-      title: Post 03
-      category: foo
-      ---
-    pages/_category.md: |
-      Pages in {{category}}
-      {% for p in pagination.posts -%}
-      {{p.title}}
-      {% endfor %}
-    pages/_index.md: ''
-out:
-    index.html: ''
-    '2015':
-        '03':
-            '01':
-                post01.html: ''
-            '02':
-                post02.html: ''
-            '03':
-                post03.html: ''
-    cat:
-        foo.html: |
-          Pages in foo
-          Post 03
-          Post 01
-        bar.html: |
-          Pages in bar
-          Post 02
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/bakes/test_simple_categories.yaml	Mon May 18 15:48:45 2015 -0700
@@ -0,0 +1,45 @@
+---
+config:
+    site:
+        category_url: cat/%category%
+in:
+    posts/2015-03-01_post01.md: |
+      ---
+      title: Post 01
+      category: foo
+      ---
+    posts/2015-03-02_post02.md: |
+      ---
+      title: Post 02
+      category: bar
+      ---
+    posts/2015-03-03_post03.md: |
+      ---
+      title: Post 03
+      category: foo
+      ---
+    pages/_category.md: |
+      Pages in {{category}}
+      {% for p in pagination.posts -%}
+      {{p.title}}
+      {% endfor %}
+    pages/_index.md: ''
+out:
+    index.html: ''
+    '2015':
+        '03':
+            '01':
+                post01.html: ''
+            '02':
+                post02.html: ''
+            '03':
+                post03.html: ''
+    cat:
+        foo.html: |
+          Pages in foo
+          Post 03
+          Post 01
+        bar.html: |
+          Pages in bar
+          Post 02
+
--- a/tests/bakes/test_simple_tags.bake	Mon May 18 15:35:52 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
----
-in:
-    posts/2015-03-01_post01.md: "---\ntitle: Post 01\n---\nContent 01"
-    pages/_index.md: |
-        {%for p in pagination.items -%}
-        {{p.content|safe}}
-        {%if p.tags%}{{p.tags}}{%else%}No tags{%endif%}
-        {%endfor%}
-outfiles:
-    index.html: |
-        Content 01
-        No tags
----
-in:
-    posts/2015-03-01_post01.md: |
-      ---
-      title: Post 01
-      tags: [foo]
-      ---
-    posts/2015-03-02_post02.md: |
-      ---
-      title: Post 02
-      tags: [bar, whatever]
-      ---
-    posts/2015-03-03_post03.md: |
-      ---
-      title: Post 03
-      tags: [foo, bar]
-      ---
-    pages/_tag.md: |
-      Pages in {{tag}}
-      {% for p in pagination.posts -%}
-      {{p.title}}
-      {% endfor %}
-    pages/_index.md: ''
-out:
-    index.html: ''
-    '2015':
-        '03':
-            '01':
-                post01.html: ''
-            '02':
-                post02.html: ''
-            '03':
-                post03.html: ''
-    tag:
-        foo.html: |
-          Pages in foo
-          Post 03
-          Post 01
-        bar.html: |
-          Pages in bar
-          Post 03
-          Post 02
-        whatever.html: |
-          Pages in whatever
-          Post 02
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/bakes/test_simple_tags.yaml	Mon May 18 15:48:45 2015 -0700
@@ -0,0 +1,58 @@
+---
+in:
+    posts/2015-03-01_post01.md: "---\ntitle: Post 01\n---\nContent 01"
+    pages/_index.md: |
+        {%for p in pagination.items -%}
+        {{p.content|safe}}
+        {%if p.tags%}{{p.tags}}{%else%}No tags{%endif%}
+        {%endfor%}
+outfiles:
+    index.html: |
+        Content 01
+        No tags
+---
+in:
+    posts/2015-03-01_post01.md: |
+      ---
+      title: Post 01
+      tags: [foo]
+      ---
+    posts/2015-03-02_post02.md: |
+      ---
+      title: Post 02
+      tags: [bar, whatever]
+      ---
+    posts/2015-03-03_post03.md: |
+      ---
+      title: Post 03
+      tags: [foo, bar]
+      ---
+    pages/_tag.md: |
+      Pages in {{tag}}
+      {% for p in pagination.posts -%}
+      {{p.title}}
+      {% endfor %}
+    pages/_index.md: ''
+out:
+    index.html: ''
+    '2015':
+        '03':
+            '01':
+                post01.html: ''
+            '02':
+                post02.html: ''
+            '03':
+                post03.html: ''
+    tag:
+        foo.html: |
+          Pages in foo
+          Post 03
+          Post 01
+        bar.html: |
+          Pages in bar
+          Post 03
+          Post 02
+        whatever.html: |
+          Pages in whatever
+          Post 02
+
--- a/tests/cli/test_find.chef	Mon May 18 15:35:52 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
----
-args: find
-out: ''
----
-args: find
-in:
-    pages/foo.md: ''
-out: |
-    pages/foo.md
----
-args: find
-in:
-    pages/foo.md: ''
-    posts/2015-01-10_blah.md: ''
-out: |
-    pages/foo.md
-    posts/2015-01-10_blah.md
----
-args: find foo
-in:
-    pages/foo.md: ''
-    pages/bar.md: ''
-    pages/foo/child.md: ''
-    pages/something.md: ''
-out: |
-    pages/foo.md
-    pages/foo/child.md
----
-args: find --exact *foo.md
-in:
-    pages/foo.md: ''
-    pages/bar.md: ''
-    pages/foo/child.md: ''
-    pages/something.md: ''
-out: |
-    pages/foo.md
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/cli/test_find.yaml	Mon May 18 15:48:45 2015 -0700
@@ -0,0 +1,36 @@
+---
+args: find
+out: ''
+---
+args: find
+in:
+    pages/foo.md: ''
+out: |
+    pages/foo.md
+---
+args: find
+in:
+    pages/foo.md: ''
+    posts/2015-01-10_blah.md: ''
+out: |
+    pages/foo.md
+    posts/2015-01-10_blah.md
+---
+args: find foo
+in:
+    pages/foo.md: ''
+    pages/bar.md: ''
+    pages/foo/child.md: ''
+    pages/something.md: ''
+out: |
+    pages/foo.md
+    pages/foo/child.md
+---
+args: find --exact *foo.md
+in:
+    pages/foo.md: ''
+    pages/bar.md: ''
+    pages/foo/child.md: ''
+    pages/something.md: ''
+out: |
+    pages/foo.md
--- a/tests/conftest.py	Mon May 18 15:35:52 2015 -0700
+++ b/tests/conftest.py	Mon May 18 15:48:45 2015 -0700
@@ -29,12 +29,13 @@
 
 
 def pytest_collect_file(parent, path):
-    if path.basename.startswith("test"):
-        if path.ext == ".bake":
+    if path.ext == '.yaml' and path.basename.startswith("test"):
+        category = os.path.basename(path.dirname)
+        if category == 'bakes':
             return BakeTestFile(path, parent)
-        elif path.ext == ".chef":
+        elif category == 'cli':
             return ChefTestFile(path, parent)
-        elif path.ext == ".serve":
+        elif category == 'servings':
             return ServeTestFile(path, parent)
 
 
--- a/tests/servings/test_debug_info.serve	Mon May 18 15:35:52 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
----
-url: /foo
-in: 
-    pages/foo.md: |
-        BLAH
-        {{piecrust.debug_info}}
-out: BLAH
----
-url: /foo?!debug
-in:
-    pages/foo.md: |
-        BLAH
-        {{piecrust.debug_info}}
-out_contains: |
-    BLAH
-    <div id="piecrust-debug-info"
----
-url: /foo
-in:
-    pages/foo.md: BLAH {{pcurl('bar')}}
-out: BLAH /bar.html
----
-url: /foo?!debug
-in:
-    pages/foo.md: BLAH {{pcurl('bar')}}
-out: BLAH /bar.html?!debug
----
-url: /foo
-config:
-    site:
-        pretty_urls: true
-in:
-    pages/foo.md: BLAH {{pcurl('bar')}}
-out: BLAH /bar
----
-url: /foo?!debug
-config:
-    site:
-        pretty_urls: true
-in:
-    pages/foo.md: BLAH {{pcurl('bar')}}
-out: BLAH /bar?!debug
-
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/servings/test_debug_info.yaml	Mon May 18 15:48:45 2015 -0700
@@ -0,0 +1,43 @@
+---
+url: /foo
+in: 
+    pages/foo.md: |
+        BLAH
+        {{piecrust.debug_info}}
+out: BLAH
+---
+url: /foo?!debug
+in:
+    pages/foo.md: |
+        BLAH
+        {{piecrust.debug_info}}
+out_contains: |
+    BLAH
+    <div id="piecrust-debug-info"
+---
+url: /foo
+in:
+    pages/foo.md: BLAH {{pcurl('bar')}}
+out: BLAH /bar.html
+---
+url: /foo?!debug
+in:
+    pages/foo.md: BLAH {{pcurl('bar')}}
+out: BLAH /bar.html?!debug
+---
+url: /foo
+config:
+    site:
+        pretty_urls: true
+in:
+    pages/foo.md: BLAH {{pcurl('bar')}}
+out: BLAH /bar
+---
+url: /foo?!debug
+config:
+    site:
+        pretty_urls: true
+in:
+    pages/foo.md: BLAH {{pcurl('bar')}}
+out: BLAH /bar?!debug
+