From 1bb2f20064abcebb84a773ab20d36e28d8821b77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Edgar=20Ram=C3=ADrez=20Mondrag=C3=B3n?= Date: Wed, 29 Nov 2023 00:28:36 -0600 Subject: [PATCH] XFail duckdb tests in Python 3.12 --- noxfile.py | 10 ++++++++++ poetry.lock | 2 +- pyproject.toml | 7 +++++-- tests/core/test_connector_sql.py | 7 +++++++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/noxfile.py b/noxfile.py index c3b70c1c14..8f66a14c7e 100644 --- a/noxfile.py +++ b/noxfile.py @@ -52,6 +52,13 @@ ] +def _clean_py312_deps(session: Session, dependencies: list[str]) -> None: + """Clean dependencies for Python 3.12.""" + if session.python == "3.12": + dependencies.remove("duckdb") + dependencies.remove("duckdb-engine") + + @session(python=main_python_version) def mypy(session: Session) -> None: """Check types with mypy.""" @@ -77,6 +84,7 @@ def mypy(session: Session) -> None: @session(python=python_versions) def tests(session: Session) -> None: """Execute pytest tests and compute coverage.""" + _clean_py312_deps(session, test_dependencies) session.install(".[s3,parquet]") session.install(*test_dependencies) @@ -107,6 +115,7 @@ def tests(session: Session) -> None: @session(python=main_python_version) def benches(session: Session) -> None: """Run benchmarks.""" + _clean_py312_deps(session, test_dependencies) session.install(".[s3]") session.install(*test_dependencies) sqlalchemy_version = os.environ.get("SQLALCHEMY_VERSION") @@ -129,6 +138,7 @@ def update_snapshots(session: Session) -> None: """Update pytest snapshots.""" args = session.posargs or ["-m", "snapshot"] + _clean_py312_deps(session, test_dependencies) session.install(".") session.install(*test_dependencies) session.run("pytest", "--snapshot-update", *args) diff --git a/poetry.lock b/poetry.lock index f3c5b638a0..dc3341b1b0 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3043,4 +3043,4 @@ testing = ["pytest", "pytest-durations"] [metadata] lock-version = "2.0" python-versions = ">=3.7.1" -content-hash = "820fa4251810015fd8ac178335c062fc590caac41f173e5f4975b1397d3f6d3c" +content-hash = "b1c894a8518bcb32a963611b6818d2066bcffb9f515915a0e40cbbe0d3aa85df" diff --git a/pyproject.toml b/pyproject.toml index a3adbde0ce..9c5ce104f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -125,8 +125,11 @@ coverage = [ {extras = ["toml"], version = ">=7.2,<7.3", python = "<3.8"}, {extras = ["toml"], version = ">=7.2", python = ">=3.8"}, ] -duckdb = ">=0.8.0" -duckdb-engine = ">=0.9.2" + +# TODO: Remove the Python 3.12 marker when DuckDB supports it +duckdb = { version = ">=0.8.0", python = "<3.12" } +duckdb-engine = { version = ">=0.9.2", python = "<3.12" } + mypy = [ { version = ">=1.0,<1.5", python = "<3.8" }, { version = ">=1.0", python = ">=3.8" }, diff --git a/tests/core/test_connector_sql.py b/tests/core/test_connector_sql.py index c07188ff79..83f10cfbb6 100644 --- a/tests/core/test_connector_sql.py +++ b/tests/core/test_connector_sql.py @@ -1,5 +1,6 @@ from __future__ import annotations +import sys import typing as t from decimal import Decimal from unittest import mock @@ -7,6 +8,7 @@ import pytest import sqlalchemy from sqlalchemy.dialects import registry, sqlite +from sqlalchemy.exc import NoSuchModuleError from singer_sdk.connectors import SQLConnector from singer_sdk.exceptions import ConfigValidationError @@ -308,6 +310,11 @@ def get_column_alter_ddl( ) +@pytest.mark.xfail( + reason="DuckDB does not build on Python 3.12 yet", + condition=sys.version_info >= (3, 12), + raises=NoSuchModuleError, +) class TestDuckDBConnector: @pytest.fixture def connector(self):