1 |
commit: f01e1e5a83d0a3bcb57bc28521490390398380e7 |
2 |
Author: John Helmert III <ajak <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Oct 17 14:24:05 2021 +0000 |
4 |
Commit: John Helmert III <ajak <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Oct 17 16:08:06 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f01e1e5a |
7 |
|
8 |
www-misc/buku: drop 4.5 |
9 |
|
10 |
Signed-off-by: John Helmert III <ajak <AT> gentoo.org> |
11 |
|
12 |
www-misc/buku/Manifest | 1 - |
13 |
www-misc/buku/buku-4.5.ebuild | 95 ----- |
14 |
www-misc/buku/files/buku-4.5-hypothesis-fix.patch | 494 ---------------------- |
15 |
3 files changed, 590 deletions(-) |
16 |
|
17 |
diff --git a/www-misc/buku/Manifest b/www-misc/buku/Manifest |
18 |
index 128a7832af2..535588ada18 100644 |
19 |
--- a/www-misc/buku/Manifest |
20 |
+++ b/www-misc/buku/Manifest |
21 |
@@ -1,2 +1 @@ |
22 |
-DIST buku-4.5.tar.gz 488913 BLAKE2B 29ed93fa9af4503f72a711889fbf17d86bcde1bc1abbfc88242c4ebd18f1c1a57077781eebdd79d9d993078d2f5b5883c9a0ec4fee94e37c0e7bfb727c5154d0 SHA512 7bbb598d5c970e8e594d58c0a18f9b85245d4a214c01d64b537a5ccaadab32c964521046b90754c2f2c721bf816dc7f4438cfeff3a7e7eec75ce958cc41dfa7d |
23 |
DIST buku-4.6.tar.gz 491809 BLAKE2B 82597b845c56dadf1cc6973d1f3ce6cc4970230d08ac700cf286a8c41420144fb1f42817ab808041600ab8414d96f3a3883c1bd8fbe89f29570d877a495dcd96 SHA512 1c46006d8c950811493a8c11453d51557cac3f6346ea28d66dcb2ae3e4c52727af7349b4b6ea088f9c08a7e9d09e3a4d80679b41497b6cd0844d811f81c9811a |
24 |
|
25 |
diff --git a/www-misc/buku/buku-4.5.ebuild b/www-misc/buku/buku-4.5.ebuild |
26 |
deleted file mode 100644 |
27 |
index 378cb5f498b..00000000000 |
28 |
--- a/www-misc/buku/buku-4.5.ebuild |
29 |
+++ /dev/null |
30 |
@@ -1,95 +0,0 @@ |
31 |
-# Copyright 1999-2021 Gentoo Authors |
32 |
-# Distributed under the terms of the GNU General Public License v2 |
33 |
- |
34 |
-EAPI=7 |
35 |
- |
36 |
-PYTHON_COMPAT=( python3_{7,8,9} ) |
37 |
-PYTHON_REQ_USE="sqlite" |
38 |
-DISTUTILS_USE_SETUPTOOLS=rdepend |
39 |
- |
40 |
-inherit bash-completion-r1 distutils-r1 |
41 |
- |
42 |
-DESCRIPTION="Powerful command-line bookmark manager" |
43 |
-HOMEPAGE="https://github.com/jarun/buku" |
44 |
-SRC_URI="https://github.com/jarun/${PN}/archive/v$(ver_cut 1-2).tar.gz -> ${P}.tar.gz" |
45 |
- |
46 |
-LICENSE="GPL-3" |
47 |
-SLOT="0" |
48 |
-KEYWORDS="~amd64 ~x86" |
49 |
-IUSE="test" |
50 |
-RESTRICT="!test? ( test )" |
51 |
- |
52 |
-RDEPEND=" |
53 |
- >=dev-python/beautifulsoup4-4.6.0[${PYTHON_USEDEP}] |
54 |
- dev-python/cryptography[${PYTHON_USEDEP}] |
55 |
- >=dev-python/html5lib-1.0.1[${PYTHON_USEDEP}] |
56 |
- dev-python/urllib3[${PYTHON_USEDEP}] |
57 |
-" |
58 |
-DEPEND="${RDEPEND} |
59 |
- test? ( |
60 |
- dev-python/attrs[${PYTHON_USEDEP}] |
61 |
- >=dev-python/click-7.0[${PYTHON_USEDEP}] |
62 |
- dev-python/hypothesis[${PYTHON_USEDEP}] |
63 |
- >=dev-python/py-1.5.0[${PYTHON_USEDEP}] |
64 |
- dev-python/pytest[${PYTHON_USEDEP}] |
65 |
- >=dev-python/pyyaml-4.2[${PYTHON_USEDEP}] |
66 |
- >=dev-python/vcrpy-4.0.2[${PYTHON_USEDEP}] |
67 |
- ) |
68 |
-" |
69 |
- |
70 |
-PATCHES=( |
71 |
- "${FILESDIR}/${P}-hypothesis-fix.patch" |
72 |
-) |
73 |
- |
74 |
-python_prepare_all() { |
75 |
- # Remove support for bukuserver - complex depgraph which isn't all |
76 |
- # sufficiently packaged in Gentoo |
77 |
- sed -ie '/console_scripts/s/,.*/]/' setup.py || die |
78 |
- sed -ie 's/.*bukuserver.*//' tests/test_views.py || die |
79 |
- sed -ie 's/.*flask.*//' tests/test_views.py || die |
80 |
- |
81 |
- distutils-r1_python_prepare_all |
82 |
-} |
83 |
- |
84 |
-python_install_all() { |
85 |
- distutils-r1_python_install_all |
86 |
- |
87 |
- insinto /usr/share/zsh/site-functions |
88 |
- doins auto-completion/zsh/_* |
89 |
- |
90 |
- newbashcomp auto-completion/bash/buku-completion.bash "${PN}" |
91 |
- |
92 |
- doman buku.1 |
93 |
-} |
94 |
- |
95 |
-python_test() { |
96 |
- local skipped_tests=( |
97 |
- # Disable tests related to bukuserver |
98 |
- tests/test_setup.py::test_bukuserver_requirement |
99 |
- tests/test_views.py::test_bmv_create_form |
100 |
- tests/test_views.py::test_bookmark_model_view |
101 |
- tests/test_views.py::test_load_firefox_database |
102 |
- tests/test_views.py::test_tag_model_view_get_list |
103 |
- tests/test_views.py::test_tag_model_view_get_list_empty_db |
104 |
- |
105 |
- # Broken with network-sandbox |
106 |
- tests/test_buku.py::test_network_handler_with_url |
107 |
- tests/test_bukuDb.py::TestBukuDb::test_tnyfy_url |
108 |
- tests/test_bukuDb.py::test_add_rec_exec_arg |
109 |
- tests/test_bukuDb.py::test_load_firefox |
110 |
- tests/test_bukuDb.py::test_print_db |
111 |
- tests/test_bukuDb.py::test_print_rec |
112 |
- tests/test_bukuDb.py::test_refreshdb |
113 |
- |
114 |
- # Hard to debug sandbox issue - these pass when run outside portage |
115 |
- # There also appears to be some state issue between these, because |
116 |
- # skipping one can result in a later one failing. |
117 |
- tests/test_bukuDb.py::test_delete_rec_index_and_delay_commit[1-True-False] |
118 |
- tests/test_bukuDb.py::test_delete_rec_index_and_delay_commit[1-False-True] |
119 |
- tests/test_bukuDb.py::test_delete_rec_index_and_delay_commit[1-False-False] |
120 |
- tests/test_bukuDb.py::test_delete_rec_index_and_delay_commit[1-True-True] |
121 |
- ) |
122 |
- |
123 |
- # tests/test_server.py is bukuserver tests, ignore it |
124 |
- pytest -v --ignore tests/test_server.py ${skipped_tests[@]/#/--deselect } || die "Tests failed with ${EPYTHON}" |
125 |
-} |
126 |
|
127 |
diff --git a/www-misc/buku/files/buku-4.5-hypothesis-fix.patch b/www-misc/buku/files/buku-4.5-hypothesis-fix.patch |
128 |
deleted file mode 100644 |
129 |
index c742162ab1c..00000000000 |
130 |
--- a/www-misc/buku/files/buku-4.5-hypothesis-fix.patch |
131 |
+++ /dev/null |
132 |
@@ -1,494 +0,0 @@ |
133 |
-From e4ef997dbbddcb372ba20cff18c8dc2a17da215c Mon Sep 17 00:00:00 2001 |
134 |
-From: rachmadaniHaryono <foreturiga@×××××.com> |
135 |
-Date: Sat, 9 Jan 2021 13:35:34 +0800 |
136 |
-Subject: [PATCH 1/8] chg: test: basic for print_rec |
137 |
- |
138 |
---- |
139 |
- tests/test_bukuDb.py | 86 ++++++++++++++++++++------------------------ |
140 |
- 1 file changed, 38 insertions(+), 48 deletions(-) |
141 |
- |
142 |
-diff --git a/tests/test_bukuDb.py b/tests/test_bukuDb.py |
143 |
-index 4413760c..b5c0d7a7 100644 |
144 |
---- a/tests/test_bukuDb.py |
145 |
-+++ b/tests/test_bukuDb.py |
146 |
-@@ -9,22 +9,21 @@ |
147 |
- import shutil |
148 |
- import sqlite3 |
149 |
- import sys |
150 |
-+import unittest |
151 |
- import urllib |
152 |
- import zipfile |
153 |
--from tempfile import TemporaryDirectory, NamedTemporaryFile |
154 |
-- |
155 |
--from unittest import mock |
156 |
--import unittest |
157 |
- from genericpath import exists |
158 |
-+from tempfile import NamedTemporaryFile, TemporaryDirectory |
159 |
-+from unittest import mock |
160 |
-+ |
161 |
- import pytest |
162 |
-+import vcr |
163 |
- import yaml |
164 |
--from hypothesis import given, example, settings |
165 |
-+from hypothesis import HealthCheck, example, given, settings |
166 |
- from hypothesis import strategies as st |
167 |
--import vcr |
168 |
- |
169 |
- from buku import BukuDb, parse_tags, prompt |
170 |
- |
171 |
-- |
172 |
- logging.basicConfig() # you need to initialize logging, otherwise you will not see anything from vcrpy |
173 |
- vcr_log = logging.getLogger("vcr") |
174 |
- vcr_log.setLevel(logging.INFO) |
175 |
-@@ -686,54 +685,45 @@ def test_refreshdb(refreshdb_fixture, title_in, exp_res): |
176 |
- assert from_db[2] == exp_res, 'from_db: {}'.format(from_db) |
177 |
- |
178 |
- |
179 |
--@given( |
180 |
-- index=st.integers(min_value=-10, max_value=10), |
181 |
-- low=st.integers(min_value=-10, max_value=10), |
182 |
-- high=st.integers(min_value=-10, max_value=10), |
183 |
-- is_range=st.booleans(), |
184 |
--) |
185 |
--@settings(deadline=None) |
186 |
--def test_print_rec_hypothesis(caplog, setup, index, low, high, is_range): |
187 |
-- """test when index, low or high is less than 0.""" |
188 |
-- # setup |
189 |
-- caplog.handler.records.clear() |
190 |
-- caplog.records.clear() |
191 |
-- |
192 |
-- bdb = BukuDb() |
193 |
-+@××××××.fixture |
194 |
-+def test_print_db(tmp_path): |
195 |
-+ bdb = BukuDb(dbfile=tmp_path / 'tmp.db') |
196 |
- # clear all record first before testing |
197 |
- bdb.delete_rec_all() |
198 |
- bdb.add_rec("http://one.com", "", parse_tags(['cat,ant,bee,1']), "") |
199 |
-- db_len = 1 |
200 |
-- bdb.print_rec(index=index, low=low, high=high, is_range=is_range) |
201 |
-- |
202 |
-- check_print = False |
203 |
-- err_msg = ['Actual log:'] |
204 |
-- err_msg.extend(['{}:{}'.format(x.levelname, x.getMessage()) for x in caplog.records]) |
205 |
-- |
206 |
-- if index < 0 or (0 <= index <= db_len and not is_range): |
207 |
-- check_print = True |
208 |
-- # negative index/range on is_range |
209 |
-- elif (is_range and any([low < 0, high < 0])): |
210 |
-- assert any([x.levelname == "ERROR" for x in caplog.records]), \ |
211 |
-- '\n'.join(err_msg) |
212 |
-- assert any([x.getMessage() == "Negative range boundary" for x in caplog.records]), \ |
213 |
-- '\n'.join(err_msg) |
214 |
-- elif is_range: |
215 |
-- check_print = True |
216 |
-- else: |
217 |
-- assert any([x.levelname == "ERROR" for x in caplog.records]), \ |
218 |
-- '\n'.join(err_msg) |
219 |
-- assert any([x.getMessage().startswith("No matching index") for x in caplog.records]), \ |
220 |
-- '\n'.join(err_msg) |
221 |
-+ yield bdb |
222 |
-+ bdb.delete_rec(index=1) |
223 |
- |
224 |
-- if check_print: |
225 |
-- assert not any([x.levelname == "ERROR" for x in caplog.records]), \ |
226 |
-- '\n'.join(err_msg) |
227 |
- |
228 |
-- # teardown |
229 |
-- bdb.delete_rec(index=1) |
230 |
-+@××××××.fixture |
231 |
-+def test_print_caplog(caplog): |
232 |
- caplog.handler.records.clear() |
233 |
- caplog.records.clear() |
234 |
-+ yield caplog |
235 |
-+ |
236 |
-+ |
237 |
-+@×××××××××××.parametrize('kwargs, exp_res', [ |
238 |
-+ [{}, (True, [])], |
239 |
-+ [{'is_range': True}, (True, [])], |
240 |
-+ [{'index': 0}, (True, [])], |
241 |
-+ [{'index': -1}, (True, [])], |
242 |
-+ [{'index': -2}, (True, [])], |
243 |
-+ [{'index': 2}, (False, [('root', 40, 'No matching index 2')])], |
244 |
-+]) |
245 |
-+def test_print_rec(kwargs, exp_res, test_print_db, caplog): |
246 |
-+ bdb = test_print_db |
247 |
-+ # run the function |
248 |
-+ assert (bdb.print_rec(**kwargs), caplog.record_tuples) == exp_res |
249 |
-+ |
250 |
-+ |
251 |
-+@×××××××××××.parametrize('index, exp_res', [ |
252 |
-+ [0, (True, [('root', 40, '0 records')])], |
253 |
-+ [-1, (False, [('root', 40, 'Empty database')])], |
254 |
-+ [1, (False, [('root', 40, 'No matching index 1')])], |
255 |
-+]) |
256 |
-+def test_print_rec_on_empty_db(tmp_path, caplog, index, exp_res): |
257 |
-+ bdb = BukuDb(dbfile=tmp_path / 'tmp.db') |
258 |
-+ assert (bdb.print_rec(index=index), caplog.record_tuples) == exp_res |
259 |
- |
260 |
- |
261 |
- def test_list_tags(capsys, setup): |
262 |
- |
263 |
-From adb7314d49e47823d83bb7a07ef21ac1d628998a Mon Sep 17 00:00:00 2001 |
264 |
-From: rachmadaniHaryono <foreturiga@×××××.com> |
265 |
-Date: Sat, 9 Jan 2021 13:42:17 +0800 |
266 |
-Subject: [PATCH 2/8] new: dev: type hint for print_rec |
267 |
- |
268 |
---- |
269 |
- buku | 2 +- |
270 |
- 1 file changed, 1 insertion(+), 1 deletion(-) |
271 |
- |
272 |
-diff --git a/buku b/buku |
273 |
-index 540c7d5e..a18c6b47 100755 |
274 |
---- a/buku |
275 |
-+++ b/buku |
276 |
-@@ -1658,7 +1658,7 @@ class BukuDb: |
277 |
- |
278 |
- return False |
279 |
- |
280 |
-- def print_rec(self, index=0, low=0, high=0, is_range=False): |
281 |
-+ def print_rec(self, index : int = 0 , low : int = 0, high : int = 0, is_range : bool = False) -> bool: |
282 |
- """Print bookmark details at index or all bookmarks if index is 0. |
283 |
- |
284 |
- A negative index behaves like tail, if title is blank show "Untitled". |
285 |
- |
286 |
-From 92caf1c6c8687773cb288434fff7e1218ae918ce Mon Sep 17 00:00:00 2001 |
287 |
-From: rachmadaniHaryono <foreturiga@×××××.com> |
288 |
-Date: Sat, 9 Jan 2021 14:11:16 +0800 |
289 |
-Subject: [PATCH 3/8] chg: test: print_rec |
290 |
- |
291 |
-- merge no db and single rec test |
292 |
-- more test case |
293 |
---- |
294 |
- tests/test_bukuDb.py | 52 +++++++++++++++++++++++++++----------------- |
295 |
- 1 file changed, 32 insertions(+), 20 deletions(-) |
296 |
- |
297 |
-diff --git a/tests/test_bukuDb.py b/tests/test_bukuDb.py |
298 |
-index b5c0d7a7..2142dcf3 100644 |
299 |
---- a/tests/test_bukuDb.py |
300 |
-+++ b/tests/test_bukuDb.py |
301 |
-@@ -33,6 +33,7 @@ |
302 |
- TEST_TEMP_DBDIR_PATH = os.path.join(TEST_TEMP_DIR_PATH, 'buku') |
303 |
- TEST_TEMP_DBFILE_PATH = os.path.join(TEST_TEMP_DBDIR_PATH, 'bookmarks.db') |
304 |
- MAX_SQLITE_INT = int(math.pow(2, 63) - 1) |
305 |
-+TEST_PRINT_REC = ("https://example.com", "", parse_tags(['cat,ant,bee,1']), "") |
306 |
- |
307 |
- TEST_BOOKMARKS = [ |
308 |
- ['http://slashdot.org', |
309 |
-@@ -690,7 +691,7 @@ def test_print_db(tmp_path): |
310 |
- bdb = BukuDb(dbfile=tmp_path / 'tmp.db') |
311 |
- # clear all record first before testing |
312 |
- bdb.delete_rec_all() |
313 |
-- bdb.add_rec("http://one.com", "", parse_tags(['cat,ant,bee,1']), "") |
314 |
-+ bdb.add_rec |
315 |
- yield bdb |
316 |
- bdb.delete_rec(index=1) |
317 |
- |
318 |
-@@ -702,30 +703,41 @@ def test_print_caplog(caplog): |
319 |
- yield caplog |
320 |
- |
321 |
- |
322 |
--@×××××××××××.parametrize('kwargs, exp_res', [ |
323 |
-- [{}, (True, [])], |
324 |
-- [{'is_range': True}, (True, [])], |
325 |
-- [{'index': 0}, (True, [])], |
326 |
-- [{'index': -1}, (True, [])], |
327 |
-- [{'index': -2}, (True, [])], |
328 |
-- [{'index': 2}, (False, [('root', 40, 'No matching index 2')])], |
329 |
-+@×××××××××××.parametrize('kwargs, rec, exp_res', [ |
330 |
-+ [{}, TEST_PRINT_REC, (True, [])], |
331 |
-+ [{'is_range': True}, TEST_PRINT_REC, (True, [])], |
332 |
-+ [{'index': 0}, TEST_PRINT_REC, (True, [])], |
333 |
-+ [{'index': -1}, TEST_PRINT_REC, (True, [])], |
334 |
-+ [{'index': -2}, TEST_PRINT_REC, (True, [])], |
335 |
-+ [{'index': 2}, TEST_PRINT_REC, (False, [('root', 40, 'No matching index 2')])], |
336 |
-+ [{'low': -1, 'high': -1}, TEST_PRINT_REC, (True, [])], |
337 |
-+ [{'low': -1, 'high': -1, 'is_range': True}, TEST_PRINT_REC, (False, [('root', 40, 'Negative range boundary')])], |
338 |
-+ [{'low': 0, 'high': 0, 'is_range': True}, TEST_PRINT_REC, (True, [])], |
339 |
-+ [{'low': 0, 'high': 1, 'is_range': True}, TEST_PRINT_REC, (True, [])], |
340 |
-+ [{'low': 0, 'high': 2, 'is_range': True}, TEST_PRINT_REC, (True, [])], |
341 |
-+ [{'low': 2, 'high': 2, 'is_range': True}, TEST_PRINT_REC, (True, [])], |
342 |
-+ [{'low': 2, 'high': 3, 'is_range': True}, TEST_PRINT_REC, (True, [])], |
343 |
-+ # empty database |
344 |
-+ [{'is_range': True}, None, (True, [])], |
345 |
-+ [{'index': 0}, None, (True, [('root', 40, '0 records')])], |
346 |
-+ [{'index': -1}, None, (False, [('root', 40, 'Empty database')])], |
347 |
-+ [{'index': 1}, None, (False, [('root', 40, 'No matching index 1')])], |
348 |
-+ [{'low': -1, 'high': -1}, TEST_PRINT_REC, (True, [])], |
349 |
-+ [{'low': -1, 'high': -1, 'is_range': True}, None, (False, [('root', 40, 'Negative range boundary')])], |
350 |
-+ [{'low': 0, 'high': 0, 'is_range': True}, None, (True, [])], |
351 |
-+ [{'low': 0, 'high': 1, 'is_range': True}, None, (True, [])], |
352 |
-+ [{'low': 0, 'high': 2, 'is_range': True}, None, (True, [])], |
353 |
-+ [{'low': 2, 'high': 2, 'is_range': True}, None, (True, [])], |
354 |
-+ [{'low': 2, 'high': 3, 'is_range': True}, None, (True, [])], |
355 |
- ]) |
356 |
--def test_print_rec(kwargs, exp_res, test_print_db, caplog): |
357 |
-- bdb = test_print_db |
358 |
-+def test_print_rec(setup, kwargs, rec, exp_res, tmp_path, caplog): |
359 |
-+ bdb = BukuDb(dbfile=tmp_path / 'tmp.db') |
360 |
-+ if rec: |
361 |
-+ bdb.add_rec(*rec) |
362 |
- # run the function |
363 |
- assert (bdb.print_rec(**kwargs), caplog.record_tuples) == exp_res |
364 |
- |
365 |
- |
366 |
--@×××××××××××.parametrize('index, exp_res', [ |
367 |
-- [0, (True, [('root', 40, '0 records')])], |
368 |
-- [-1, (False, [('root', 40, 'Empty database')])], |
369 |
-- [1, (False, [('root', 40, 'No matching index 1')])], |
370 |
--]) |
371 |
--def test_print_rec_on_empty_db(tmp_path, caplog, index, exp_res): |
372 |
-- bdb = BukuDb(dbfile=tmp_path / 'tmp.db') |
373 |
-- assert (bdb.print_rec(index=index), caplog.record_tuples) == exp_res |
374 |
-- |
375 |
-- |
376 |
- def test_list_tags(capsys, setup): |
377 |
- bdb = BukuDb() |
378 |
- |
379 |
- |
380 |
-From ae088057ccf5e7f0d6b4916293b5d3b3535a71ed Mon Sep 17 00:00:00 2001 |
381 |
-From: rachmadaniHaryono <foreturiga@×××××.com> |
382 |
-Date: Sat, 9 Jan 2021 14:52:06 +0800 |
383 |
-Subject: [PATCH 4/8] chg: test: simplify |
384 |
- test_delete_rec_range_and_delay_commit |
385 |
- |
386 |
---- |
387 |
- tests/test_bukuDb.py | 76 ++++++++++---------------------------------- |
388 |
- 1 file changed, 16 insertions(+), 60 deletions(-) |
389 |
- |
390 |
-diff --git a/tests/test_bukuDb.py b/tests/test_bukuDb.py |
391 |
-index 2142dcf3..ad1ef5ba 100644 |
392 |
---- a/tests/test_bukuDb.py |
393 |
-+++ b/tests/test_bukuDb.py |
394 |
-@@ -774,74 +774,30 @@ def test_compactdb(setup): |
395 |
- |
396 |
- |
397 |
- @vcr.use_cassette('tests/vcr_cassettes/test_delete_rec_range_and_delay_commit.yaml') |
398 |
--@given( |
399 |
-- low=st.integers(min_value=-10, max_value=10), |
400 |
-- high=st.integers(min_value=-10, max_value=10), |
401 |
-- delay_commit=st.booleans(), |
402 |
-- input_retval=st.characters() |
403 |
--) |
404 |
--@example(low=0, high=0, delay_commit=False, input_retval='y') |
405 |
--@settings(max_examples=2, deadline=None) |
406 |
--def test_delete_rec_range_and_delay_commit(setup, low, high, delay_commit, input_retval): |
407 |
-+@×××××××××××.parametrize('low, high, delay_commit, input_retval, exp_res', [ |
408 |
-+ # delay_commit, y input_retval |
409 |
-+ [0, 0, True, 'y', (True, [])], |
410 |
-+ # delay_commit, non-y input_retval |
411 |
-+ [0, 0, True, 'x', (False, [tuple([x] + y + [0]) for x,y in zip(range(1, 4), TEST_BOOKMARKS)])], |
412 |
-+ # non delay_commit, y input_retval |
413 |
-+ [0, 0, False, 'y', (True, [])], |
414 |
-+ # non delay_commit, non-y input_retval |
415 |
-+ [0, 0, False, 'x', (False, [tuple([x] + y + [0]) for x,y in zip(range(1, 4), TEST_BOOKMARKS)])], |
416 |
-+]) |
417 |
-+def test_delete_rec_range_and_delay_commit(setup, tmp_path, low, high, delay_commit, input_retval, exp_res): |
418 |
- """test delete rec, range and delay commit.""" |
419 |
-- bdb = BukuDb() |
420 |
-- bdb_dc = BukuDb() # instance for delay_commit check. |
421 |
-- index = 0 |
422 |
-- is_range = True |
423 |
-+ bdb = BukuDb(dbfile=tmp_path / 'tmp.db') |
424 |
-+ kwargs = {'is_range': True, 'low': low, 'high': high, 'delay_commit': delay_commit} |
425 |
-+ kwargs['index'] = 0 |
426 |
- |
427 |
- # Fill bookmark |
428 |
- for bookmark in TEST_BOOKMARKS: |
429 |
- bdb.add_rec(*bookmark) |
430 |
-- db_len = len(TEST_BOOKMARKS) |
431 |
-- |
432 |
-- # use normalized high and low variable |
433 |
-- n_low, n_high = normalize_range(db_len=db_len, low=low, high=high) |
434 |
-- |
435 |
-- exp_res = True |
436 |
-- if n_high > db_len >= n_low: |
437 |
-- exp_db_len = db_len - (db_len + 1 - n_low) |
438 |
-- elif n_high == n_low > db_len: |
439 |
-- exp_db_len = db_len |
440 |
-- exp_res = False |
441 |
-- elif n_high == n_low <= db_len: |
442 |
-- exp_db_len = db_len - 1 |
443 |
-- else: |
444 |
-- exp_db_len = db_len - (n_high + 1 - n_low) |
445 |
- |
446 |
- with mock.patch('builtins.input', return_value=input_retval): |
447 |
-- res = bdb.delete_rec( |
448 |
-- index=index, low=low, high=high, is_range=is_range, delay_commit=delay_commit) |
449 |
-+ res = bdb.delete_rec(**kwargs) |
450 |
- |
451 |
-- if n_low < 0: |
452 |
-- assert not res |
453 |
-- assert len(bdb_dc.get_rec_all()) == db_len |
454 |
-- # teardown |
455 |
-- os.environ['XDG_DATA_HOME'] = TEST_TEMP_DIR_PATH |
456 |
-- return |
457 |
-- if (low == 0 or high == 0) and input_retval != 'y': |
458 |
-- assert not res |
459 |
-- assert len(bdb_dc.get_rec_all()) == db_len |
460 |
-- # teardown |
461 |
-- os.environ['XDG_DATA_HOME'] = TEST_TEMP_DIR_PATH |
462 |
-- return |
463 |
-- if (low == 0 or high == 0) and input_retval == 'y': |
464 |
-- assert res == exp_res |
465 |
-- assert len(bdb_dc.get_rec_all()) == 0 |
466 |
-- # teardown |
467 |
-- os.environ['XDG_DATA_HOME'] = TEST_TEMP_DIR_PATH |
468 |
-- return |
469 |
-- if n_low > db_len and n_low > 0: |
470 |
-- assert not res |
471 |
-- assert len(bdb_dc.get_rec_all()) == db_len |
472 |
-- # teardown |
473 |
-- os.environ['XDG_DATA_HOME'] = TEST_TEMP_DIR_PATH |
474 |
-- return |
475 |
-- assert res == exp_res |
476 |
-- assert len(bdb.get_rec_all()) == exp_db_len |
477 |
-- if delay_commit: |
478 |
-- assert len(bdb_dc.get_rec_all()) == db_len |
479 |
-- else: |
480 |
-- assert len(bdb_dc.get_rec_all()) == exp_db_len |
481 |
-+ assert (res, bdb.get_rec_all()) == exp_res |
482 |
- |
483 |
- # teardown |
484 |
- os.environ['XDG_DATA_HOME'] = TEST_TEMP_DIR_PATH |
485 |
- |
486 |
-From 70533309146cace69cc0b1d6163d6a239e73f055 Mon Sep 17 00:00:00 2001 |
487 |
-From: rachmadaniHaryono <foreturiga@×××××.com> |
488 |
-Date: Sat, 9 Jan 2021 15:02:25 +0800 |
489 |
-Subject: [PATCH 5/8] new: dev: update test package |
490 |
- |
491 |
---- |
492 |
- setup.py | 4 ++-- |
493 |
- 1 file changed, 2 insertions(+), 2 deletions(-) |
494 |
- |
495 |
-diff --git a/setup.py b/setup.py |
496 |
-index 1cda44d1..60a36a37 100644 |
497 |
---- a/setup.py |
498 |
-+++ b/setup.py |
499 |
-@@ -20,12 +20,12 @@ |
500 |
- 'beautifulsoup4>=4.6.0', |
501 |
- 'Click>=7.0', |
502 |
- 'flake8>=3.4.1', |
503 |
-- 'hypothesis>=3.7.0', |
504 |
-+ 'hypothesis>=6.0.0', |
505 |
- 'mypy-extensions==0.4.1', |
506 |
- 'py>=1.5.0', |
507 |
- 'pylint>=1.7.2', |
508 |
- 'pytest-cov', |
509 |
-- 'pytest>=3.4.2', |
510 |
-+ 'pytest>=6.2.1', |
511 |
- 'PyYAML>=4.2b1', |
512 |
- 'setuptools>=41.0.1', |
513 |
- 'vcrpy>=1.13.0', |
514 |
- |
515 |
-From 61592a42dcd1cadf168934a0fc74cb42da5fed0f Mon Sep 17 00:00:00 2001 |
516 |
-From: rachmadaniHaryono <foreturiga@×××××.com> |
517 |
-Date: Sat, 9 Jan 2021 15:29:00 +0800 |
518 |
-Subject: [PATCH 6/8] fix: test: pylint |
519 |
- |
520 |
---- |
521 |
- buku | 2 +- |
522 |
- tests/test_bukuDb.py | 8 ++++---- |
523 |
- 2 files changed, 5 insertions(+), 5 deletions(-) |
524 |
- |
525 |
-diff --git a/buku b/buku |
526 |
-index a18c6b47..df2e1f8d 100755 |
527 |
---- a/buku |
528 |
-+++ b/buku |
529 |
-@@ -1658,7 +1658,7 @@ class BukuDb: |
530 |
- |
531 |
- return False |
532 |
- |
533 |
-- def print_rec(self, index : int = 0 , low : int = 0, high : int = 0, is_range : bool = False) -> bool: |
534 |
-+ def print_rec(self, index: int = 0, low: int = 0, high: int = 0, is_range: bool = False) -> bool: |
535 |
- """Print bookmark details at index or all bookmarks if index is 0. |
536 |
- |
537 |
- A negative index behaves like tail, if title is blank show "Untitled". |
538 |
-diff --git a/tests/test_bukuDb.py b/tests/test_bukuDb.py |
539 |
-index ad1ef5ba..e22ddacb 100644 |
540 |
---- a/tests/test_bukuDb.py |
541 |
-+++ b/tests/test_bukuDb.py |
542 |
-@@ -19,7 +19,7 @@ |
543 |
- import pytest |
544 |
- import vcr |
545 |
- import yaml |
546 |
--from hypothesis import HealthCheck, example, given, settings |
547 |
-+from hypothesis import example, given, settings |
548 |
- from hypothesis import strategies as st |
549 |
- |
550 |
- from buku import BukuDb, parse_tags, prompt |
551 |
-@@ -778,16 +778,16 @@ def test_compactdb(setup): |
552 |
- # delay_commit, y input_retval |
553 |
- [0, 0, True, 'y', (True, [])], |
554 |
- # delay_commit, non-y input_retval |
555 |
-- [0, 0, True, 'x', (False, [tuple([x] + y + [0]) for x,y in zip(range(1, 4), TEST_BOOKMARKS)])], |
556 |
-+ [0, 0, True, 'x', (False, [tuple([x] + y + [0]) for x, y in zip(range(1, 4), TEST_BOOKMARKS)])], |
557 |
- # non delay_commit, y input_retval |
558 |
- [0, 0, False, 'y', (True, [])], |
559 |
- # non delay_commit, non-y input_retval |
560 |
-- [0, 0, False, 'x', (False, [tuple([x] + y + [0]) for x,y in zip(range(1, 4), TEST_BOOKMARKS)])], |
561 |
-+ [0, 0, False, 'x', (False, [tuple([x] + y + [0]) for x, y in zip(range(1, 4), TEST_BOOKMARKS)])], |
562 |
- ]) |
563 |
- def test_delete_rec_range_and_delay_commit(setup, tmp_path, low, high, delay_commit, input_retval, exp_res): |
564 |
- """test delete rec, range and delay commit.""" |
565 |
- bdb = BukuDb(dbfile=tmp_path / 'tmp.db') |
566 |
-- kwargs = {'is_range': True, 'low': low, 'high': high, 'delay_commit': delay_commit} |
567 |
-+ kwargs = {'is_range': True, 'low': low, 'high': high, 'delay_commit': delay_commit} |
568 |
- kwargs['index'] = 0 |
569 |
- |
570 |
- # Fill bookmark |
571 |
- |
572 |
-From 961071eac597206c63aac5c20e692f8b269d0171 Mon Sep 17 00:00:00 2001 |
573 |
-From: rachmadaniHaryono <foreturiga@×××××.com> |
574 |
-Date: Sat, 9 Jan 2021 15:41:46 +0800 |
575 |
-Subject: [PATCH 7/8] fix: test: pylint wrong import order |
576 |
- |
577 |
---- |
578 |
- tests/test_bukuDb.py | 2 +- |
579 |
- 1 file changed, 1 insertion(+), 1 deletion(-) |
580 |
- |
581 |
-diff --git a/tests/test_bukuDb.py b/tests/test_bukuDb.py |
582 |
-index e22ddacb..32738260 100644 |
583 |
---- a/tests/test_bukuDb.py |
584 |
-+++ b/tests/test_bukuDb.py |
585 |
-@@ -12,9 +12,9 @@ |
586 |
- import unittest |
587 |
- import urllib |
588 |
- import zipfile |
589 |
--from genericpath import exists |
590 |
- from tempfile import NamedTemporaryFile, TemporaryDirectory |
591 |
- from unittest import mock |
592 |
-+from genericpath import exists |
593 |
- |
594 |
- import pytest |
595 |
- import vcr |
596 |
- |
597 |
-From c51d454f2f7ff35995265f276a5d96adb5aff995 Mon Sep 17 00:00:00 2001 |
598 |
-From: rachmadaniHaryono <foreturiga@×××××.com> |
599 |
-Date: Sat, 9 Jan 2021 15:42:00 +0800 |
600 |
-Subject: [PATCH 8/8] chg: test: remove unused fixture |
601 |
- |
602 |
---- |
603 |
- tests/test_bukuDb.py | 10 ---------- |
604 |
- 1 file changed, 10 deletions(-) |
605 |
- |
606 |
-diff --git a/tests/test_bukuDb.py b/tests/test_bukuDb.py |
607 |
-index 32738260..23f2f84a 100644 |
608 |
---- a/tests/test_bukuDb.py |
609 |
-+++ b/tests/test_bukuDb.py |
610 |
-@@ -686,16 +686,6 @@ def test_refreshdb(refreshdb_fixture, title_in, exp_res): |
611 |
- assert from_db[2] == exp_res, 'from_db: {}'.format(from_db) |
612 |
- |
613 |
- |
614 |
--@××××××.fixture |
615 |
--def test_print_db(tmp_path): |
616 |
-- bdb = BukuDb(dbfile=tmp_path / 'tmp.db') |
617 |
-- # clear all record first before testing |
618 |
-- bdb.delete_rec_all() |
619 |
-- bdb.add_rec |
620 |
-- yield bdb |
621 |
-- bdb.delete_rec(index=1) |
622 |
-- |
623 |
-- |
624 |
- @pytest.fixture |
625 |
- def test_print_caplog(caplog): |
626 |
- caplog.handler.records.clear() |