diff --git a/npe2/cli.py b/npe2/cli.py index 05ca303c..165e6654 100644 --- a/npe2/cli.py +++ b/npe2/cli.py @@ -386,7 +386,7 @@ def fetch( manifest_string = getattr(mf, fmt.value)(**kwargs) if output: - output.write_text(manifest_string) + output.write_text(manifest_string, encoding="utf-8") else: _pprint_formatted(manifest_string, fmt) diff --git a/npe2/manifest/_bases.py b/npe2/manifest/_bases.py index 3162f94f..f7ddca06 100644 --- a/npe2/manifest/_bases.py +++ b/npe2/manifest/_bases.py @@ -80,7 +80,7 @@ def from_file(cls, path: Union[Path, str]): else: raise ValueError(f"unrecognized file extension: {path}") # pragma: no cover - with open(path) as f: + with open(path, encoding="utf-8") as f: data = loader(f) or {} if path.name == "pyproject.toml": diff --git a/tests/test_fetch.py b/tests/test_fetch.py index cc5f964f..0d6748f2 100644 --- a/tests/test_fetch.py +++ b/tests/test_fetch.py @@ -94,7 +94,7 @@ def test_get_manifest_from_wheel(tmp_path): def test_get_hub_plugins(): plugins = get_hub_plugins() - assert "napari-svg" in plugins + assert len(plugins) > 0 def test_get_hub_plugin(): @@ -103,8 +103,8 @@ def test_get_hub_plugin(): def test_get_pypi_plugins(): - info = get_pypi_plugins() - assert "napari-svg" in info + plugins = get_pypi_plugins() + assert len(plugins) > 0 @pytest.mark.skipif(not os.getenv("CI"), reason="slow, only run on CI")