aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLibravatarAgustin Henze <tin@sluc.org.ar>2013-02-27 09:13:24 -0300
committerLibravatarAgustin Henze <tin@sluc.org.ar>2013-02-27 09:13:24 -0300
commit878ba1152ebc64a4a2609d23c9e400a6111db642 (patch)
tree7672c12a59dbab1864606109e4f2b1dd7534043c /tests
parenta40930043121a4b60de8526d58417761a54ab718 (diff)
Imported Upstream version 5.3upstream/5.3
Diffstat (limited to 'tests')
-rw-r--r--tests/context.py2
-rw-r--r--tests/test_command_init.py1
-rw-r--r--tests/test_integration.py73
-rw-r--r--tests/test_plugin_importing.py8
-rw-r--r--tests/test_utils.py1
5 files changed, 78 insertions, 7 deletions
diff --git a/tests/context.py b/tests/context.py
index f292b79..28eb872 100644
--- a/tests/context.py
+++ b/tests/context.py
@@ -6,4 +6,4 @@ import os
import sys
sys.path.insert(0, os.path.abspath('..'))
-import nikola
+import nikola # NOQA
diff --git a/tests/test_command_init.py b/tests/test_command_init.py
index 3176c1f..32ce345 100644
--- a/tests/test_command_init.py
+++ b/tests/test_command_init.py
@@ -2,7 +2,6 @@
from __future__ import unicode_literals
from context import nikola
-import os
import unittest
import mock
diff --git a/tests/test_integration.py b/tests/test_integration.py
new file mode 100644
index 0000000..947a832
--- /dev/null
+++ b/tests/test_integration.py
@@ -0,0 +1,73 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals, print_function
+
+from contextlib import contextmanager
+import os
+import shutil
+import tempfile
+import unittest
+
+from context import nikola
+
+
+@contextmanager
+def cd(path):
+ old_dir = os.getcwd()
+ os.chdir(path)
+ yield
+ os.chdir(old_dir)
+
+
+class IntegrationTest(unittest.TestCase):
+ """Basic integration testcase."""
+ def setUp(self):
+ """Setup a demo site."""
+ self.tmpdir = tempfile.mkdtemp()
+ self.target_dir = os.path.join(self.tmpdir, "target")
+ self.build_command = nikola.plugins.command_build.CommandBuild()
+ self.init_command = nikola.plugins.command_init.CommandInit()
+ self.init_command.copy_sample_site(self.target_dir)
+ self.init_command.create_configuration(self.target_dir)
+ self.patch_site()
+ self.build()
+
+ def patch_site(self):
+ """Make any modifications you need to the site."""
+ pass
+
+ def build(self):
+ """Build the site."""
+ with cd(self.target_dir):
+ self.build_command.run()
+
+ def tearDown(self):
+ """Reove the demo site."""
+ shutil.rmtree(self.tmpdir)
+
+
+class EmptytBuild(IntegrationTest):
+ """Basic integration testcase."""
+ def setUp(self):
+ """Setup a demo site."""
+ self.tmpdir = tempfile.mkdtemp()
+ self.target_dir = os.path.join(self.tmpdir, "target")
+ self.build_command = nikola.plugins.command_build.CommandBuild()
+ self.init_command = nikola.plugins.command_init.CommandInit()
+ self.init_command.create_empty_site(self.target_dir)
+ self.init_command.create_configuration(self.target_dir)
+ self.patch_site()
+ self.build()
+
+ def test_deleted_dodo(self):
+ """Test that a default build of --demo works."""
+ # Ensure the temprary dodo file is deleted (Issue #302)
+ self.assertFalse(os.path.isfile(self.build_command.dodo.name))
+
+
+class DefaultBuild(IntegrationTest):
+ """Test that a default build of --demo works."""
+
+ def test_deleted_dodo(self):
+ """Test that a default build of --demo works."""
+ # Ensure the temprary dodo file is deleted (Issue #302)
+ self.assertFalse(os.path.isfile(self.build_command.dodo.name))
diff --git a/tests/test_plugin_importing.py b/tests/test_plugin_importing.py
index 7e1e013..1a610bf 100644
--- a/tests/test_plugin_importing.py
+++ b/tests/test_plugin_importing.py
@@ -1,16 +1,16 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
-from context import nikola
+from context import nikola # NOQA
import unittest
class ImportPluginsTest(unittest.TestCase):
def test_importing_command_import_wordpress(self):
- import nikola.plugins.command_import_wordpress
+ import nikola.plugins.command_import_wordpress # NOQA
def test_importing_task_sitemap(self):
- import nikola.plugins.task_sitemap.sitemap_gen
+ import nikola.plugins.task_sitemap.sitemap_gen # NOQA
def test_importing_compile_rest(self):
- import nikola.plugins.compile_rest \ No newline at end of file
+ import nikola.plugins.compile_rest # NOQA
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 8ec016f..2cb36a8 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -2,7 +2,6 @@
from __future__ import unicode_literals
from context import nikola
-import os
import unittest
import mock