diff --git a/fsspec/implementations/jupyter.py b/fsspec/implementations/jupyter.py index 2839f4c1f..711690c69 100644 --- a/fsspec/implementations/jupyter.py +++ b/fsspec/implementations/jupyter.py @@ -42,7 +42,7 @@ def ls(self, path, detail=True, **kwargs): path = self._strip_protocol(path) r = self.session.get(f"{self.url}/{path}") if r.status_code == 404: - return FileNotFoundError(path) + raise FileNotFoundError(path) r.raise_for_status() out = r.json() @@ -63,7 +63,7 @@ def cat_file(self, path, start=None, end=None, **kwargs): path = self._strip_protocol(path) r = self.session.get(f"{self.url}/{path}") if r.status_code == 404: - return FileNotFoundError(path) + raise FileNotFoundError(path) r.raise_for_status() out = r.json() if out["format"] == "text": diff --git a/fsspec/implementations/tests/test_jupyter.py b/fsspec/implementations/tests/test_jupyter.py index 9b2eaa9c9..501d19ebf 100644 --- a/fsspec/implementations/tests/test_jupyter.py +++ b/fsspec/implementations/tests/test_jupyter.py @@ -42,6 +42,11 @@ def test_simple(jupyter): fs = fsspec.filesystem("jupyter", url=url) assert fs.ls("") == [] + with pytest.raises(FileNotFoundError): + fs.ls("not-exist") + with pytest.raises(FileNotFoundError): + fs.cat("not-exist") + fs.pipe("afile", b"data") assert fs.cat("afile") == b"data" assert "afile" in os.listdir(d)