Skip to content

Commit

Permalink
fix coverage travis setup
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTango committed Jul 24, 2020
1 parent 36505ab commit 44a88de
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
8 changes: 2 additions & 6 deletions bobtemplates/plone/utils.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
# -*- coding: utf-8 -*-
from bobtemplates.plone.base import _get_package_root_folder

import logging
import re
import six
import subprocess
import unicodedata


logger = logging.getLogger("bobtemplates.plone.utils")


def safe_unicode(value, encoding='utf-8'):
"""Converts a value to unicode, even it is already a unicode string.
"""
Expand Down Expand Up @@ -79,6 +75,6 @@ def run_isort(configurator):
['tox', '-e', 'isort-apply'],
cwd=root_folder,
)
logger.debug(u'\nisort-apply: successful:\n{0}\n'.format(safe_unicode(test_result)))
print(u'\nisort-apply: successful:\n{0}\n'.format(safe_unicode(test_result)))
except subprocess.CalledProcessError as execinfo:
logger.debug(u'Error on isort-apply: {0}'.format(safe_unicode(execinfo.output)))
print(u'Error on isort-apply: {0}'.format(safe_unicode(execinfo.output)))
23 changes: 12 additions & 11 deletions skeleton-tests/test_addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,18 @@ def test_addon(tmpdir, capsys, config):
config.template = 'addon'
config.package_name = 'collective.task'

result = subprocess.call(
[
'mrbob',
'-O', config.package_name,
'bobtemplates.plone:' + config.template,
'--config', 'answers.ini',
'--non-interactive',
],
cwd=tmpdir.strpath,
)
assert result == 0
with capsys.disabled():
result = subprocess.call(
[
'mrbob',
'-O', config.package_name,
'bobtemplates.plone:' + config.template,
'--config', 'answers.ini',
'--non-interactive',
],
cwd=tmpdir.strpath,
)
assert result == 0

generated_files = glob.glob(
tmpdir.strpath + '/' + config.package_name + '/*',
Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ basepython:

commands =
mkdir -p {toxinidir}/_build/reports/coverage {toxinidir}/_build/reports/pytest
packagetests: pytest --cov=bobtemplates.plone --cov-config=tox.ini --cov-append --cov-report=xml --html={toxinidir}/_build/reports/pytest/report-{envname}.html --self-contained-html package_tests {posargs}
packagetests: pytest --cov=bobtemplates.plone --cov-report=xml --html={toxinidir}/_build/reports/pytest/report-{envname}.html --self-contained-html package_tests {posargs}
template-addon: pytest skeleton-tests/test_addon.py {posargs}
template-addon_behavior: pytest skeleton-tests/test_addon_behavior.py {posargs}
template-addon_content_type: pytest skeleton-tests/test_addon_content_type.py {posargs}
Expand Down Expand Up @@ -99,8 +99,8 @@ deps =
depends =
py{27,37}-packagetests,

setenv =
COVERAGE_FILE=.coverage
#setenv =
# COVERAGE_FILE=.coverage

skip_install = true

Expand Down

0 comments on commit 44a88de

Please sign in to comment.