Bugfix for python3.11, table gdrive_ids2 already exists (fix for #2729)

This commit is contained in:
Ozzie Isaacs 2023-03-27 17:58:07 +02:00
parent 253386b0a5
commit a72f0a160b
3 changed files with 51 additions and 188 deletions

View File

@ -174,30 +174,12 @@ class PermissionAdded(Base):
return str(self.gdrive_id) 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): if not os.path.exists(cli_param.gd_path):
try: try:
Base.metadata.create_all(engine) Base.metadata.create_all(engine)
except Exception as ex: except Exception as ex:
log.error("Error connect to database: {} - {}".format(cli_param.gd_path, ex)) log.error("Error connect to database: {} - {}".format(cli_param.gd_path, ex))
raise raise
migrate()
def getDrive(drive=None, gauth=None): def getDrive(drive=None, gauth=None):

View File

@ -63,10 +63,10 @@ install_requires =
[options.extras_require] [options.extras_require]
gdrive = 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 gevent>20.6.0,<23.0.0
greenlet>=0.4.17,<2.1.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 oauth2client>=4.0.0,<4.1.4
uritemplate>=3.0.0,<4.2.0 uritemplate>=3.0.0,<4.2.0
pyasn1-modules>=0.0.8,<0.3.0 pyasn1-modules>=0.0.8,<0.3.0
@ -76,7 +76,7 @@ gdrive =
rsa>=3.4.2,<4.10.0 rsa>=3.4.2,<4.10.0
gmail = gmail =
google-auth-oauthlib>=0.4.3,<0.9.0 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 =
goodreads>=0.3.2,<0.4.0 goodreads>=0.3.2,<0.4.0
python-Levenshtein>=0.12.0,<0.21.0 python-Levenshtein>=0.12.0,<0.21.0

View File

