Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create coverage report in Travis. #102

Merged
merged 3 commits into from Sep 17, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .coveragerc
@@ -0,0 +1,3 @@
[report]
include =
bobtemplates/*
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -2,6 +2,7 @@
*.egg-info
*.mo
*.pyc
.coverage
.installed.cfg
.mr.developer.cfg
.project
Expand All @@ -11,6 +12,7 @@ bin/
buildout-cache/
develop-eggs/
eggs/
htmlcov/
include/
lib/
local/
Expand Down
5 changes: 3 additions & 2 deletions .travis.yml
Expand Up @@ -29,7 +29,7 @@ install:
- pip install docutils
- sed -ie "s/^plone.version.*/plone.version = $PLONE_VERSION/g" test_answers.ini
- sed -ie "s/^package.type.*/package.type = $PACKAGE_TYPE/g" test_answers.ini
- if [ "$PACKAGE_TYPE" == "Dexterity" ]; then echo "package.dexterity_type_name = MyDextrityTestType" >> test_answers.ini; fi
- if [ "$PACKAGE_TYPE" == "Dexterity" ]; then echo "package.dexterity_type_name = MyDexterityTestType" >> test_answers.ini; fi
- bin/buildout -c travis.cfg

before_script:
Expand All @@ -39,10 +39,11 @@ before_script:
script:
- bin/check-readme
- bin/code-analysis
- bin/nosetests
- bin/test
- bin/test-plone_addon

after_success:
- bin/createcoverage
- pip install -q coveralls
- coveralls

Expand Down
7 changes: 7 additions & 0 deletions addon_test.template.sh
Expand Up @@ -14,7 +14,14 @@ ${buildout:directory}/${:addon_name}/bin/buildout

# run tests on addon
${buildout:directory}/${:addon_name}/bin/test --all
# save the exit code of the test command
testresult=$?

# run code analysis
${buildout:directory}/${:addon_name}/bin/code-analysis

# remove addon
rm -rf ${buildout:directory}/${:addon_name}/

# return the exit code of the test command
exit $testresult
2 changes: 1 addition & 1 deletion bobtemplates/plone_addon/.travis.yml.bob
Expand Up @@ -18,8 +18,8 @@ install:
script:
- bin/code-analysis
- bin/test
- bin/createcoverage
after_success:
- bin/createcoverage
- pip install coveralls
- coveralls

Expand Down
22 changes: 21 additions & 1 deletion buildout.cfg
Expand Up @@ -2,7 +2,9 @@
parts =
scripts
test
test-plone_addon
test-plone_addon-nested
alltests
code-analysis
releaser
check-readme
Expand All @@ -20,10 +22,17 @@ eggs =


[test]
# This section is only here to generate the nosetests script a second
# time under a different name: 'test'.
<= scripts
scripts = nosetests=test


[test-plone_addon]
recipe = collective.recipe.template
addon_name = test.plone_addon
input = addon_test.template.sh
output = ${buildout:directory}/bin/test
output = ${buildout:directory}/bin/test-plone_addon
mode = 755


Expand All @@ -35,6 +44,17 @@ output = ${buildout:directory}/bin/test-plone_addon-nested
mode = 755


[alltests]
recipe = collective.recipe.template
input = inline:
#!/bin/sh
bin/test
bin/test-plone_addon
bin/test-plone_addon-nested
output = ${buildout:directory}/bin/alltests
mode = 755


[code-analysis]
recipe = plone.recipe.codeanalysis
directory = ${buildout:directory}
Expand Down
8 changes: 8 additions & 0 deletions tests.py
Expand Up @@ -4,6 +4,7 @@
import tempfile
import shutil

from bobtemplates import hooks
from scripttest import TestFileEnvironment


Expand Down Expand Up @@ -170,3 +171,10 @@ def test_plone_addon_nested_template(self):
self.project + '/.gitattributes',
]
)


class HooksTest(unittest.TestCase):

def test_to_boolean(self):
# Initial simple test to show coverage in hooks.py.
self.assertEqual(hooks.to_boolean(None, None, 'y'), True)
5 changes: 5 additions & 0 deletions travis.cfg
@@ -1,7 +1,12 @@
[buildout]
extends = buildout.cfg
parts += createcoverage

[code-analysis]
recipe = plone.recipe.codeanalysis
pre-commit-hook = False
return-status-codes = True

[createcoverage]
recipe = zc.recipe.egg
eggs = createcoverage