Skip to content

Commit af7bd40

Browse files
authored
merge(#45): test utils.py
Test utils
2 parents a1b35a9 + 92369c6 commit af7bd40

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

.coveragerc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[run]
2+
branch = True
3+
omit = venv/, test/

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ package-lock.json
66
htmlcov/
77
.coverage
88
.pytest_cache/
9+
venv/

test/test_utils.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,13 @@ def mock_input(s):
3434

3535
def test_sanitize_as_empty_string():
3636
string = 'asopdfha'
37-
string2 = None
3837
string = utils.sanitize_as_empty_string(string)
38+
if not string == 'asopdfha':
39+
raise AssertionError()
40+
41+
string2 = None
3942
string2 = utils.sanitize_as_empty_string(string2)
40-
if not (string == 'asopdfha' and string2 == ''):
43+
if not string2 == '':
4144
raise AssertionError()
4245

4346

@@ -50,6 +53,13 @@ def test_gen_co_author():
5053
if not arg2 == '':
5154
raise AssertionError()
5255

56+
57+
def test_debug(capsys):
58+
utils.debug('msg', 666, show=True)
59+
captured = capsys.readouterr()
60+
if not captured.out == "DEBUG-> msg: 666\n":
61+
raise AssertionError()
62+
5363
# FIXME
5464
# def test_create_file(tmpdir):
5565
# test_file = tmpdir.mkdir('test').join('commiter.yml')

utils.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def gen_co_author(co_author):
3737
return "\nCo-authored-by: %s" % co_author
3838

3939

40-
def create_file(convention_name, dont_create=False):
40+
def create_file(convention_name, dont_create=False): # pragma: no cover
4141
if not dont_create:
4242
data = dict(
4343
convention=convention_name

0 commit comments

Comments
 (0)