increase test coverage

This commit is contained in:
Alan Hamlett 2015-08-12 11:04:11 -07:00
parent f818a64d3d
commit 4eab860dc0
4 changed files with 16 additions and 6 deletions

View file

@ -5,3 +5,11 @@ api_url = https://api.wakatime.com/api/v1/heartbeats
ignore =
COMMIT_EDITMSG$
TAG_EDITMSG$
exclude =
excludeme
\(invalid regex)
include =
\(invalid regex)
includeme
offline = true
hidefilenames = true

View file

@ -0,0 +1,2 @@
first line
second line

View file

@ -29,7 +29,7 @@ class BaseTestCase(utils.TestCase):
response = Response()
response.status_code = 201
mock_requests.return_value = response
args = ['--file', 'tests/samples/emptyfile.txt', '--key', '123', '--config', 'foo']
args = ['--file', 'tests/samples/twolinefile.txt', '--key', '123', '--config', 'foo']
retval = main(args)
self.assertEquals(retval, 0)
expected_stdout = u("Error: Could not read from config file foo\n")
@ -45,7 +45,7 @@ class BaseTestCase(utils.TestCase):
self.assertEquals(sys.stdout.getvalue(), expected_stdout)
self.assertEquals(sys.stderr.getvalue(), expected_stderr)
def test_parse_config_file(self, mock_requests):
def test_config_file(self, mock_requests):
response = Response()
response.status_code = 201
mock_requests.return_value = response
@ -55,7 +55,7 @@ class BaseTestCase(utils.TestCase):
self.assertEquals(sys.stdout.getvalue(), '')
self.assertEquals(sys.stderr.getvalue(), '')
def test_parse_bad_config_file(self, mock_requests):
def test_bad_config_file(self, mock_requests):
args = ['--file', 'tests/samples/emptyfile.txt', '--config', 'tests/samples/bad_config.cfg']
retval = main(args)
self.assertEquals(retval, 103)

View file

@ -224,7 +224,7 @@ def should_exclude(fileName, include, exclude):
msg=u(ex),
pattern=u(pattern),
))
except TypeError:
except TypeError: # pragma: nocover
pass
try:
for pattern in exclude:
@ -237,7 +237,7 @@ def should_exclude(fileName, include, exclude):
msg=u(ex),
pattern=u(pattern),
))
except TypeError:
except TypeError: # pragma: nocover
pass
return False