1
0
Fork 0
forked from github/pelican
Commit graph

28 commits

Author SHA1 Message Date
Peter Sabaini
923a29aaad Override settings from the command line
Add a --setting-overrides KEY=VAL command line option to override
default settings or those defined in settings files. This adds
flexibility in running Pelican and helps reduce sprawl of settings
files. Cast int and str setting overrides to their respective types.
Support other setting types by treating them as JSON. Fall back to JSON
when an override typecast errors. This should make it possible to set
int values to None, resp. to JSON 'none'
2020-08-20 11:27:49 +02:00
Deniz Turgut
2e482b207b
Fix Windows tests
* Unskip passable tests
* Fix broken tests
2020-05-09 16:17:14 +03:00
Justin Mayer
d43b786b30 Modernize code base to Python 3+ syntax
Replaces syntax that was relevant in earlier Python versions but that
now has modernized equivalents.
2020-04-27 09:45:31 +02:00
Kevin Yap
1e0e541b57 Initial pass of removing Python 2 support
This commit removes Six as a dependency for Pelican, replacing the
relevant aliases with the proper Python 3 imports. It also removes
references to Python 2 logic that did not require Six.
2019-11-26 06:16:41 +09:00
Andrew Jorgensen
b1d44c1c87 Replace %s rather than fallback to defaults
3a0add4b6e caused existing configs to fall
back to defaults. But since we know exactly how to fix the user config
so that the behavior doesn't change, we should do so, while still
warning that use of %s is deprecated.

Also fixes a bug where we tried to look for %s in None.
2018-11-11 14:54:14 -08:00
Vladimír Vondruš
4c3b6ac383 settings: add another consistency test for SLUG_SUBSTITUTIONS. 2018-11-11 13:58:55 +01:00
Vladimír Vondruš
d01614495f settings: test reading PAGINATED_DIRECT_TEMPLATES from pelicanconf.py.
At the moment aborts with the following:

      File "/usr/lib/python3.7/site-packages/pelican/settings.py", line 327, in handle_deprecated_settings
        if t not in settings['PAGINATED_TEMPLATES']:
    KeyError: 'PAGINATED_TEMPLATES'
2018-11-11 13:58:55 +01:00
Oliver Urs Lenz
5199fa51ea control slug substitutions from settings with regex 2018-10-31 16:20:21 +01:00
Oliver Urs Lenz
62128fb948 control pagination per template 2018-07-12 17:39:51 +02:00
Pedro H
50af2ed45d Add THEME_TEMPLATE_OVERRIDES. Refs 2021
Allow for overriding individual templates from the theme by configuring
the Jinja2 `Environment` loader to search for templates in the
`THEME_TEMPLATES_OVERRIDES` path before the theme's `templates/`
directory.
2017-10-10 14:33:20 +08:00
derwinlu
8993c55e6e fulfil pep8 standard 2015-08-17 13:34:32 +02:00
Justin Mayer
72a0e626dd Merge pull request #1530 from Sethathi/settings_unit_tests
Unit tests for settings.py
2015-05-21 10:10:37 +02:00
Kevin Yap
6549f51591 Add tests for Pelican and pelican_import tool
Added tests to ensure that:
- THEME and deprecated *_DIR settings result in the expected configurations
- Post headers are formatted correctly in both Markdown and reStructuredText
- Files specified in IGNORE_FILES setting are properly ignored
- Generator.get_files()'s `paths` argument is backwards-compatible with strings
2015-02-17 18:26:41 -08:00
Deniz Turgut
fa269d7c6f Fix tests that were skipped in #1581 2015-02-17 20:50:27 -05:00
George V. Reilly
4c25610cd8 Fix Pelican rendering and unit tests on Windows.
* Fix {filename} links on Windows.
  Otherwise '{filename}/foo/bar.jpg' doesn't work
* Clean up relative Posix path handling in contents.
* Use Posix paths in readers
* Environment for Popen must be strs, not unicodes.
* Ignore Git CRLF warnings.
* Replace CRLFs with LFs in inputs on Windows.
* Fix importer tests
* Fix test_contents
* Fix one last backslash in paginated output
* Skip the remaining failing locale tests on Windows.
* Document the use of forward slashes on Windows.
* Add some Fabric and ghp-import notes
2015-01-25 17:42:53 -08:00
Sethathi Morokole
90edf14beb unit tests for settings.py 2014-11-11 15:26:13 +02:00
Ondrej Grover
6aa0e4346d Add {PAGE,ARTICLE}_PATHS to {ARTICLE,PAGE}_EXCLUDES automatically
This makes it easier for someone to change PAGE_PATHS without the
need to change ARTICLE_EXCLUDES accordingly.
2014-05-14 14:30:21 +02:00
Antoine Brenner
7277c95fb5 Make sure locale is what we want before/after the tests
The locale is a global state, and it was not properly reset to
whatever it was before the unitttest possibly changed it.
This is now fixed.

Not restoring the locale led to weird issues: depending on
the order chosen by "python -m unittest discover" to run
the unit tests, some tests would apparently randomly fail
due to the locale not being what was expected.

For example, test_period_in_timeperiod_archive would
call mock('posts/1970/ 1月/index.html',...) instead of
expected mock('posts/1970/Jan/index.html',...) and fail.
2014-04-15 16:45:45 +02:00
Russ Webber
b527fd594d added testing for default locale setting
removed LOCALE="" from default conf as it looks weird and you
shouldn't need to set a blank LOCALE for the system to work.
2013-07-21 14:12:21 +08:00
W. Trevor King
e9dc1dd478 settings: Make DEFAULT_CONFIG public
This dictionary is accessed by plugins (like `summary`) which add new
settings, so it should be public (i.e. no prefixed underscore).

The changed name length would have led to a re-indenting of the
default contents anyway, so I shifted them all to four spaces.
2013-06-02 13:32:10 -04:00
Dave King
bd54cb1b88 Prevent people from setting STATIC_PATHS to a str
Previously you could accidentally set for example site/css and pelican would iterate through the string and attempt to copy '/' into your output.
2013-03-23 19:56:14 -07:00
W. Trevor King
b59da89e80 Convert '.' and '..' to the less magical os.curdir and os.pardir
While I'm cleaning up path manipulation, I might as well make things
more semantic.
2013-03-21 12:44:44 -04:00
Alexis Métaireau
5aeca4826c Use comments in tests, not docstrings. 2013-03-10 22:42:46 -07:00
Alexis Métaireau
547f8d2e83 Move the tests into pelican. Fix #500 2013-03-06 00:41:27 -08:00
Mario Rodas
3cd84ab396 moving tests dir 2011-07-02 14:41:39 -05:00
Alexis Metaireau
371892ceaa Merge branch tests into main. (See #44)
Conflicts:
	pelican/contents.py
	pelican/settings.py
	samples/pelican.conf.py
2011-05-10 23:18:11 +01:00
Alexis Metaireau
8454b0d1b8 Tests for settings. 2011-01-13 00:46:10 +01:00
Alexis Metaireau
bb96e253c9 Start working on the testsuite. 2011-01-05 16:24:44 +01:00