mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
test that the output of the samples pelican project is correct
(functionnal testing)
This commit is contained in:
parent
5ac3fdec50
commit
2f1f6b5b43
1 changed files with 15 additions and 3 deletions
|
|
@ -1,13 +1,15 @@
|
||||||
import unittest
|
import unittest
|
||||||
import os
|
import os
|
||||||
|
from filecmp import dircmp
|
||||||
|
|
||||||
from .support import temporary_folder
|
from .support import temporary_folder
|
||||||
|
|
||||||
from pelican import Pelican
|
from pelican import Pelican
|
||||||
from pelican.settings import read_settings
|
from pelican.settings import read_settings
|
||||||
|
|
||||||
SAMPLES_PATH = os.path.abspath(os.sep.join(
|
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||||
(os.path.dirname(os.path.abspath(__file__)), "..", "samples")))
|
SAMPLES_PATH = os.path.abspath(os.sep.join((CURRENT_DIR, "..", "samples")))
|
||||||
|
OUTPUT_PATH = os.path.abspath(os.sep.join((CURRENT_DIR, "output")))
|
||||||
|
|
||||||
INPUT_PATH = os.path.join(SAMPLES_PATH, "content")
|
INPUT_PATH = os.path.join(SAMPLES_PATH, "content")
|
||||||
SAMPLE_CONFIG = os.path.join(SAMPLES_PATH, "pelican.conf.py")
|
SAMPLE_CONFIG = os.path.join(SAMPLES_PATH, "pelican.conf.py")
|
||||||
|
|
@ -24,8 +26,18 @@ class TestPelican(unittest.TestCase):
|
||||||
with temporary_folder() as temp_path:
|
with temporary_folder() as temp_path:
|
||||||
pelican = Pelican(path=INPUT_PATH, output_path=temp_path)
|
pelican = Pelican(path=INPUT_PATH, output_path=temp_path)
|
||||||
pelican.run()
|
pelican.run()
|
||||||
|
diff = dircmp(temp_path, os.sep.join((OUTPUT_PATH, "basic")))
|
||||||
|
self.assertEqual(diff.left_only, [])
|
||||||
|
self.assertEqual(diff.right_only, [])
|
||||||
|
self.assertEqual(diff.diff_files, [])
|
||||||
|
|
||||||
# the same thing with a specified set of settins should work
|
def test_custom_generation_works(self):
|
||||||
|
# the same thing with a specified set of settings should work
|
||||||
with temporary_folder() as temp_path:
|
with temporary_folder() as temp_path:
|
||||||
pelican = Pelican(path=INPUT_PATH, output_path=temp_path,
|
pelican = Pelican(path=INPUT_PATH, output_path=temp_path,
|
||||||
settings=read_settings(SAMPLE_CONFIG))
|
settings=read_settings(SAMPLE_CONFIG))
|
||||||
|
pelican.run()
|
||||||
|
diff = dircmp(temp_path, os.sep.join((OUTPUT_PATH, "custom")))
|
||||||
|
self.assertEqual(diff.left_only, [])
|
||||||
|
self.assertEqual(diff.right_only, [])
|
||||||
|
self.assertEqual(diff.diff_files, [])
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue