-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
correct entry-points and add respective test-case
- Loading branch information
Showing
2 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import unittest | ||
from importlib.metadata import entry_points | ||
from typing import Callable | ||
|
||
|
||
class TestEntryPoints(unittest.TestCase): | ||
|
||
def test_entry_points(self) -> None: | ||
""" | ||
Test iblrig's console_scripts entry points | ||
The method collects the names and loaded entry points of iblrig scripts | ||
and performs assertions or checks based on the loaded entry points. | ||
Raises: | ||
AssertionError: If loaded entry points are not callable. | ||
""" | ||
iblrig_scripts = [] | ||
for ep in entry_points(group='console_scripts'): | ||
if ep.value.startswith('iblrig.'): | ||
try: | ||
loaded_ep = ep.load() | ||
iblrig_scripts.append((ep.name, loaded_ep)) | ||
except Exception as e: | ||
print(f"Error loading entry point '{ep.name}': {str(e)}") | ||
|
||
assert all(isinstance(script[1], Callable) for script in iblrig_scripts), "Loaded entry points are not callable." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters