Skip to content

Commit 674d3fb

Browse files
committed
Exclude some test code that doesn't need coverage
1 parent 9d2a90a commit 674d3fb

File tree

7 files changed

+11
-8
lines changed

7 files changed

+11
-8
lines changed

paths_cli/tests/commands/test_md.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ def test_md_main(md_fixture, inp):
159159
nsteps, ensembles = 5, None
160160
elif inp == 'ensemble':
161161
nsteps, ensembles = None, [ens]
162-
else:
162+
else: # -no-cov-
163163
raise RuntimeError("pytest went crazy")
164164

165165
traj, foo = md_main(

paths_cli/tests/commands/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import traceback
22

33
def assert_click_success(result):
4-
if result.exit_code != 0:
4+
if result.exit_code != 0: # -no-cov- (only occurs on test error)
55
print(result.output)
66
traceback.print_tb(result.exc_info[2])
77
print(result.exc_info[0], result.exc_info[1])

paths_cli/tests/compiling/test_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ def _validate_obj(obj, input_type):
332332
assert obj == 'bar'
333333
elif input_type == 'dict':
334334
assert obj.data == 'qux'
335-
else:
335+
else: # -no-cov-
336336
raise RuntimeError("Error in test setup")
337337

338338
@pytest.mark.parametrize('input_type', ['str', 'dict'])

paths_cli/tests/test_file_copying.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ def __init__(self):
5959
self.previously_seen = set([])
6060

6161
def __call__(self, snap):
62-
if snap in self.previously_seen:
62+
if snap in self.previously_seen: # -no-cov-
63+
# this is only covered if an error occurs
6364
raise AssertionError("Second CV eval for " + str(snap))
6465
self.previously_seen.update({snap})
6566
return snap.xyz[0][0]

paths_cli/tests/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
try:
55
urllib.request.urlopen('https://www.google.com')
6-
except:
6+
except: # -no-cov-
77
HAS_INTERNET = False
88
else:
99
HAS_INTERNET = True
1010

1111
def assert_url(url):
12-
if not HAS_INTERNET:
12+
if not HAS_INTERNET: # -no-cov-
1313
pytest.skip("Internet connection seems faulty")
1414

1515
# TODO: On a 404 this will raise a urllib.error.HTTPError. It would be

paths_cli/tests/wizard/mock_wizard.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ def input(self, content):
3030
self.input_call_count += 1
3131
try:
3232
user_input = next(self._input_iter)
33-
except StopIteration as e:
33+
except StopIteration as e: # -no-cov-
34+
# this only occurs on a test error and provides diagnostic
35+
# information
3436
print(self.log_text)
3537
raise e
3638

paths_cli/tests/wizard/test_load_from_ops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def __getitem__(self, key):
2525
return self._objects[key]
2626
elif isinstance(key, str):
2727
return self._named_objects[key]
28-
else:
28+
else: # -nocov-
2929
raise TypeError("Huh?")
3030

3131
def __iter__(self):

0 commit comments

Comments
 (0)