1
0
Fork 0
forked from github/pelican

Merge pull request #2094 from ingwinlu/add_test_unknown_file

Add Python 3.6 test environment
This commit is contained in:
Justin Mayer 2017-02-28 11:04:07 -08:00 committed by GitHub
commit 5569338fbd
12 changed files with 43 additions and 16 deletions

View file

@ -7,11 +7,12 @@ env:
- TOX_ENV=py27
- TOX_ENV=py33
- TOX_ENV=py34
- TOX_ENV=py35
matrix:
include:
- python: 3.5
- python: 3.6
env:
- TOX_ENV=py35
- TOX_ENV=py36
addons:
apt_packages:
- pandoc
@ -19,7 +20,7 @@ before_install:
- sudo apt-get update -qq
- sudo locale-gen fr_FR.UTF-8 tr_TR.UTF-8
install:
- pip install tox==2.0.1
- pip install tox==2.5.0
script: tox -e $TOX_ENV
notifications:
irc:

View file

@ -47,13 +47,16 @@ Or using ``pip``::
$ pip install -e .
To conveniently test on multiple Python versions, we also provide a .tox file.
Building the docs
=================
If you make changes to the documentation, you should preview your changes
before committing them::
$ pip install sphinx
$ pip install -r requirements/docs.pip
$ cd src/pelican/docs
$ make html

View file

@ -246,7 +246,7 @@ class Content(object):
origin = origin.replace('\\', '/') # for Windows paths.
else:
logger.warning(
"Unable to find `%s`, skipping url replacement.",
"Unable to find '%s', skipping url replacement.",
value.geturl(), extra={
'limit_msg': ("Other resources were not found "
"and their urls not replaced")})

View file

@ -197,6 +197,7 @@ class FatalLogger(LimitLogger):
if FatalLogger.errors_fatal:
raise RuntimeError('Error encountered')
logging.setLoggerClass(FatalLogger)

View file

@ -70,6 +70,7 @@ class Pygments(Directive):
parsed = highlight('\n'.join(self.content), lexer, formatter)
return [nodes.raw('', parsed, format='html')]
directives.register_directive('code-block', Pygments)
directives.register_directive('sourcecode', Pygments)
@ -90,4 +91,5 @@ def abbr_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
expl = m.group(1)
return [abbreviation(abbr, abbr, explanation=expl)], []
roles.register_local_role('abbr', abbr_role)

View file

@ -731,3 +731,19 @@ class TestStatic(LoggedTestCase):
msg="Replacement Indicator 'unknown' not recognized, "
"skipping replacement",
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)

View file

@ -70,6 +70,7 @@ def _input_compat(prompt):
r = raw_input(prompt)
return r
if six.PY3:
str_compat = str
else:
@ -81,6 +82,7 @@ else:
class _DEFAULT_PATH_TYPE(str_compat):
is_default_path = True
_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'])
if __name__ == "__main__":
main()

View file

@ -14,6 +14,7 @@ def err(msg, die=None):
if die:
sys.exit((die if type(die) is int else 1))
try:
import pelican
except:

View file

@ -1,6 +1,3 @@
-r test.pip
# Development
flake8
flake8-import-order
sphinx==1.4.9
-r docs.pip
-r style.pip

2
requirements/docs.pip Normal file
View file

@ -0,0 +1,2 @@
sphinx==1.4.9
sphinx_rtd_theme

2
requirements/style.pip Normal file
View file

@ -0,0 +1,2 @@
flake8
flake8-import-order

11
tox.ini
View file

@ -1,5 +1,5 @@
[tox]
envlist = py{27,33,34,35},docs,flake8
envlist = py{27,33,34,35,36},docs,flake8
[testenv]
basepython =
@ -7,10 +7,11 @@ basepython =
py33: python3.3
py34: python3.4
py35: python3.5
py36: python3.6
passenv = *
usedevelop=True
deps =
-rrequirements/developer.pip
-rrequirements/test.pip
nose
nose-cov
coveralls
@ -24,8 +25,7 @@ commands =
[testenv:docs]
basepython = python2.7
deps =
sphinx==1.4.9
sphinx_rtd_theme
-rrequirements/docs.pip
changedir = docs
commands =
sphinx-build -W -b html -d {envtmpdir}/doctrees . _build/html
@ -37,8 +37,7 @@ import-order-style = cryptography
[testenv:flake8]
basepython = python2.7
deps =
flake8 <= 2.4.1
git+https://github.com/public/flake8-import-order@2ac7052a4e02b4a8a0125a106d87465a3b9fd688
-rrequirements/style.pip
commands =
flake8 --version
flake8 pelican