Skip to content

Commit

Permalink
Merge pull request #35 from zopefoundation/fix-tox-coverage
Browse files Browse the repository at this point in the history
Ignore sys.argv in tests
  • Loading branch information
mgedmin committed Jul 20, 2017
2 parents 57b06d8 + 81589e7 commit ad53779
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
10 changes: 10 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
[run]
# This is not as helpful as it may seem, because the parent directory is
# likely also named ZConfig, so this matches things like
# /path/to/ZConfig/.tox/py*/lib/*
source = ZConfig

# datatypes.py is dynamically-created in a temporary directory and then
# removed, which makes coverage reporting unhappy.
omit =
*/datatypes.py
.tox/*
ZConfig/tests/*

[report]
# Coverage is run on Py2 and Py3
# on POSIX platforms, so omit Windows-specific
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ parts/
doc/_build
htmlcov/
.coverage
coverage.xml
nosetests.xml
2 changes: 1 addition & 1 deletion ZConfig/schema2html.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class HtmlSchemaPrinter(AbstractSchemaPrinter):
_schema_formatter = HtmlSchemaFormatter

def main(argv=None):
argv = argv or sys.argv[1:]
argv = argv if argv is not None else sys.argv[1:]

argparser = argparse.ArgumentParser(
description="Print an HTML version of a schema")
Expand Down
4 changes: 0 additions & 4 deletions ZConfig/tests/test_schema2html.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,6 @@ def run_transform_rst(*args):

class TestSchema2HTML(unittest.TestCase):

def test_no_schema(self):
self.assertRaises(SystemExit,
run_transform)

def test_schema_only(self):
res = run_transform(input_file('simple.xml'))
self.assertIn('</html>', res.getvalue())
Expand Down
11 changes: 3 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,8 @@ deps =
basepython =
python2.7
commands =
# The installed version messes up nose's test discovery / coverage reporting
# So, we uninstall that from the environment, and then install the editable
# version, before running nosetests.
pip uninstall -y ZConfig
pip install -e .
nosetests --with-xunit --with-xcoverage
coverage run setup.py -q test -q
coverage report -m
deps =
nose
coverage
nosexcover
{[testenv]deps}

0 comments on commit ad53779

Please sign in to comment.