Skip to content

Commit

Permalink
make ruff happy
Browse files Browse the repository at this point in the history
  • Loading branch information
brisvag committed Apr 5, 2024
1 parent b7d2036 commit 5591658
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/npe2/manifest/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,9 @@ def _from_entrypoint(
entry_point: metadata.EntryPoint,
distribution: Optional[metadata.Distribution] = None,
) -> PluginManifest:
assert (match := entry_point.pattern.match(entry_point.value))
match = entry_point.pattern.match(entry_point.value)
assert match

module = match.group("module")

spec = util.find_spec(module or "")
Expand All @@ -395,7 +397,8 @@ def _from_entrypoint(
f"entrypoint: {entry_point.value!r}"
)

assert (match := entry_point.pattern.match(entry_point.value))
match = entry_point.pattern.match(entry_point.value)
assert match
fname = match.group("attr")

for loc in spec.submodule_search_locations or []:
Expand Down
6 changes: 4 additions & 2 deletions tests/test_tmp_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,11 @@ def test_temporary_plugin_spawn(tmp_plugin: DynamicPlugin):
assert new.name == "another-name"
assert new.display_name == "another-name"
assert new.plugin_manager == tmp_plugin.plugin_manager
t1 = tmp_plugin.spawn(register=True)
t2 = tmp_plugin.spawn()

assert (t1 := tmp_plugin.spawn(register=True)).name == f"{tmp_plugin.name}-1"
assert (t2 := tmp_plugin.spawn()).name == f"{tmp_plugin.name}-2"
assert t1.name == f"{tmp_plugin.name}-1"
assert t2.name == f"{tmp_plugin.name}-2"

assert t1.name in tmp_plugin.plugin_manager._manifests
assert t2.name not in tmp_plugin.plugin_manager._manifests

0 comments on commit 5591658

Please sign in to comment.