diff --git a/.github/workflows/tests-ssl.yml b/.github/workflows/tests-ssl.yml
index 52a133285..ea3c5ee4b 100644
--- a/.github/workflows/tests-ssl.yml
+++ b/.github/workflows/tests-ssl.yml
@@ -226,6 +226,29 @@ jobs:
run: |
mkdir -p reports
+ - name: Print DNS and Python environment
+ run: |
+ source venv/bin/activate
+ python - << 'EOF'
+ import asyncio
+ import dns
+ import dns.version
+ import dns.asyncresolver
+
+ print("Python version:")
+ import sys; print(sys.version)
+
+ print("\nEvent loop policy:")
+ print(asyncio.get_event_loop_policy())
+
+ print("\nDnspython version:")
+ print(dns.version.version)
+
+ print("\nAsync resolver instance:")
+ r = dns.asyncresolver.Resolver()
+ print(r)
+ EOF
+
- name: Run tests
env:
PYTHONPATH: ./gaussdb:./gaussdb_pool
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index cf01d0aa8..296eec2b8 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -96,7 +96,7 @@ jobs:
GAUSSDB_TEST_DSN: "host=127.0.0.1 port=5432 dbname=test user=root password=Passwd@123 "
run: |
source venv/bin/activate
- pytest -s -v
+ pytest -s -v -W ignore::pytest.PytestUnraisableExceptionWarning
- name: Cleanup
if: always()
diff --git a/README.rst b/README.rst
index 50d10b0b5..a4c5c8804 100644
--- a/README.rst
+++ b/README.rst
@@ -34,7 +34,7 @@ This project is a **fork** of `psycopg`, originally developed by the Psycopg Tea
**gaussdb** inherits the same license. All modifications are distributed under the **LGPL v3**.
-See the full license text in the :download:`LICENSE.txt` file.
+See the full license text in the `LICENSE.txt` file.
.. note::
@@ -134,7 +134,7 @@ Now hack away! You can run the tests using on GaussDB::
# Set the Python import path to include your local GaussDB Python project
# Replace your_path with actual values
- export PYTHONPATH=/your_path/gaussdb-python
+ export PYTHONPATH="/your_path/gaussdb-python/gaussdb:/your_path/gaussdb-python/gaussdb_pool"
# Select the pure-Python implementation of the GaussDB adapter
export PSYCOPG_IMPL=python
@@ -183,7 +183,7 @@ Recommended Steps to Run OpenGauss with Python GaussDB Driver Testing (Assuming
# Set the Python import path to include your local GaussDB Python project
# Replace your_path with actual values
- export PYTHONPATH=/your_path/gaussdb-python
+ export PYTHONPATH="/your_path/gaussdb-python/gaussdb:/your_path/gaussdb-python/gaussdb_pool"
# Select the pure-Python implementation of the GaussDB adapter
export PSYCOPG_IMPL=python
@@ -207,7 +207,7 @@ Steps to Run OpenGauss(SSL) with Python GaussDB Driver Testing (Assuming Docker
# Set the Python import path to include your local GaussDB Python project
# Replace your_path with actual values
- export PYTHONPATH=/your_path/gaussdb-python
+ export PYTHONPATH="/your_path/gaussdb-python/gaussdb:/your_path/gaussdb-python/gaussdb_pool"
# Select the pure-Python implementation of the GaussDB adapter
export PSYCOPG_IMPL=python
diff --git a/gaussdb/README.rst b/gaussdb/README.rst
index 18a07fcb1..39bba3900 100644
--- a/gaussdb/README.rst
+++ b/gaussdb/README.rst
@@ -45,7 +45,7 @@ This project is a **fork** of `psycopg `_, originally
**gaussdb** inherits the same license. All modifications are distributed under the **LGPL v3**.
-See the full license text in the :download:`LICENSE.txt` file.
+See the full license text in the `LICENSE.txt` file.
.. note::
diff --git a/gaussdb/pyproject.toml b/gaussdb/pyproject.toml
index 298a661f4..8931c1b4b 100644
--- a/gaussdb/pyproject.toml
+++ b/gaussdb/pyproject.toml
@@ -7,7 +7,7 @@ name = "gaussdb"
description = "GaussDB database adapter for Python"
# STOP AND READ! if you change:
-version = "1.0.3"
+version = "1.0.4"
# also change:
# - `docs/news.rst` to declare this as the current version or an unreleased one;
# - `gaussdb_c/pyproject.toml` to the same version;
diff --git a/gaussdb_pool/README.rst b/gaussdb_pool/README.rst
index 2a364cf8a..01fda966c 100644
--- a/gaussdb_pool/README.rst
+++ b/gaussdb_pool/README.rst
@@ -27,7 +27,7 @@ This project is a **fork** of `psycopg `_, originally
**gaussdb_pool** inherits the same license. All modifications are distributed under the **LGPL v3**.
-See the full license text in the :download:`LICENSE.txt` file.
+See the full license text in the `LICENSE.txt` file.
.. note::
diff --git a/gaussdb_pool/pyproject.toml b/gaussdb_pool/pyproject.toml
index 28ec50718..e4fbb0dd3 100644
--- a/gaussdb_pool/pyproject.toml
+++ b/gaussdb_pool/pyproject.toml
@@ -7,7 +7,7 @@ name = "gaussdb-pool"
description = "Connection Pool for GaussDB"
# STOP AND READ! if you change:
-version = "1.0.3"
+version = "1.0.4"
# also change:
# - `docs/news_pool.rst` to declare this version current or unreleased
diff --git a/tests/conftest.py b/tests/conftest.py
index ba51b2728..6bf49f07b 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -146,6 +146,39 @@ def get_database_type():
return ""
+def get_wal_level():
+ dsn = os.getenv("DSN") or os.getenv("GAUSSDB_TEST_DSN")
+ if not dsn:
+ print("DSN environment variable not set")
+ return ""
+
+ try:
+ conn = pq.PGconn.connect(dsn.encode("utf-8"))
+ if conn.status != pq.ConnStatus.OK:
+ print(f"Connection failed: {conn.error_message.decode()}")
+ conn.finish()
+ return ""
+
+ res = conn.exec_(b"SHOW wal_level;")
+ if res.status != pq.ExecStatus.TUPLES_OK:
+ print(f"Query failed: {conn.error_message.decode()}")
+ res.clear()
+ conn.finish()
+ return ""
+
+ raw_wal_level = res.get_value(0, 0)
+ wal_level = ""
+ if raw_wal_level:
+ wal_level = raw_wal_level.decode().lower()
+
+ res.clear()
+ conn.finish()
+ return wal_level
+ except Exception as e:
+ print(f"Failed to get wal_level: {e}")
+ return ""
+
+
def pytest_collection_modifyitems(config, items):
res = get_database_type()
print(f"Database type: {res}")
diff --git a/tests/fix_faker.py b/tests/fix_faker.py
index 33097e86e..8e892356d 100644
--- a/tests/fix_faker.py
+++ b/tests/fix_faker.py
@@ -315,6 +315,11 @@ def example(self, spec):
def match_any(self, spec, got, want):
if spec == dt.timedelta:
assert abs((got - want).total_seconds()) < 86400 * 2
+ elif spec in (bytes, bytearray, memoryview):
+ if want in (b"", bytearray(b"")) or want is None:
+ assert got in (None, b"", bytearray(b""), memoryview(b""))
+ else:
+ assert got == want
else:
assert got == want
diff --git a/tests/test_logical_decoding.py b/tests/test_logical_decoding.py
index 949f636ef..69010cbbe 100644
--- a/tests/test_logical_decoding.py
+++ b/tests/test_logical_decoding.py
@@ -1,10 +1,20 @@
import pytest
+from .conftest import get_wal_level
+
SLOT_NAME = "slot_test"
SCHEMA = "my_schema"
TABLE = "test01"
+@pytest.fixture(scope="session", autouse=True)
+def check_wal_level():
+ """Check if wal_level is set to logical, skip tests if not."""
+ wal_level = get_wal_level()
+ if wal_level != "logical":
+ pytest.skip(f"wal_level={wal_level!r}, expected 'logical'")
+
+
def _slot_exists(conn, slot_name):
cur = conn.cursor()
cur.execute(
@@ -37,7 +47,7 @@ def _cleanup_slot_and_schema(conn):
@pytest.fixture(scope="function")
-def setup_env(conn):
+def setup_env(conn, check_wal_level):
"""Ensure clean environment for each test."""
_cleanup_slot_and_schema(conn)
cur = conn.cursor()
diff --git a/tests/types/test_composite.py b/tests/types/test_composite.py
index fada429f3..de9820c97 100644
--- a/tests/types/test_composite.py
+++ b/tests/types/test_composite.py
@@ -8,6 +8,7 @@
from gaussdb.types.composite import register_composite
from ..utils import eur
+from ..conftest import get_database_type
from ..fix_crdb import crdb_skip_message, is_crdb
from ..test_adapt import StrNoneBinaryDumper, StrNoneDumper
@@ -162,6 +163,9 @@ def test_load_record_binary(conn, want, rec):
def testcomp(svcconn):
if is_crdb(svcconn):
pytest.skip(crdb_skip_message("composite"))
+ res = get_database_type()
+ if res == "gaussdb":
+ pytest.skip("gaussdb not support.")
cur = svcconn.cursor()
cur.execute(
"""
diff --git a/tests/types/test_range.py b/tests/types/test_range.py
index fad789bc9..f81e73bf9 100644
--- a/tests/types/test_range.py
+++ b/tests/types/test_range.py
@@ -10,6 +10,7 @@
from gaussdb.types.range import Range, RangeInfo, register_range
from ..utils import eur
+from ..conftest import get_database_type
from ..fix_crdb import crdb_skip_message, is_crdb
from ..test_adapt import StrNoneBinaryDumper, StrNoneDumper
@@ -268,11 +269,14 @@ def create_test_range(conn):
if is_crdb(conn):
pytest.skip(crdb_skip_message("range"))
+ res = get_database_type()
+ if res == "gaussdb":
+ pytest.skip("gaussdb not support.")
+
conn.execute(
"""
drop schema if exists testschema cascade;
create schema testschema;
-
drop type if exists testrange cascade;
drop type if exists testschema.testrange cascade;
diff --git a/tools/isort-gaussdb/README.rst b/tools/isort-gaussdb/README.rst
index 07392eff9..07476c488 100644
--- a/tools/isort-gaussdb/README.rst
+++ b/tools/isort-gaussdb/README.rst
@@ -41,7 +41,7 @@ This project is a **fork** of `psycopg `_, originally
**isort-gaussdb** inherits the same license. All modifications are distributed under the **LGPL v3**.
-See the full license text in the :download:`LICENSE.txt` file.
+See the full license text in the `LICENSE.txt` file.
.. note::
diff --git a/tools/isort-gaussdb/pyproject.toml b/tools/isort-gaussdb/pyproject.toml
index 7c56f20a0..565b428ae 100644
--- a/tools/isort-gaussdb/pyproject.toml
+++ b/tools/isort-gaussdb/pyproject.toml
@@ -8,7 +8,7 @@ description = "isort plug-in to sort imports by module length first"
# Note: to release a new version:
# python -m build -o dist --wheel .
# twine upload dist/isort_gaussdb-*-py3-none-any.whl
-version = "0.0.5"
+version = "0.0.6"
[project.urls]
Homepage = "https://github.com/HuaweiCloudDeveloper/gaussdb-python/"