Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Exclude some test code that doesn't need coverage
  • Loading branch information
dwhswenson committed Nov 13, 2021
commit 674d3fb43655d21bbdaeea97eb99ed46bc4d0a36
2 changes: 1 addition & 1 deletion paths_cli/tests/commands/test_md.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ def test_md_main(md_fixture, inp):
nsteps, ensembles = 5, None
elif inp == 'ensemble':
nsteps, ensembles = None, [ens]
else:
else: # -no-cov-
raise RuntimeError("pytest went crazy")

traj, foo = md_main(
Expand Down
2 changes: 1 addition & 1 deletion paths_cli/tests/commands/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import traceback

def assert_click_success(result):
if result.exit_code != 0:
if result.exit_code != 0: # -no-cov- (only occurs on test error)
print(result.output)
traceback.print_tb(result.exc_info[2])
print(result.exc_info[0], result.exc_info[1])
Expand Down
2 changes: 1 addition & 1 deletion paths_cli/tests/compiling/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def _validate_obj(obj, input_type):
assert obj == 'bar'
elif input_type == 'dict':
assert obj.data == 'qux'
else:
else: # -no-cov-
raise RuntimeError("Error in test setup")

@pytest.mark.parametrize('input_type', ['str', 'dict'])
Expand Down
3 changes: 2 additions & 1 deletion paths_cli/tests/test_file_copying.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def __init__(self):
self.previously_seen = set([])

def __call__(self, snap):
if snap in self.previously_seen:
if snap in self.previously_seen: # -no-cov-
# this is only covered if an error occurs
raise AssertionError("Second CV eval for " + str(snap))
self.previously_seen.update({snap})
return snap.xyz[0][0]
Expand Down
4 changes: 2 additions & 2 deletions paths_cli/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

try:
urllib.request.urlopen('https://www.google.com')
except:
except: # -no-cov-
HAS_INTERNET = False
else:
HAS_INTERNET = True

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

# TODO: On a 404 this will raise a urllib.error.HTTPError. It would be
Expand Down
4 changes: 3 additions & 1 deletion paths_cli/tests/wizard/mock_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ def input(self, content):
self.input_call_count += 1
try:
user_input = next(self._input_iter)
except StopIteration as e:
except StopIteration as e: # -no-cov-
# this only occurs on a test error and provides diagnostic
# information
print(self.log_text)
raise e

Expand Down
2 changes: 1 addition & 1 deletion paths_cli/tests/wizard/test_load_from_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __getitem__(self, key):
return self._objects[key]
elif isinstance(key, str):
return self._named_objects[key]
else:
else: # -nocov-
raise TypeError("Huh?")

def __iter__(self):
Expand Down