Skip to content

Commit 504c997

Browse files
committed
Releasing v1.6.0
- Using pylibzim 1.1.0 - Updated tests to match new behavior (duplicates, title index)
1 parent 7ec55c4 commit 504c997

File tree

6 files changed

+26
-15
lines changed

6 files changed

+26
-15
lines changed

CHANGELOG.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,17 @@ All notable changes to this project are documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) (as of version 1.5.0).
77

8-
## [Unreleased]
8+
## [1.6.0] - 2022-05-23
99

10-
- n/a
10+
## Added
11+
12+
- `Archive.get_metadata_item()` to retrieve full item instead of just value
13+
14+
### Changed
15+
16+
- Using pylibzim v1.1.0 (using libzim 7.2.1)
17+
- Adding duplicate entries now raises RuntimeError
18+
- filesize is fixed for larger ZIMs
1119

1220
## [1.5.0] - 2022-05-09
1321

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
iso-639==0.4.5
1+
iso-639==0.4.5
22
requests>=2.25.1,<3.0
33
colorthief==0.2.1
44
python-resize-image>=1.1.19,<1.2
55
Babel>=2.9,<3.0
66
file-magic>=0.4.0,<0.5
7-
libzim>=1.0.0,<1.1
7+
libzim>=1.1.0,<1.2
88
beautifulsoup4>=4.9.3,<4.10
99
lxml>=4.6.3,<4.7
1010
optimize-images>=1.3.6,<1.6

src/zimscraperlib/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.5.0.post0
1+
1.6.0

tests/zim/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def build_data(tmp_path, png_image):
3939
redirects_file = tmp_path / "redirects.tsv"
4040
with open(redirects_file, "w") as fh:
4141
fh.write(" \tAccueil\tBienvenue !!\twelcome\n")
42-
fh.write(" \tAccueil\t\tcommons.png\n")
42+
fh.write(" \tAccueil2\t\tcommons.png\n")
4343
fh.write(" \timage\t\tcommons.png\n")
4444
build_dir = tmp_path / "build"
4545
return {

tests/zim/test_fs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ def test_make_zim_file_working(build_data, png_image):
7878
assert build_data["fpath"].exists()
7979
reader = Archive(build_data["fpath"])
8080
# welcome (actual) and two redirs
81-
assert reader.entry_count == 7 # includes redirect
81+
assert reader.entry_count == 8 # includes redirect
8282

8383
assert reader.get_item("style.css").mimetype == "text/css"
8484
assert reader.get_item("app.js").mimetype == "application/javascript"
85-
assert reader.get_suggestions_count("bienvenue") == 1
86-
assert reader.get_suggestions_count("coucou") == 0
87-
assert "Accueil" in list(reader.get_suggestions("bienvenue"))
85+
assert reader.get_suggestions_count("bienvenue") == 0
86+
assert reader.get_suggestions_count("coucou") == 1
87+
assert "welcome" in list(reader.get_suggestions("coucou"))
8888

8989

9090
def test_make_zim_file_exceptions_while_building(tmp_path, png_image, build_data):

tests/zim/test_zim_creator.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,13 @@ def test_zim_creator(tmp_path, png_image, html_file, html_str):
8383
# make sure we have our redirects
8484
assert reader.get_entry_by_path("home2").is_redirect
8585
assert reader.get_entry_by_path("home2").get_redirect_entry().path == f"{main_path}"
86-
# make sure titles were indexed (html with title for xapian)
86+
# make sure titles were indexed (html with title for xapian ; redirects are not)
8787
# see https://github.com/openzim/python-libzim/issues/125
88-
assert "home2" in list(reader.get_suggestions("Home !!"))
89-
assert "home3" in list(reader.get_suggestions("Home !!"))
90-
assert "home4" in list(reader.get_suggestions("Home !!"))
91-
assert "images/yahoo.png" not in list(reader.get_suggestions("Home !!"))
88+
# see https://github.com/openzim/libzim/issues/642
89+
assert "home2" not in list(reader.get_suggestions("Home !!")) # no is_front > False
90+
assert "home3" in list(reader.get_suggestions("Home !!")) # is_front=True
91+
assert "home4" not in list(reader.get_suggestions("Home !!")) # is_front=False
92+
assert "images/yahoo.png" in list(reader.get_suggestions("Home !!")) # is_frontTrue
9293
# make sure full text was indexed
9394
assert reader.get_search_results_count("PDF doc") >= 1
9495

@@ -278,6 +279,8 @@ def test_urlitem_nonhtmlgzip(tmp_path, gzip_nonhtml_url):
278279
fpath = tmp_path / "test.zim"
279280
with Creator(fpath) as creator:
280281
creator.add_item(URLItem(url=gzip_nonhtml_url))
282+
283+
with Creator(fpath) as creator:
281284
creator.add_item(URLItem(url=gzip_nonhtml_url, use_disk=True))
282285

283286
zim = Archive(fpath)

0 commit comments

Comments
 (0)