Skip to content

Commit baa3e9d

Browse files
committed
completely remove validate_zimfile_creatable function
1 parent cdb82f0 commit baa3e9d

File tree

3 files changed

+1
-56
lines changed

3 files changed

+1
-56
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Breaking Changes
1111

1212
- Renamed `filesystem.validate_zimfile_creatable` to `filesystem.file_creatable` to reflect general applicability to check file creation beyond ZIM files #200
13-
- Remove any "ZIM" reference in exceptions while working with files.
13+
- Remove any "ZIM" reference in exceptions while working with files #200
1414

1515
### Added
1616

src/zimscraperlib/zim/filesystem.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import pathlib
3333
import re
3434
import tempfile
35-
import warnings
3635
from collections.abc import Sequence
3736

3837
from zimscraperlib import logger
@@ -306,25 +305,3 @@ def validate_file_creatable(folder: str | pathlib.Path, filename: str):
306305
fpath.unlink()
307306
except Exception as exc:
308307
raise IncorrectFilenameError(f"File is not creatable: {fpath}") from exc
309-
310-
311-
def validate_zimfile_creatable(folder: str | pathlib.Path, filename: str):
312-
"""Validate that a ZIM can be created in given folder with given filename
313-
314-
Any problem encountered raises an exception inheriting from IncorrectPathError
315-
316-
Checks that:
317-
- folder passed exists (or raise MissingFolderError exception)
318-
- folder passed is a directory (or raise NotADirectoryFolderError exception)
319-
- folder is writable, i.e. it is possible to create a file in folder (or raise
320-
NotWritableFolderError exception with inner exception details)
321-
- filename is creatable, i.e. there is no bad characters in filename (or raise
322-
IncorrectFilenameError exception with inner exception details)
323-
"""
324-
warnings.warn(
325-
"'validate_zimfile_creatable' is deprecated and will be removed. "
326-
"Use 'validate_file_creatable` to ensure future compatibility.",
327-
DeprecationWarning,
328-
stacklevel=2,
329-
)
330-
validate_file_creatable(folder, filename)

tests/zim/test_fs.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
make_zim_file,
1919
validate_file_creatable,
2020
validate_folder_writable,
21-
validate_zimfile_creatable,
2221
)
2322

2423

@@ -173,37 +172,6 @@ def valid_zim_filename():
173172
return "myfile.zim"
174173

175174

176-
def test_validate_zimfile_creatable_ok(tmp_path, valid_zim_filename):
177-
178-
validate_zimfile_creatable(tmp_path, valid_zim_filename)
179-
180-
181-
def test_validate_zimfile_creatable_folder_not_exists(tmp_path, valid_zim_filename):
182-
183-
with pytest.raises(MissingFolderError):
184-
validate_zimfile_creatable(tmp_path / "foo", valid_zim_filename)
185-
186-
187-
def test_validate_zimfile_creatable_bad_folder(tmp_path, valid_zim_filename):
188-
189-
with pytest.raises(NotADirectoryFolderError):
190-
(tmp_path / "foo.txt").touch()
191-
validate_zimfile_creatable(tmp_path / "foo.txt", valid_zim_filename)
192-
193-
194-
def test_validate_zimfile_creatable_folder_not_writable(tmp_path, valid_zim_filename):
195-
196-
with pytest.raises(NotWritableFolderError):
197-
(tmp_path / "foo").mkdir(mode=111)
198-
validate_zimfile_creatable(tmp_path / "foo", valid_zim_filename)
199-
200-
201-
def test_validate_zimfile_creatable_bad_name(tmp_path):
202-
203-
with pytest.raises(IncorrectFilenameError):
204-
validate_zimfile_creatable(tmp_path, "t\0t\0.zim")
205-
206-
207175
def test_validate_folder_writable_not_exists(tmp_path):
208176

209177
with pytest.raises(MissingFolderError):

0 commit comments

Comments
 (0)