diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..1a52da1 --- /dev/null +++ b/.coveragerc @@ -0,0 +1,3 @@ +[run] +branch = True +omit = venv/, test/ diff --git a/.gitignore b/.gitignore index b6dede0..f28f7f8 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ package-lock.json htmlcov/ .coverage .pytest_cache/ +venv/ diff --git a/test/test_utils.py b/test/test_utils.py index 61ccfa4..2e8ad61 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -34,10 +34,13 @@ def mock_input(s): def test_sanitize_as_empty_string(): string = 'asopdfha' - string2 = None string = utils.sanitize_as_empty_string(string) + if not string == 'asopdfha': + raise AssertionError() + + string2 = None string2 = utils.sanitize_as_empty_string(string2) - if not (string == 'asopdfha' and string2 == ''): + if not string2 == '': raise AssertionError() @@ -50,6 +53,13 @@ def test_gen_co_author(): if not arg2 == '': raise AssertionError() + +def test_debug(capsys): + utils.debug('msg', 666, show=True) + captured = capsys.readouterr() + if not captured.out == "DEBUG-> msg: 666\n": + raise AssertionError() + # FIXME # def test_create_file(tmpdir): # test_file = tmpdir.mkdir('test').join('commiter.yml') diff --git a/utils.py b/utils.py index df8519d..e7c2563 100644 --- a/utils.py +++ b/utils.py @@ -37,7 +37,7 @@ def gen_co_author(co_author): return "\nCo-authored-by: %s" % co_author -def create_file(convention_name, dont_create=False): +def create_file(convention_name, dont_create=False): # pragma: no cover if not dont_create: data = dict( convention=convention_name