Skip to content

Commit 78827bf

Browse files
authored
merge(#44): adds coverage to project
Coverage configuration for project
2 parents 536a7d3 + 5663e38 commit 78827bf

File tree

6 files changed

+19
-13
lines changed

6 files changed

+19
-13
lines changed

.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,10 @@ install:
88
script:
99
- pytest test/ -v
1010
- pycodestyle *.py
11+
after_script:
12+
- py.test --cov-report term --cov=.
13+
- codeclimate-test-reporter
14+
- coverage xml
15+
- python-codacy-coverage -r coverage.xml
1116
notification:
1217
email: false

conventions/symphony_cmf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
def symphony_convention(tag, msg):
22
tag = tag.capitalize()
33
composed = "[%s] %s\n" % (tag, msg)
4+
return composed

generator.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,18 @@ def main(debug_mode=False):
3535
convention = 'none'
3636

3737
if convention == 'none':
38+
print('You are not using a convention')
3839
commit_message = just_message()
3940

4041
else:
42+
print('You are using the %s convention' % convention)
4143
tag, msg = get_text()
4244
if convention == 'angular' or convention == 'karma':
43-
print('You are using the %s convention' % convention)
4445
context = get_context()
4546
commit_message = angular_convention(tag, msg, context)
4647
elif convention == 'changelog':
47-
print('You are using the %s convention' % convention)
4848
commit_message = changelog_convention(tag, msg)
4949
elif convention == 'symphony':
50-
print('You are using the %s convention' % convention)
5150
commit_message = symphony_convention(tag, msg)
5251

5352
commit_message += gen_co_author(args.co_author)
@@ -88,7 +87,8 @@ def main(debug_mode=False):
8887
parser.print_help()
8988

9089

91-
parser = parser_cli()
92-
args = parser.parse_args()
93-
debug('args variable', args, args.debug)
94-
main(args.debug)
90+
if __name__ == '__main__':
91+
parser = parser_cli()
92+
args = parser.parse_args()
93+
debug('args variable', args, args.debug)
94+
main(args.debug)

requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@ pyyaml==3.13
22
pytest==3.8.1
33
pycodestyle==2.4.0
44
argparse==1.4.0
5+
coverage==4.3
6+
pytest-cov==2.0.0
7+
codeclimate-test-reporter
8+
codacy-coverage==1.3

test/test_conventions.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,36 @@
77

88
def test_angular_convention_with_context():
99
message = angular.angular_convention('TAG', 'message', 'context')
10-
1110
if not ('tag(context): message\n'):
1211
raise AssertionError()
1312

1413

1514
def test_angular_convention_without_context():
1615
message = angular.angular_convention('tag', 'message', '')
17-
1816
if not ('tag: message\n'):
1917
raise AssertionError()
2018

2119

2220
def test_changelog_convention():
2321
message = changelog.changelog_convention('tag', 'message')
24-
2522
if not ('TAG: message\n'):
2623
raise AssertionError()
2724

2825

2926
def test_symphony_convention():
3027
message = symphony.symphony_convention('tag', 'message')
31-
3228
if not ('[Tag] message\n'):
3329
raise AssertionError()
3430

3531

3632
def test_no_convention():
3733
inputs = [
38-
"message",
34+
"message",
3935
]
4036

4137
def mock_input(s):
4238
return inputs.pop(0)
4339
no_convention.input = mock_input
44-
4540
message = no_convention.just_message()
4641
if not message == 'Message\n':
4742
raise AssertionError()

test/test_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ def test_get_text():
1010

1111
def mock_input(s):
1212
return inputs.pop(0)
13+
1314
utils.input = mock_input
1415
a, b = utils.get_text()
1516
if not a == 'tag':

0 commit comments

Comments
 (0)