Skip to content

Commit

Permalink
Refine testing a little
Browse files Browse the repository at this point in the history
  • Loading branch information
Myoldmopar committed Apr 24, 2023
1 parent bd75db4 commit f653c72
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
11 changes: 6 additions & 5 deletions plan_tools/entry_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ def get_pip_entry_point_exe_dir(self) -> Path:
global_scripts_dir = Path(get_path('scripts'))
user_exe = user_scripts_dir / self.installed_binary_name
global_exe = global_scripts_dir / self.installed_binary_name
if user_exe.exists() and global_exe.exists():
if user_exe.exists() and global_exe.exists(): # pragma: no cover
# I'm going to allow this to be uncovered because it will be awkward to get this set up properly
print(f"Detected the {self.installed_binary_name} binary in both user and global locations.")
print("Due to this ambiguity, I cannot figure out to which one I should link.")
print(f"User install location: {user_exe}")
Expand All @@ -217,10 +218,10 @@ def get_pip_entry_point_exe_dir(self) -> Path:
elif global_exe.exists():
return global_scripts_dir
else:
print(f"Could not find {self.installed_binary_name} binary at either user or global location.")
print("This is weird since you are running this script...did you actually pip install this tool?")
print("Make sure to pip install the tool and then retry")
raise Exception("Could not find executable at user or global location")
msg = f"Could not find {self.installed_binary_name} binary at either user or global location."
msg += "This is weird since you are running this script...did you actually pip install this tool?"
msg += "Make sure to pip install the tool and then retry"
raise Exception(msg)

def get_package_icon_for_link(self):
if system() == 'Windows':
Expand Down
2 changes: 1 addition & 1 deletion plan_tools/tests/test_entry_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_entry_point_success(self):
self.assertIn('plist_path', e.desktop_file_data_check)
self.assertIn('plist_contents', e.desktop_file_data_check)

def test_entry_point_failure(self):
def test_entry_point_cannot_find_binary(self):
e = EntryPoint("does not matter", "does not exist!", "Nice Name", "Descriptive", "wm-class", test_mode=True)
with self.assertRaises(Exception):
e.get_pip_entry_point_exe_dir()

0 comments on commit f653c72

Please sign in to comment.