Skip to content

Commit

Permalink
apply @gforcada 's recommendations
Browse files Browse the repository at this point in the history
  • Loading branch information
loechel committed Aug 23, 2017
1 parent 1f79ce9 commit 99cc701
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 18 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ New features:

Bug fixes:

- Code Cleanup and enforcing Code Convertions
- Code Cleanup and enforcing Code Conversions
[loechel]


Expand Down
33 changes: 33 additions & 0 deletions constrains.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
configparser==3.5.0
cssselect==1.0.1
enum-compat==0.0.2
enum34==1.1.6
flake8==3.4.1
flake8-blind-except==0.1.1
flake8-coding==1.3.0
flake8-commas==0.4.3
flake8-debugger==1.4.0
flake8-deprecated==1.2.1
flake8-html==0.4.0
flake8-isort==2.2.1
flake8-pep3101==1.1
flake8-polyfill==1.0.1
flake8-print==2.0.2
flake8-quotes==0.11.0
flake8-strict==0.1.4
flake8-string-format==0.2.3
flake8-todo==0.7
FormEncode==1.3.1
future==0.16.0
isort==4.2.15
Jinja2==2.9.6
lxml==3.8.0
MarkupSafe==1.0
mccabe==0.6.1
pycodestyle==2.3.1
pyflakes==1.5.0
Pygments==2.2.0
repoze.xmliter==0.6
six==1.10.0
testfixtures==5.1.1
WebOb==1.7.3
2 changes: 1 addition & 1 deletion lib/diazo/runtrace.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def generate_debug_html(
"""Generate an HTML node with debug info"""
def newElement(tag, content, **kwargs):
n = etree.Element(tag, **kwargs)
if hasattr(content, 'tag'):
if getattr(content, 'tag', None):
n.append(content)
else:
n.text = content
Expand Down
2 changes: 1 addition & 1 deletion lib/diazo/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ def __call__(self, environ, start_response):
# Headers should be left intact
return response(environ, start_response)
finally:
if hasattr(response.app_iter, 'close'):
if getattr(response.app_iter, 'close', None):
response.app_iter.close()

self.reset_headers(response)
Expand Down
44 changes: 29 additions & 15 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ envlist =
py35,
py36,
docs,
isort,
flake8
lint-py2,
lint-py3,
coverage-report,

[testenv]
Expand All @@ -28,6 +28,7 @@ setenv =
COVERAGE_FILE=.coverage.{envname}

deps =
-cconstrains.txt
pdbpp
pytest
pytest-cov
Expand All @@ -40,36 +41,34 @@ whitelist_externals =

[testenv:coverage-report]
basepython = python2.7
deps = coverage
skip_install = true

deps =
-cconstrains.txt
coverage

setenv =
COVERAGE_FILE=.coverage

skip_install = true

commands =
coverage erase
coverage combine
coverage report
coverage html
coverage xml

[testenv:isort]
basepython = python2.7
deps = isort
commands =
#isort --check-only --recursive {toxinidir}/lib
isort --check-only --recursive {toxinidir}/lib

[testenv:isort-apply]
basepython = python2.7
skip_install = true
deps = isort
commands =
isort --apply --recursive {toxinidir}/lib

[testenv:flake8]
basepython = python2.7
[lint]
skip_install = true

deps =
-cconstrains.txt
flake8
# helper to generate HTML reports:
flake8-html
Expand All @@ -81,36 +80,51 @@ deps =
flake8-isort
flake8-pep3101
# flake8-plone-api
# flake8-plone-hasattr
flake8-plone-hasattr
flake8-print
flake8-quotes
flake8-string-format
flake8-todo
flake8_strict
isort

commands =
mkdir -p {toxinidir}/reports/flake8
#isort --check-only --recursive {toxinidir}/src
#- flake8 --format=html --htmldir={toxinidir}/reports/flake8 --doctests src tests setup.py
#flake8 src tests setup.py --doctests
isort --check-only --recursive {toxinidir}/lib
- flake8 --format=html --htmldir={toxinidir}/reports/flake8 --doctests lib setup.py
flake8 lib setup.py --doctests

whitelist_externals =
mkdir

[testenv:lint-py2]
basepython = python2
deps = {[lint]deps}
commands = {[lint]commands}

[testenv:lint-py3]
basepython = python3
deps = {[lint]deps}
commands = {[lint]commands}

[testenv:docs]
basepython = python2.7
commands =
sphinx-build -b html -d build/docs/doctrees docs build/docs/html
#sphinx-build -b doctest docs build/docs/doctrees
deps =
-cconstrains.txt
Sphinx

[testenv:release]
skip_install = true
basepython = python2.7

deps =
-cconstrains.txt
zest.releaser[recommended]

commands =
Expand Down

0 comments on commit 99cc701

Please sign in to comment.