Patchwork [STABLE] tests: require SQLite 3.8.3+ as sqlitestore relies on "WITH" clause

login
register
mail settings
Submitter Yuya Nishihara
Date Nov. 2, 2018, 12:49 p.m.
Message ID <d12b6941f9ac56cebc16.1541162942@mimosa>
Download mbox | patch
Permalink /patch/36334/
State Accepted
Headers show

Comments

Yuya Nishihara - Nov. 2, 2018, 12:49 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1541161535 -32400
#      Fri Nov 02 21:25:35 2018 +0900
# Branch stable
# Node ID d12b6941f9ac56cebc165fa83ad982db202335a2
# Parent  41f48262b845632a1fca09e79d72fdb8eb1eb624
tests: require SQLite 3.8.3+ as sqlitestore relies on "WITH" clause

The test fails on gcc112 because the SQLite is too old.

https://sqlite.org/changes.html#version_3_8_3
Boris Feld - Nov. 6, 2018, 11:37 a.m.
This patch seems to have been queued and is part of the 4.8 release.

On 02/11/2018 13:49, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1541161535 -32400
> #      Fri Nov 02 21:25:35 2018 +0900
> # Branch stable
> # Node ID d12b6941f9ac56cebc165fa83ad982db202335a2
> # Parent  41f48262b845632a1fca09e79d72fdb8eb1eb624
> tests: require SQLite 3.8.3+ as sqlitestore relies on "WITH" clause
>
> The test fails on gcc112 because the SQLite is too old.
>
> https://sqlite.org/changes.html#version_3_8_3
>
> diff --git a/tests/hghave.py b/tests/hghave.py
> --- a/tests/hghave.py
> +++ b/tests/hghave.py
> @@ -791,10 +791,14 @@ def has_repofncache():
>  def has_sqlite():
>      try:
>          import sqlite3
> -        sqlite3.sqlite_version
> +        version = sqlite3.sqlite_version_info
>      except ImportError:
>          return False
>  
> +    if version < (3, 8, 3):
> +        # WITH clause not supported
> +        return False
> +
>      return matchoutput('sqlite3 -version', b'^3\.\d+')
>  
>  @check('vcr', 'vcr http mocking library')
> diff --git a/tests/test-storage.py b/tests/test-storage.py
> --- a/tests/test-storage.py
> +++ b/tests/test-storage.py
> @@ -25,6 +25,14 @@ except ImportError:
>      sqlitestore = None
>  
>  try:
> +    import sqlite3
> +    if sqlite3.sqlite_version_info < (3, 8, 3):
> +        # WITH clause not supported
> +        sqlitestore = None
> +except ImportError:
> +    pass
> +
> +try:
>      from mercurial import zstd
>      zstd.__version__
>  except ImportError:
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/tests/hghave.py b/tests/hghave.py
--- a/tests/hghave.py
+++ b/tests/hghave.py
@@ -791,10 +791,14 @@  def has_repofncache():
 def has_sqlite():
     try:
         import sqlite3
-        sqlite3.sqlite_version
+        version = sqlite3.sqlite_version_info
     except ImportError:
         return False
 
+    if version < (3, 8, 3):
+        # WITH clause not supported
+        return False
+
     return matchoutput('sqlite3 -version', b'^3\.\d+')
 
 @check('vcr', 'vcr http mocking library')
diff --git a/tests/test-storage.py b/tests/test-storage.py
--- a/tests/test-storage.py
+++ b/tests/test-storage.py
@@ -25,6 +25,14 @@  except ImportError:
     sqlitestore = None
 
 try:
+    import sqlite3
+    if sqlite3.sqlite_version_info < (3, 8, 3):
+        # WITH clause not supported
+        sqlitestore = None
+except ImportError:
+    pass
+
+try:
     from mercurial import zstd
     zstd.__version__
 except ImportError: