diff --git a/planemo/shed/__init__.py b/planemo/shed/__init__.py index b398728b6..03c414c3a 100644 --- a/planemo/shed/__init__.py +++ b/planemo/shed/__init__.py @@ -533,11 +533,7 @@ def _find_repository_id(ctx, shed_context, name, repo_config, **kwds): owner = _owner(ctx, repo_config, shed_context, **kwds) matching_repository = find_repository(shed_context.tsi, owner, name) if matching_repository is None: - if not kwds.get("allow_none", False): - message = "Failed to find repository for owner/name %s/%s" - raise Exception(message % (owner, name)) - else: - return None + raise Exception(f"Failed to find repository for owner/name {owner}/{name}") else: repo_id = matching_repository["id"] return repo_id @@ -1237,7 +1233,6 @@ def find_repository_id(self, ctx, shed_context): shed_context, name=self.name, repo_config=self.config, - allow_none=True, ) return repo_id except Exception as e: diff --git a/tests/shed_app_test_utils.py b/tests/shed_app_test_utils.py index 903b90bcc..1990d5edf 100644 --- a/tests/shed_app_test_utils.py +++ b/tests/shed_app_test_utils.py @@ -1,6 +1,6 @@ import contextlib -import multiprocessing import shutil +import threading from tempfile import mkdtemp from typing import NamedTuple @@ -39,10 +39,10 @@ def run(): app.config["model"] = model run_simple("localhost", port, app, use_reloader=False, use_debugger=True) - p = multiprocessing.Process(target=run) - p.start() + t = threading.Thread(target=run, daemon=True) + t.start() network_util.wait_net_service("localhost", port, DEFAULT_OP_TIMEOUT) - return MockShed(f"http://localhost:{port}", directory, p, model) + return MockShed(f"http://localhost:{port}", directory, t, model) @contextlib.contextmanager @@ -59,11 +59,11 @@ def mock_shed(): class MockShed(NamedTuple): url: str directory: str - process: multiprocessing.Process + thread: threading.Thread model: InMemoryShedDataModel def shutdown(self): - self.process.terminate() + self.thread.join(timeout=1) shutil.rmtree(self.directory) diff --git a/tests/test_shed_operations.py b/tests/test_shed_operations.py index c7c72bad3..51466b31e 100644 --- a/tests/test_shed_operations.py +++ b/tests/test_shed_operations.py @@ -21,14 +21,6 @@ def test_find_repository_id(): assert repo_id == "r1" -def test_find_repository_id_missing(): - with mock_shed_context() as shed_context: - repo_id = shed.find_repository_id( - ctx=None, shed_context=shed_context, path=".", name="test_repo_absent", owner="iuc", allow_none=True - ) - assert repo_id is None - - def test_find_repository_id_missing_exception(): with mock_shed_context() as shed_context: exception = None