From 6722c6dfee58c960d75ab24a6603714bbc79d87c Mon Sep 17 00:00:00 2001 From: "Martin K. Scherer" Date: Tue, 20 Aug 2024 10:43:29 +0200 Subject: [PATCH] test sqlite only for jvm versions > 8 --- test/jpypetest/test_sql_sqlite.py | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/test/jpypetest/test_sql_sqlite.py b/test/jpypetest/test_sql_sqlite.py index a63b4e02c..0b6156b64 100644 --- a/test/jpypetest/test_sql_sqlite.py +++ b/test/jpypetest/test_sql_sqlite.py @@ -1,15 +1,15 @@ # This file is Public Domain and may be used without restrictions, # because nobody should have to waste their lives typing this again. -import jpype -from jpype.types import * -from jpype import java -import jpype.dbapi2 as dbapi2 -import common import datetime import decimal +import sys import threading -java = jpype.java +import common +import jpype +import jpype.dbapi2 as dbapi2 +from jpype import java, isJVMStarted +from jpype.types import * try: import zlib @@ -20,12 +20,22 @@ db_name = "jdbc:sqlite::memory:" +if isJVMStarted(): + java_version = str(jpype.java.lang.System.getProperty("java.version")) + java_version = java_version.split(".") + + if java_version[0] == "8":# and sys.platform == "win": + raise common.unittest.SkipTest("sqlite unsupported on this config.") + + class ConnectTestCase(common.JPypeTestCase): def setUp(self): common.JPypeTestCase.setUp(self) if common.fast: raise common.unittest.SkipTest("fast") + + def testConnect(self): cx = dbapi2.connect(db_name) self.assertIsInstance(cx, dbapi2.Connection)