Skip to content

Commit

Permalink
Bring in the sample site and setup an integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Oct 13, 2017
1 parent 3819061 commit ea2aba5
Show file tree
Hide file tree
Showing 100 changed files with 13,165 additions and 2 deletions.
12 changes: 12 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,15 @@ recursive-include docs Makefile

recursive-include src *.zcml
recursive-include src *.plugin

# added by check_manifest.py
recursive-include src *.ico
recursive-include src *.jpg
recursive-include src *.meta
recursive-include src *.png
recursive-include src *.pt
recursive-include src *.py
recursive-include src *.rst
recursive-include src *.theme
recursive-include src *.tmpl
recursive-include src *.txt
6 changes: 6 additions & 0 deletions src/nti/nikola_chameleon/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,13 @@ class IPostPage(IPost, IPageKind):

def _build(iface, result, tag='__pagekinds__', tx=lambda x: x):
__traceback_info__ = iface, tag
if not getattr(iface, '__module__', None) == __name__:
# Provides() objects that exist from alsoProvides()
# being set. Probably will go away on a GC?
return

kinds = iface.getTaggedValue(tag)

kinds = tx(kinds)
if kinds in result and kinds: # pragma: no cover
if result[kinds] is iface:
Expand Down
5 changes: 5 additions & 0 deletions src/nti/nikola_chameleon/tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
testsite/cache/
testsite/.doit.db.db
testsite/.doit.db
testsite/output
testsite/plugins/__init__.py
37 changes: 37 additions & 0 deletions src/nti/nikola_chameleon/tests/test_render.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
"""
Testing the entire rendering process.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function


# disable: accessing protected members, too many methods
# pylint: disable=W0212,R0904

import unittest

from zope.testing.cleanup import CleanUp

class TestRender(CleanUp,unittest.TestCase):

def test_render(self):
from nikola.__main__ import main
import os
import shutil
cwd = os.getcwd()
testsite = os.path.join(os.path.dirname(__file__), 'testsite')
os.chdir(testsite)
self.addCleanup(os.chdir, cwd)

main(['build', '-q'])

shutil.rmtree('output')
# This gets different names under different versions
# of python, for some reason.
if os.path.exists('.doit.db.db'): # python 3
os.remove('.doit.db.db')
else:
os.remove(".doit.db")
17 changes: 17 additions & 0 deletions src/nti/nikola_chameleon/tests/testsite/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
This folder contains the source used to generate a static site using Nikola.

Installation and documentation at https://getnikola.com/

Configuration file for the site is ``conf.py``.

To build the site::

nikola build

To see it::

nikola serve -b

To check all available commands::

nikola help

0 comments on commit ea2aba5

Please sign in to comment.