Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def assert_rst_equal(self, rstfile, expected, **kwargs):
pelican = Pelican(settings=get_settings(**kwargs))
reader = Readers(pelican.settings)
content = reader.read_file(base_path=RESOURCES_PATH, path=rstfile).content
self.assertEqual(normalize(content), normalize(expected))
test_data/content``
Remember to remove the output/ folder before that.
'''
base_path = os.path.dirname(os.path.abspath(__file__))
base_path = os.path.join(base_path, 'test_data')
content_path = os.path.join(base_path, 'content')
output_path = os.path.join(base_path, 'output')
settings_path = os.path.join(base_path, 'pelicanconf.py')
settings = read_settings(path=settings_path, override={
'PATH': content_path,
'OUTPUT_PATH': self.temp_path,
'CACHE_PATH': self.temp_cache,
'PLUGINS': [i18ns],
}
)
pelican = Pelican(settings)
pelican.run()
# compare output
out, err = subprocess.Popen(
['git', 'diff', '--no-ext-diff', '--exit-code', '-w', output_path,
self.temp_path], env={'PAGER': ''},
stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
self.assertFalse(out, 'non-empty `diff` stdout:\n{}'.format(out))
self.assertFalse(err, 'non-empty `diff` stderr:\n{}'.format(out))
# encoding=utf-8
import os.path
import json
from bunch import Bunch
from flask import current_app
from pelican import Pelican
from pelican.settings import _DEFAULT_CONFIG
class Calepin(Pelican):
USER_CONFIG_PROPERTIES = (
'AUTHOR',
'DEFAULT_DATE_FORMAT',
'GOOGLE_ANALYTICS',
'GAUGE_ID',
'CLICKY',
'DEFAULT_PAGINATION',
'WITH_FUTURE_DATES',
'OUTPUT_SOURCES',
'TIMEZONE',
)
def __init__(self, blog):
self.blog = blog
self._config = Bunch(current_app.config)