Skip to content

Commit

Permalink
paquo: remove dead code rare error conditions from coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ap-- committed Aug 3, 2020
1 parent 8917db3 commit 13118e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion paquo/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ def __init__(self, getter):

def __get__(self, obj, objtype=None):
if obj is None:
return self
return self # pragma: no cover
value = obj.__dict__[self.name] = self.getter(obj)
return value
10 changes: 3 additions & 7 deletions paquo/jpype_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ def find_qupath(*,
search_dirs = chain(search_dirs, [conda_search_dir])

for qupath_dir in search_dirs:
if qupath_dir is None:
continue
if isinstance(qupath_dir, str):
qupath_dir = Path(qupath_dir)
try:
return qupath_jvm_info_from_qupath_dir(qupath_dir, java_opts)
except FileNotFoundError:
Expand Down Expand Up @@ -155,7 +151,7 @@ def start_jvm(finder: Optional[Callable[..., QuPathJVMInfo]] = None,
finder = find_qupath

if finder_kwargs is None:
finder_kwargs = {}
finder_kwargs = {} # pragma: no cover

# For the time being, we assume qupath is our JVM of choice
app_dir, runtime_dir, jvm_path, jvm_options = finder(**finder_kwargs)
Expand All @@ -168,7 +164,7 @@ def start_jvm(finder: Optional[Callable[..., QuPathJVMInfo]] = None,
ignoreUnrecognized=False,
convertStrings=False
)
except RuntimeError as jvm_error:
except RuntimeError as jvm_error: # pragma: no cover
# there's a chance that this RuntimeError occurred because a user provided
# jvm_option is incorrect. let's try if that is the case and crash with a
# more verbose error message
Expand All @@ -190,7 +186,7 @@ def start_jvm(finder: Optional[Callable[..., QuPathJVMInfo]] = None,
# we'll do this explicitly here to verify the QuPath version
try:
_version = str(JClass("qupath.lib.common.GeneralTools").getVersion())
except (TypeError, AttributeError):
except (TypeError, AttributeError): # pragma: no cover
version = _QUPATH_VERSION = None
else:
version = _QUPATH_VERSION = LooseVersion(_version)
Expand Down

0 comments on commit 13118e4

Please sign in to comment.