File missing-duckdb.patch of Package python-sqlglot

---
 tests/test_executor.py  |    7 ++++++-
 tests/test_optimizer.py |    7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

--- a/tests/test_executor.py
+++ b/tests/test_executor.py
@@ -1,6 +1,10 @@
 import unittest
 
-import duckdb
+try:
+    import duckdb
+    DUCKDB_AVAILABLE = True
+except ImportError:
+    DUCKDB_AVAILABLE = False
 import pandas as pd
 from pandas.testing import assert_frame_equal
 
@@ -12,6 +16,7 @@ from tests.helpers import FIXTURES_DIR,
 DIR = FIXTURES_DIR + "/optimizer/tpc-h/"
 
 
+@unittest.skipUnless(DUCKDB_AVAILABLE, "Cannot work without duckdb.")
 class TestExecutor(unittest.TestCase):
     @classmethod
     def setUpClass(cls):
--- a/tests/test_optimizer.py
+++ b/tests/test_optimizer.py
@@ -1,7 +1,11 @@
 import unittest
 from functools import partial
 
-import duckdb
+try:
+    import duckdb
+    DUCKDB_AVAILABLE = True
+except ImportError:
+    DUCKDB_AVAILABLE = False
 from pandas.testing import assert_frame_equal
 
 import sqlglot
@@ -18,6 +22,7 @@ from tests.helpers import (
 )
 
 
+@unittest.skipUnless(DUCKDB_AVAILABLE, "Cannot work without duckdb.")
 class TestOptimizer(unittest.TestCase):
     maxDiff = None
 
openSUSE Build Service is sponsored by