@ -37,20 +37,20 @@
<div class="row"> <div class="row">
<div class="col-xs-6 col-md-6 col-sm-offset-3" style="margin-top:50px;"> <div class="col-xs-6 col-md-6 col-sm-offset-3" style="margin-top:50px;">
<p class='text-justify attribute'><strong>Start Time: </strong>2023-03-25 19:54:15</p> <p class='text-justify attribute'><strong>Start Time: </strong>2023-03-26 21:21:07</p>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-6 col-md-6 col-sm-offset-3"> <div class="col-xs-6 col-md-6 col-sm-offset-3">
<p class='text-justify attribute'><strong>Stop Time: </strong>2023-03-26 03:41:52</p> <p class='text-justify attribute'><strong>Stop Time: </strong>2023-03-27 04:13:39</p>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-6 col-md-6 col-sm-offset-3"> <div class="col-xs-6 col-md-6 col-sm-offset-3">
<p class='text-justify attribute'><strong>Duration: </strong>5h 46 min</p> <p class='text-justify attribute'><strong>Duration: </strong>5h 49 min</p>
</div> </div>
</div> </div>
</div> </div>
@ -852,12 +852,12 @@
<tr id="su" class="errorClass"> <tr id="su" class="passClass">
<td>TestEbookConvertCalibreGDrive</td> <td>TestEbookConvertCalibreGDrive</td>
<td class="text-center">6</td> <td class="text-center">6</td>
<td class="text-center">4</td> <td class="text-center">6</td>
<td class="text-center">1</td> <td class="text-center">0</td>
<td class="text-center">1</td> <td class="text-center">0</td>
<td class="text-center">0</td> <td class="text-center">0</td>
<td class="text-center"> <td class="text-center">
<a onclick="showClassDetail('c9', 6)">Detail</a> <a onclick="showClassDetail('c9', 6)">Detail</a>
@ -866,62 +866,20 @@
<tr id="ft9.1" class="none bg-danger"> <tr id='pt9.1' class='hiddenRow bg-success'>
<td> <td>
<div class='testcase'>TestEbookConvertCalibreGDrive - test_convert_email</div> <div class='testcase'>TestEbookConvertCalibreGDrive - test_convert_email</div>
</td> </td>
<td colspan='6'> <td colspan='6' align='center'>PASS</td>
<div class="text-center">
<a class="popup_link text-center" onfocus='blur()' onclick="showTestDetail('div_ft9.1')">FAIL</a>
</div>
<!--css div popup start-->
<div id="div_ft9.1" class="popup_window test_output" style="display:block;">
<div class='close_button pull-right'>
<button type="button" class="close" aria-label="Close" onfocus="this.blur();"
onclick="document.getElementById('div_ft9.1').style.display='none'"><span
aria-hidden="true">&times;</span></button>
</div>
<div class="text-left pull-left">
<pre class="text-left">Traceback (most recent call last):
File &#34;/home/ozzie/Development/calibre-web-test/test/test_ebook_convert_gdrive.py&#34;, line 209, in test_convert_email
self.assertEqual(1, task_len)
AssertionError: 1 != 3</pre>
</div>
<div class="clearfix"></div>
</div>
<!--css div popup end-->
</td>
</tr> </tr>
<tr id="et9.2" class="none bg-info"> <tr id='pt9.2' class='hiddenRow bg-success'>
<td> <td>
<div class='testcase'>TestEbookConvertCalibreGDrive - test_convert_failed_and_email</div> <div class='testcase'>TestEbookConvertCalibreGDrive - test_convert_failed_and_email</div>
</td> </td>
<td colspan='6'> <td colspan='6' align='center'>PASS</td>
<div class="text-center">
<a class="popup_link text-center" onfocus='blur()' onclick="showTestDetail('div_et9.2')">ERROR</a>
</div>
<!--css div popup start-->
<div id="div_et9.2" class="popup_window test_output" style="display:block;">
<div class='close_button pull-right'>
<button type="button" class="close" aria-label="Close" onfocus="this.blur();"
onclick="document.getElementById('div_et9.2').style.display='none'"><span
aria-hidden="true">&times;</span></button>
</div>
<div class="text-left pull-left">
<pre class="text-left">Traceback (most recent call last):
File &#34;/home/ozzie/Development/calibre-web-test/test/test_ebook_convert_gdrive.py&#34;, line 244, in test_convert_failed_and_email
select.select_by_visible_text(&#39;AZW3&#39;)
File &#34;/home/ozzie/Development/calibre-web-test/venv/lib/python3.10/site-packages/selenium/webdriver/support/select.py&#34;, line 134, in select_by_visible_text
raise NoSuchElementException(f&#34;Could not locate element with visible text: {text}&#34;)
selenium.common.exceptions.NoSuchElementException: Message: Could not locate element with visible text: AZW3</pre>
</div>
<div class="clearfix"></div>
</div>
<!--css div popup end-->
</td>
</tr> </tr>
@ -1215,11 +1173,11 @@ selenium.common.exceptions.NoSuchElementException: Message: Could not locate ele
<tr id="su" class="failClass"> <tr id="su" class="skipClass">
<td>TestEditBooks</td> <td>TestEditBooks</td>
<td class="text-center">36</td> <td class="text-center">36</td>
<td class="text-center">34</td> <td class="text-center">35</td>
<td class="text-center">1</td> <td class="text-center">0</td>
<td class="text-center">0</td> <td class="text-center">0</td>
<td class="text-center">1</td> <td class="text-center">1</td>
<td class="text-center"> <td class="text-center">
@ -1346,34 +1304,11 @@ selenium.common.exceptions.NoSuchElementException: Message: Could not locate ele
<tr id="ft13.14" class="none bg-danger"> <tr id='pt13.14' class='hiddenRow bg-success'>
<td> <td>
<div class='testcase'>TestEditBooks - test_edit_language</div> <div class='testcase'>TestEditBooks - test_edit_language</div>
</td> </td>
<td colspan='6'> <td colspan='6' align='center'>PASS</td>
<div class="text-center">
<a class="popup_link text-center" onfocus='blur()' onclick="showTestDetail('div_ft13.14')">FAIL</a>
</div>
<!--css div popup start-->
<div id="div_ft13.14" class="popup_window test_output" style="display:block;">
<div class='close_button pull-right'>
<button type="button" class="close" aria-label="Close" onfocus="this.blur();"
onclick="document.getElementById('div_ft13.14').style.display='none'"><span
aria-hidden="true">&times;</span></button>
</div>
<div class="text-left pull-left">
<pre class="text-left">Traceback (most recent call last):
File &#34;/home/ozzie/Development/calibre-web-test/test/test_edit_books.py&#34;, line 415, in test_edit_language
self.assertEqual(&#39;German&#39;, values[&#39;languages&#39;][1])
AssertionError: &#39;German&#39; != &#39;\n German&#39;
- German
+
German</pre>
</div>
<div class="clearfix"></div>
</div>
<!--css div popup end-->
</td>
</tr> </tr>
@ -1936,8 +1871,8 @@ AssertionError: &#39;German&#39; != &#39;\n German&#3
<tr id="su" class="errorClass"> <tr id="su" class="errorClass">
<td>TestEditBooksOnGdrive</td> <td>TestEditBooksOnGdrive</td>
<td class="text-center">18</td> <td class="text-center">18</td>
<td class="text-center">15</td> <td class="text-center">17</td>
<td class="text-center">2</td> <td class="text-center">0</td>
<td class="text-center">1</td> <td class="text-center">1</td>
<td class="text-center">0</td> <td class="text-center">0</td>
<td class="text-center"> <td class="text-center">
@ -2046,34 +1981,11 @@ AssertionError: &#39;German&#39; != &#39;\n German&#3
<tr id="ft18.12" class="none bg-danger"> <tr id='pt18.12' class='hiddenRow bg-success'>
<td> <td>
<div class='testcase'>TestEditBooksOnGdrive - test_edit_language</div> <div class='testcase'>TestEditBooksOnGdrive - test_edit_language</div>
</td> </td>
<td colspan='6'> <td colspan='6' align='center'>PASS</td>
<div class="text-center">
<a class="popup_link text-center" onfocus='blur()' onclick="showTestDetail('div_ft18.12')">FAIL</a>
</div>
<!--css div popup start-->
<div id="div_ft18.12" class="popup_window test_output" style="display:block;">
<div class='close_button pull-right'>
<button type="button" class="close" aria-label="Close" onfocus="this.blur();"
onclick="document.getElementById('div_ft18.12').style.display='none'"><span
aria-hidden="true">&times;</span></button>
</div>
<div class="text-left pull-left">
<pre class="text-left">Traceback (most recent call last):
File &#34;/home/ozzie/Development/calibre-web-test/test/test_edit_ebooks_gdrive.py&#34;, line 598, in test_edit_language
self.assertEqual(&#39;German&#39;, values[&#39;languages&#39;][1])
AssertionError: &#39;German&#39; != &#39;\n German&#39;
- German
+
German</pre>
</div>
<div class="clearfix"></div>
</div>
<!--css div popup end-->
</td>
</tr> </tr>
@ -2143,43 +2055,23 @@ IndexError: list index out of range</pre>
<tr id="ft18.18" class="none bg-danger"> <tr id='pt18.18' class='hiddenRow bg-success'>
<td> <td>
<div class='testcase'>TestEditBooksOnGdrive - test_watch_metadata</div> <div class='testcase'>TestEditBooksOnGdrive - test_watch_metadata</div>
</td> </td>
<td colspan='6'> <td colspan='6' align='center'>PASS</td>
<div class="text-center">
<a class="popup_link text-center" onfocus='blur()' onclick="showTestDetail('div_ft18.18')">FAIL</a>
</div>
<!--css div popup start-->
<div id="div_ft18.18" class="popup_window test_output" style="display:block;">
<div class='close_button pull-right'>
<button type="button" class="close" aria-label="Close" onfocus="this.blur();"
onclick="document.getElementById('div_ft18.18').style.display='none'"><span
aria-hidden="true">&times;</span></button>
</div>
<div class="text-left pull-left">
<pre class="text-left">Traceback (most recent call last):
File &#34;/home/ozzie/Development/calibre-web-test/test/test_edit_ebooks_gdrive.py&#34;, line 902, in test_watch_metadata
self.assertTrue(button)
AssertionError: False is not true</pre>
</div>
<div class="clearfix"></div>
</div>
<!--css div popup end-->
</td>
</tr> </tr>
<tr id="su" class="failClass"> <tr id="su" class="passClass">
<td>TestLoadMetadataScholar</td> <td>TestLoadMetadataScholar</td>
<td class="text-center">1</td> <td class="text-center">1</td>
<td class="text-center">0</td>
<td class="text-center">1</td> <td class="text-center">1</td>
<td class="text-center">0</td> <td class="text-center">0</td>
<td class="text-center">0</td> <td class="text-center">0</td>
<td class="text-center">0</td>
<td class="text-center"> <td class="text-center">
<a onclick="showClassDetail('c19', 1)">Detail</a> <a onclick="showClassDetail('c19', 1)">Detail</a>
</td> </td>
@ -2187,31 +2079,11 @@ AssertionError: False is not true</pre>
<tr id="ft19.1" class="none bg-danger"> <tr id='pt19.1' class='hiddenRow bg-success'>
<td> <td>
<div class='testcase'>TestLoadMetadataScholar - test_load_metadata</div> <div class='testcase'>TestLoadMetadataScholar - test_load_metadata</div>
</td> </td>
<td colspan='6'> <td colspan='6' align='center'>PASS</td>
<div class="text-center">
<a class="popup_link text-center" onfocus='blur()' onclick="showTestDetail('div_ft19.1')">FAIL</a>
</div>
<!--css div popup start-->
<div id="div_ft19.1" class="popup_window test_output" style="display:block;">
<div class='close_button pull-right'>
<button type="button" class="close" aria-label="Close" onfocus="this.blur();"
onclick="document.getElementById('div_ft19.1').style.display='none'"><span
aria-hidden="true">&times;</span></button>
</div>
<div class="text-left pull-left">
<pre class="text-left">Traceback (most recent call last):
File &#34;/home/ozzie/Development/calibre-web-test/test/test_edit_metadata_scholar.py&#34;, line 68, in test_load_metadata
self.assertEqual(30, len(results))
AssertionError: 30 != 0</pre>
</div>
<div class="clearfix"></div>
</div>
<!--css div popup end-->
</td>
</tr> </tr>
@ -3636,13 +3508,13 @@ AssertionError: 30 != 0</pre>
<tr id="su" class="passClass"> <tr id="su" class="passClass">
<td>TestReader</td> <td>TestReader</td>
<td class="text-center">5</td> <td class="text-center">6</td>
<td class="text-center">5</td> <td class="text-center">6</td>
<td class="text-center">0</td> <td class="text-center">0</td>
<td class="text-center">0</td> <td class="text-center">0</td>
<td class="text-center">0</td> <td class="text-center">0</td>
<td class="text-center"> <td class="text-center">
<a onclick="showClassDetail('c39', 5)">Detail</a> <a onclick="showClassDetail('c39', 6)">Detail</a>
</td> </td>
</tr> </tr>
@ -3650,7 +3522,7 @@ AssertionError: 30 != 0</pre>
<tr id='pt39.1' class='hiddenRow bg-success'> <tr id='pt39.1' class='hiddenRow bg-success'>
<td> <td>
<div class='testcase'>TestReader - test_comic_reader</div> <div class='testcase'>TestReader - test_comic_MACOS_files</div>
</td> </td>
<td colspan='6' align='center'>PASS</td> <td colspan='6' align='center'>PASS</td>
</tr> </tr>
@ -3659,7 +3531,7 @@ AssertionError: 30 != 0</pre>
<tr id='pt39.2' class='hiddenRow bg-success'> <tr id='pt39.2' class='hiddenRow bg-success'>
<td> <td>
<div class='testcase'>TestReader - test_epub_reader</div> <div class='testcase'>TestReader - test_comic_reader</div>
</td> </td>
<td colspan='6' align='center'>PASS</td> <td colspan='6' align='center'>PASS</td>
</tr> </tr>
@ -3668,7 +3540,7 @@ AssertionError: 30 != 0</pre>
<tr id='pt39.3' class='hiddenRow bg-success'> <tr id='pt39.3' class='hiddenRow bg-success'>
<td> <td>
<div class='testcase'>TestReader - test_pdf_reader</div> <div class='testcase'>TestReader - test_epub_reader</div>
</td> </td>
<td colspan='6' align='center'>PASS</td> <td colspan='6' align='center'>PASS</td>
</tr> </tr>
@ -3677,7 +3549,7 @@ AssertionError: 30 != 0</pre>
<tr id='pt39.4' class='hiddenRow bg-success'> <tr id='pt39.4' class='hiddenRow bg-success'>
<td> <td>
<div class='testcase'>TestReader - test_sound_listener</div> <div class='testcase'>TestReader - test_pdf_reader</div>
</td> </td>
<td colspan='6' align='center'>PASS</td> <td colspan='6' align='center'>PASS</td>
</tr> </tr>
@ -3685,6 +3557,15 @@ AssertionError: 30 != 0</pre>
<tr id='pt39.5' class='hiddenRow bg-success'> <tr id='pt39.5' class='hiddenRow bg-success'>
<td>
<div class='testcase'>TestReader - test_sound_listener</div>
</td>
<td colspan='6' align='center'>PASS</td>
</tr>
<tr id='pt39.6' class='hiddenRow bg-success'>
<td> <td>
<div class='testcase'>TestReader - test_txt_reader</div> <div class='testcase'>TestReader - test_txt_reader</div>
</td> </td>
@ -4143,7 +4024,7 @@ AssertionError: 30 != 0</pre>
<pre class="text-left">Traceback (most recent call last): <pre class="text-left">Traceback (most recent call last):
File &#34;/home/ozzie/Development/calibre-web-test/test/test_thumbnails.py&#34;, line 310, in test_sideloaded_book File &#34;/home/ozzie/Development/calibre-web-test/test/test_thumbnails.py&#34;, line 310, in test_sideloaded_book
self.assertAlmostEqual(diff(BytesIO(list_cover), BytesIO(old_list_cover), delete_diff_file=True), 0.0, 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)</pre> AssertionError: 0.007374011826953003 != 0.0 within 0.0001 delta (0.007374011826953003 difference)</pre>
</div> </div>
<div class="clearfix"></div> <div class="clearfix"></div>
</div> </div>
@ -5222,10 +5103,10 @@ AssertionError: 0.006465888577653282 != 0.0 within 0.0001 delta (0.0064658885776
<tr id='total_row' class="text-center bg-grey"> <tr id='total_row' class="text-center bg-grey">
<td>Total</td> <td>Total</td>
<td>454</td> <td>455</td>
<td>439</td> <td>446</td>
<td>6</td> <td>1</td>
<td>2</td> <td>1</td>
<td>7</td> <td>7</td>
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> </tr>
@ -5710,7 +5591,7 @@ AssertionError: 0.006465888577653282 != 0.0 within 0.0001 delta (0.0064658885776
</div> </div>
<script> <script>
drawCircle(439, 6, 2, 7); drawCircle(446, 1, 1, 7);
showCase(5); showCase(5);
</script> </script>