mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Merge pull request #2094 from ingwinlu/add_test_unknown_file
Add Python 3.6 test environment
This commit is contained in:
commit
5569338fbd
12 changed files with 43 additions and 16 deletions
|
|
@ -7,11 +7,12 @@ env:
|
||||||
- TOX_ENV=py27
|
- TOX_ENV=py27
|
||||||
- TOX_ENV=py33
|
- TOX_ENV=py33
|
||||||
- TOX_ENV=py34
|
- TOX_ENV=py34
|
||||||
|
- TOX_ENV=py35
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- python: 3.5
|
- python: 3.6
|
||||||
env:
|
env:
|
||||||
- TOX_ENV=py35
|
- TOX_ENV=py36
|
||||||
addons:
|
addons:
|
||||||
apt_packages:
|
apt_packages:
|
||||||
- pandoc
|
- pandoc
|
||||||
|
|
@ -19,7 +20,7 @@ before_install:
|
||||||
- sudo apt-get update -qq
|
- sudo apt-get update -qq
|
||||||
- sudo locale-gen fr_FR.UTF-8 tr_TR.UTF-8
|
- sudo locale-gen fr_FR.UTF-8 tr_TR.UTF-8
|
||||||
install:
|
install:
|
||||||
- pip install tox==2.0.1
|
- pip install tox==2.5.0
|
||||||
script: tox -e $TOX_ENV
|
script: tox -e $TOX_ENV
|
||||||
notifications:
|
notifications:
|
||||||
irc:
|
irc:
|
||||||
|
|
|
||||||
|
|
@ -47,13 +47,16 @@ Or using ``pip``::
|
||||||
|
|
||||||
$ pip install -e .
|
$ pip install -e .
|
||||||
|
|
||||||
|
To conveniently test on multiple Python versions, we also provide a .tox file.
|
||||||
|
|
||||||
|
|
||||||
Building the docs
|
Building the docs
|
||||||
=================
|
=================
|
||||||
|
|
||||||
If you make changes to the documentation, you should preview your changes
|
If you make changes to the documentation, you should preview your changes
|
||||||
before committing them::
|
before committing them::
|
||||||
|
|
||||||
$ pip install sphinx
|
$ pip install -r requirements/docs.pip
|
||||||
$ cd src/pelican/docs
|
$ cd src/pelican/docs
|
||||||
$ make html
|
$ make html
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -246,7 +246,7 @@ class Content(object):
|
||||||
origin = origin.replace('\\', '/') # for Windows paths.
|
origin = origin.replace('\\', '/') # for Windows paths.
|
||||||
else:
|
else:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"Unable to find `%s`, skipping url replacement.",
|
"Unable to find '%s', skipping url replacement.",
|
||||||
value.geturl(), extra={
|
value.geturl(), extra={
|
||||||
'limit_msg': ("Other resources were not found "
|
'limit_msg': ("Other resources were not found "
|
||||||
"and their urls not replaced")})
|
"and their urls not replaced")})
|
||||||
|
|
|
||||||
|
|
@ -197,6 +197,7 @@ class FatalLogger(LimitLogger):
|
||||||
if FatalLogger.errors_fatal:
|
if FatalLogger.errors_fatal:
|
||||||
raise RuntimeError('Error encountered')
|
raise RuntimeError('Error encountered')
|
||||||
|
|
||||||
|
|
||||||
logging.setLoggerClass(FatalLogger)
|
logging.setLoggerClass(FatalLogger)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ class Pygments(Directive):
|
||||||
parsed = highlight('\n'.join(self.content), lexer, formatter)
|
parsed = highlight('\n'.join(self.content), lexer, formatter)
|
||||||
return [nodes.raw('', parsed, format='html')]
|
return [nodes.raw('', parsed, format='html')]
|
||||||
|
|
||||||
|
|
||||||
directives.register_directive('code-block', Pygments)
|
directives.register_directive('code-block', Pygments)
|
||||||
directives.register_directive('sourcecode', Pygments)
|
directives.register_directive('sourcecode', Pygments)
|
||||||
|
|
||||||
|
|
@ -90,4 +91,5 @@ def abbr_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
|
||||||
expl = m.group(1)
|
expl = m.group(1)
|
||||||
return [abbreviation(abbr, abbr, explanation=expl)], []
|
return [abbreviation(abbr, abbr, explanation=expl)], []
|
||||||
|
|
||||||
|
|
||||||
roles.register_local_role('abbr', abbr_role)
|
roles.register_local_role('abbr', abbr_role)
|
||||||
|
|
|
||||||
|
|
@ -731,3 +731,19 @@ class TestStatic(LoggedTestCase):
|
||||||
msg="Replacement Indicator 'unknown' not recognized, "
|
msg="Replacement Indicator 'unknown' not recognized, "
|
||||||
"skipping replacement",
|
"skipping replacement",
|
||||||
level=logging.WARNING)
|
level=logging.WARNING)
|
||||||
|
|
||||||
|
def test_link_to_unknown_file(self):
|
||||||
|
"{filename} link to unknown file should trigger warning."
|
||||||
|
|
||||||
|
html = '<a href="{filename}foo">link</a>'
|
||||||
|
page = Page(content=html,
|
||||||
|
metadata={'title': 'fakepage'}, settings=self.settings,
|
||||||
|
source_path=os.path.join('dir', 'otherdir', 'fakepage.md'),
|
||||||
|
context=self.context)
|
||||||
|
content = page.get_content('')
|
||||||
|
|
||||||
|
self.assertEqual(content, html)
|
||||||
|
self.assertLogCountEqual(
|
||||||
|
count=1,
|
||||||
|
msg="Unable to find 'foo', skipping url replacement.",
|
||||||
|
level=logging.WARNING)
|
||||||
|
|
|
||||||
|
|
@ -70,6 +70,7 @@ def _input_compat(prompt):
|
||||||
r = raw_input(prompt)
|
r = raw_input(prompt)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
||||||
if six.PY3:
|
if six.PY3:
|
||||||
str_compat = str
|
str_compat = str
|
||||||
else:
|
else:
|
||||||
|
|
@ -81,6 +82,7 @@ else:
|
||||||
class _DEFAULT_PATH_TYPE(str_compat):
|
class _DEFAULT_PATH_TYPE(str_compat):
|
||||||
is_default_path = True
|
is_default_path = True
|
||||||
|
|
||||||
|
|
||||||
_DEFAULT_PATH = _DEFAULT_PATH_TYPE(os.curdir)
|
_DEFAULT_PATH = _DEFAULT_PATH_TYPE(os.curdir)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -412,5 +414,6 @@ needed by Pelican.
|
||||||
|
|
||||||
print('Done. Your new project is available at %s' % CONF['basedir'])
|
print('Done. Your new project is available at %s' % CONF['basedir'])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ def err(msg, die=None):
|
||||||
if die:
|
if die:
|
||||||
sys.exit((die if type(die) is int else 1))
|
sys.exit((die if type(die) is int else 1))
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import pelican
|
import pelican
|
||||||
except:
|
except:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
||||||
-r test.pip
|
-r test.pip
|
||||||
|
-r docs.pip
|
||||||
# Development
|
-r style.pip
|
||||||
flake8
|
|
||||||
flake8-import-order
|
|
||||||
sphinx==1.4.9
|
|
||||||
|
|
|
||||||
2
requirements/docs.pip
Normal file
2
requirements/docs.pip
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
sphinx==1.4.9
|
||||||
|
sphinx_rtd_theme
|
||||||
2
requirements/style.pip
Normal file
2
requirements/style.pip
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
flake8
|
||||||
|
flake8-import-order
|
||||||
11
tox.ini
11
tox.ini
|
|
@ -1,5 +1,5 @@
|
||||||
[tox]
|
[tox]
|
||||||
envlist = py{27,33,34,35},docs,flake8
|
envlist = py{27,33,34,35,36},docs,flake8
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
basepython =
|
basepython =
|
||||||
|
|
@ -7,10 +7,11 @@ basepython =
|
||||||
py33: python3.3
|
py33: python3.3
|
||||||
py34: python3.4
|
py34: python3.4
|
||||||
py35: python3.5
|
py35: python3.5
|
||||||
|
py36: python3.6
|
||||||
passenv = *
|
passenv = *
|
||||||
usedevelop=True
|
usedevelop=True
|
||||||
deps =
|
deps =
|
||||||
-rrequirements/developer.pip
|
-rrequirements/test.pip
|
||||||
nose
|
nose
|
||||||
nose-cov
|
nose-cov
|
||||||
coveralls
|
coveralls
|
||||||
|
|
@ -24,8 +25,7 @@ commands =
|
||||||
[testenv:docs]
|
[testenv:docs]
|
||||||
basepython = python2.7
|
basepython = python2.7
|
||||||
deps =
|
deps =
|
||||||
sphinx==1.4.9
|
-rrequirements/docs.pip
|
||||||
sphinx_rtd_theme
|
|
||||||
changedir = docs
|
changedir = docs
|
||||||
commands =
|
commands =
|
||||||
sphinx-build -W -b html -d {envtmpdir}/doctrees . _build/html
|
sphinx-build -W -b html -d {envtmpdir}/doctrees . _build/html
|
||||||
|
|
@ -37,8 +37,7 @@ import-order-style = cryptography
|
||||||
[testenv:flake8]
|
[testenv:flake8]
|
||||||
basepython = python2.7
|
basepython = python2.7
|
||||||
deps =
|
deps =
|
||||||
flake8 <= 2.4.1
|
-rrequirements/style.pip
|
||||||
git+https://github.com/public/flake8-import-order@2ac7052a4e02b4a8a0125a106d87465a3b9fd688
|
|
||||||
commands =
|
commands =
|
||||||
flake8 --version
|
flake8 --version
|
||||||
flake8 pelican
|
flake8 pelican
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue