Skip to content

Commit

Permalink
Create coverage report in Travis.
Browse files Browse the repository at this point in the history
Generate nosetests script also under the 'test' name.  Then
bin/createcoverage works.

In Travis call the new correct script names:

- The new bin/test is the old bin/nosetests.
- The new bin/test-plone_addon is the old bin/test.

Created bin/alltests script.  This runs bin/test, and the two
test-plone_addon scripts.  We could call that in Travis too.

Added initial simple test to show coverage in hooks.py.
  • Loading branch information
mauritsvanrees committed Sep 16, 2015
1 parent fcd2f2f commit 0e96df7
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[report]
include =
bobtemplates/*
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
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
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ before_script:
script:
- bin/check-readme
- bin/code-analysis
- bin/nosetests
- bin/test
- bin/test-plone_addon
- bin/createcoverage

after_success:
- pip install -q coveralls
Expand Down
4 changes: 4 additions & 0 deletions all_tests.template.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
bin/test
bin/test-plone_addon
bin/test-plone_addon-nested
18 changes: 17 additions & 1 deletion buildout.cfg
Original file line number Diff line number Diff line change
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,13 @@ output = ${buildout:directory}/bin/test-plone_addon-nested
mode = 755


[alltests]
recipe = collective.recipe.template
input = all_tests.template.sh
output = ${buildout:directory}/bin/alltests
mode = 755


[code-analysis]
recipe = plone.recipe.codeanalysis
directory = ${buildout:directory}
Expand Down
3 changes: 3 additions & 0 deletions full_test.py.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import subprocess
import sys
sys.exit(subprocess.call('./bin/nosetests'))
8 changes: 8 additions & 0 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import tempfile
import shutil

from bobtemplates import hooks
from scripttest import TestFileEnvironment


Expand Down Expand Up @@ -176,3 +177,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
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0e96df7

Please sign in to comment.