From a72f0a160b6067afb83aea0393b40649a1cc3349 Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Mon, 27 Mar 2023 17:58:07 +0200 Subject: [PATCH] Bugfix for python3.11, table gdrive_ids2 already exists (fix for #2729) --- cps/gdriveutils.py | 18 -- setup.cfg | 6 +- test/Calibre-Web TestSummary_Linux.html | 215 ++++++------------------ 3 files changed, 51 insertions(+), 188 deletions(-) diff --git a/cps/gdriveutils.py b/cps/gdriveutils.py index b82f13f1..f50a2f3f 100644 --- a/cps/gdriveutils.py +++ b/cps/gdriveutils.py @@ -174,30 +174,12 @@ class PermissionAdded(Base): return str(self.gdrive_id) -def migrate(): - if not engine.dialect.has_table(engine.connect(), "permissions_added"): - PermissionAdded.__table__.create(bind = engine) - for sql in session.execute(text("select sql from sqlite_master where type='table'")): - if 'CREATE TABLE gdrive_ids' in sql[0]: - currUniqueConstraint = 'UNIQUE (gdrive_id)' - if currUniqueConstraint in sql[0]: - sql=sql[0].replace(currUniqueConstraint, 'UNIQUE (gdrive_id, path)') - sql=sql.replace(GdriveId.__tablename__, GdriveId.__tablename__ + '2') - session.execute(sql) - session.execute(text("INSERT INTO gdrive_ids2 (id, gdrive_id, path) SELECT id, " - "gdrive_id, path FROM gdrive_ids;")) - session.commit() - session.execute(text('DROP TABLE %s' % 'gdrive_ids')) - session.execute(text('ALTER TABLE gdrive_ids2 RENAME to gdrive_ids')) - break - if not os.path.exists(cli_param.gd_path): try: Base.metadata.create_all(engine) except Exception as ex: log.error("Error connect to database: {} - {}".format(cli_param.gd_path, ex)) raise -migrate() def getDrive(drive=None, gauth=None): diff --git a/setup.cfg b/setup.cfg index 5a7bef7b..67d09ae8 100644 --- a/setup.cfg +++ b/setup.cfg @@ -63,10 +63,10 @@ install_requires = [options.extras_require] gdrive = - google-api-python-client>=1.7.11,<2.78.0 + google-api-python-client>=1.7.11,<2.90.0 gevent>20.6.0,<23.0.0 greenlet>=0.4.17,<2.1.0 - httplib2>=0.9.2,<0.22.0 + httplib2>=0.9.2,<0.23.0 oauth2client>=4.0.0,<4.1.4 uritemplate>=3.0.0,<4.2.0 pyasn1-modules>=0.0.8,<0.3.0 @@ -76,7 +76,7 @@ gdrive = rsa>=3.4.2,<4.10.0 gmail = google-auth-oauthlib>=0.4.3,<0.9.0 - google-api-python-client>=1.7.11,<2.78.0 + google-api-python-client>=1.7.11,<2.90.0 goodreads = goodreads>=0.3.2,<0.4.0 python-Levenshtein>=0.12.0,<0.21.0 diff --git a/test/Calibre-Web TestSummary_Linux.html b/test/Calibre-Web TestSummary_Linux.html index 334cdf37..b6c10986 100644 --- a/test/Calibre-Web TestSummary_Linux.html +++ b/test/Calibre-Web TestSummary_Linux.html @@ -37,20 +37,20 @@
-

Start Time: 2023-03-25 19:54:15

+

Start Time: 2023-03-26 21:21:07

-

Stop Time: 2023-03-26 03:41:52

+

Stop Time: 2023-03-27 04:13:39

-

Duration: 5h 46 min

+

Duration: 5h 49 min

@@ -852,12 +852,12 @@ - + TestEbookConvertCalibreGDrive 6 - 4 - 1 - 1 + 6 + 0 + 0 0 Detail @@ -866,62 +866,20 @@ - +
TestEbookConvertCalibreGDrive - test_convert_email
- -
- FAIL -
- - - - + PASS - +
TestEbookConvertCalibreGDrive - test_convert_failed_and_email
- -
- ERROR -
- - - - + PASS @@ -1215,11 +1173,11 @@ selenium.common.exceptions.NoSuchElementException: Message: Could not locate ele - + TestEditBooks 36 - 34 - 1 + 35 + 0 0 1 @@ -1346,34 +1304,11 @@ selenium.common.exceptions.NoSuchElementException: Message: Could not locate ele - +
TestEditBooks - test_edit_language
- -
- FAIL -
- - - - + PASS @@ -1936,8 +1871,8 @@ AssertionError: 'German' != '\n German TestEditBooksOnGdrive 18 - 15 - 2 + 17 + 0 1 0 @@ -2046,34 +1981,11 @@ AssertionError: 'German' != '\n German - +
TestEditBooksOnGdrive - test_edit_language
- -
- FAIL -
- - - - + PASS @@ -2143,43 +2055,23 @@ IndexError: list index out of range - +
TestEditBooksOnGdrive - test_watch_metadata
- -
- FAIL -
- - - - + PASS - + TestLoadMetadataScholar 1 - 0 1 0 0 + 0 Detail @@ -2187,31 +2079,11 @@ AssertionError: False is not true - +
TestLoadMetadataScholar - test_load_metadata
- -
- FAIL -
- - - - + PASS @@ -3636,13 +3508,13 @@ AssertionError: 30 != 0 TestReader - 5 - 5 + 6 + 6 0 0 0 - Detail + Detail @@ -3650,7 +3522,7 @@ AssertionError: 30 != 0 -
TestReader - test_comic_reader
+
TestReader - test_comic_MACOS_files
PASS @@ -3659,7 +3531,7 @@ AssertionError: 30 != 0 -
TestReader - test_epub_reader
+
TestReader - test_comic_reader
PASS @@ -3668,7 +3540,7 @@ AssertionError: 30 != 0 -
TestReader - test_pdf_reader
+
TestReader - test_epub_reader
PASS @@ -3677,7 +3549,7 @@ AssertionError: 30 != 0 -
TestReader - test_sound_listener
+
TestReader - test_pdf_reader
PASS @@ -3685,6 +3557,15 @@ AssertionError: 30 != 0 + +
TestReader - test_sound_listener
+ + PASS + + + + +
TestReader - test_txt_reader
@@ -4143,7 +4024,7 @@ AssertionError: 30 != 0
Traceback (most recent call last):
   File "/home/ozzie/Development/calibre-web-test/test/test_thumbnails.py", line 310, in test_sideloaded_book
     self.assertAlmostEqual(diff(BytesIO(list_cover), BytesIO(old_list_cover), delete_diff_file=True), 0.0,
-AssertionError: 0.006465888577653282 != 0.0 within 0.0001 delta (0.006465888577653282 difference)
+AssertionError: 0.007374011826953003 != 0.0 within 0.0001 delta (0.007374011826953003 difference)
@@ -5222,10 +5103,10 @@ AssertionError: 0.006465888577653282 != 0.0 within 0.0001 delta (0.0064658885776 Total - 454 - 439 - 6 - 2 + 455 + 446 + 1 + 1 7   @@ -5710,7 +5591,7 @@ AssertionError: 0.006465888577653282 != 0.0 within 0.0001 delta (0.0064658885776