Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
f89062a
test: Add pytest plugins for - timestamper (timestamps in debug), run…
paultiq Sep 17, 2025
c235630
test: When using duckdb_cursor fixture, use a distinct database for e…
paultiq Sep 17, 2025
f91ea33
test: use tmp_path fixture to allow concurrent tests to run and avoid…
paultiq Sep 17, 2025
e0f81b9
test: move the 10M row test to tests/slow, as it takes > 1min / is n…
paultiq Sep 17, 2025
2f24ce0
test: use distinct table names in each test. While doesn't allow thre…
paultiq Sep 17, 2025
2e9d080
test: use pytest-raises to catch the expected error and add a timeout…
paultiq Sep 17, 2025
8312c34
ci: reduce the verbosity of the build step by add --quiet to uv export
paultiq Sep 17, 2025
69a1013
revert: restore ccache installs
paultiq Sep 17, 2025
57c543c
CI: Add a Stress Tests workflow
paultiq Sep 17, 2025
bea2a70
test: add a default_con fixture that guarantees a "clean" connection,…
paultiq Sep 17, 2025
7a5f672
tests: fix test use of default connection
paultiq Sep 18, 2025
8763045
test: be more generous with test_keyboard_interruption timeout: 15s
paultiq Sep 18, 2025
f361b08
disable package installs
paultiq Sep 18, 2025
81edd90
ci: update comment
paultiq Sep 18, 2025
86afd8d
ci: install and no-build
paultiq Sep 18, 2025
8218e54
ci: move environment variables to appropriate step
paultiq Sep 18, 2025
52360f2
ci: simplify workflow
paultiq Sep 18, 2025
a8d97f4
ci: simplify and fix yaml
paultiq Sep 18, 2025
b432bb5
ci: fix yaml
paultiq Sep 18, 2025
8d01617
ci: initialize the venv
paultiq Sep 18, 2025
64a05c7
ci: Simplify and avoid editables
paultiq Sep 18, 2025
02a6c2b
avoid the rebuild
paultiq Sep 18, 2025
81144fa
Simple install
paultiq Sep 18, 2025
9e84040
ci: enable SCCACHE
paultiq Sep 18, 2025
050b3fc
ci: env vars for sccache
paultiq Sep 18, 2025
431e05a
try different
paultiq Sep 18, 2025
e591d94
ci: include pyproject.toml
paultiq Sep 18, 2025
bc60905
try wheel first
paultiq Sep 18, 2025
3f7d34a
no-build-isolation
paultiq Sep 18, 2025
7f8816f
ci: Try a ccache solution due to rate limiting
paultiq Sep 18, 2025
962727b
"" not ccache
paultiq Sep 18, 2025
6601b2d
debug prints
paultiq Sep 18, 2025
8323550
ci shrink w
paultiq Sep 18, 2025
5ab762b
ci: reduce cmakelists for ci testing
paultiq Sep 18, 2025
e0b6cb0
ci: compile
paultiq Sep 18, 2025
761a41e
Try speeding up
paultiq Sep 18, 2025
a856df2
ci 123
paultiq Sep 18, 2025
ab0c7e4
add a minimal build option
paultiq Sep 18, 2025
b845777
ci
paultiq Sep 18, 2025
a3f9c8f
DISABLE_UNITY
paultiq Sep 18, 2025
7ad0448
revert
paultiq Sep 18, 2025
74c626b
ci: right dir
paultiq Sep 19, 2025
c02a17d
revert
paultiq Sep 19, 2025
6545204
ci: use a single key
paultiq Sep 19, 2025
1871990
back to sccache
paultiq Sep 19, 2025
ac38fd0
ci set ""
paultiq Sep 19, 2025
a5cd567
ci: testing
paultiq Sep 19, 2025
68f2482
ci: difference install
paultiq Sep 19, 2025
10d728e
reduce test size
paultiq Sep 19, 2025
415fc9e
--no-build-isolation
paultiq Sep 19, 2025
3c26205
ci t3
paultiq Sep 19, 2025
f65f973
ffetch-depth: 0
paultiq Sep 19, 2025
ede993b
ci
paultiq Sep 19, 2025
4aa4ba0
test uv
paultiq Sep 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
154 changes: 154 additions & 0 deletions .github/workflows/additional_testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: Stress Tests
on:
push:

env:
OS: ubuntu-24.04
ARCH: x86_64
CIBW_SYSTEM: manylinux
PYTHON_VERSION: cp313
TESTSUITE: fast
ITERATIONS: 3



jobs:
build:
name: "Build wheel: cp313-manylinux_x86_64"
runs-on: ubuntu-24.04

steps:
- name: Checkout DuckDB Python
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true

- uses: astral-sh/setup-uv@v6
with:
version: "0.8.16"
enable-cache: false
cache-suffix: -${{ env.PYTHON_VERSION }}-${{ env.OS }}
python-version: ${{ env.PYTHON_VERSION }}

- name: Export test requirements
shell: bash
run: |
ls -l
ls -l external
uv export --only-group test --no-emit-project --output-file test-requirements.txt --quiet
- name: Configure Cache Env
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_RESULTS_URL', process.env.ACTIONS_RESULTS_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Build wheel
uses: pypa/[email protected]
env:
CIBW_ARCHS: ${{ env.ARCH }}
CIBW_BUILD: ${{ env.PYTHON_VERSION }}-${{ env.CIBW_SYSTEM }}_${{ env.ARCH }}
CIBW_TEST_SKIP: '*'
# Platform-specific ccache installation commands
CIBW_BEFORE_TEST: >
sccache --show-stats &&
uv export --only-group test --no-emit-project --output-file pylock.toml --directory {project} --quiet &&
uv pip install -r pylock.toml
CIBW_TEST_COMMAND: sccache --show-stats
CIBW_BEFORE_BUILD_LINUX: >
if [ "$(uname -m)" = "aarch64" ]; then ARCH=aarch64; else ARCH=x86_64; fi &&
curl -L https://github.com/mozilla/sccache/releases/download/v0.10.0/sccache-v0.10.0-${ARCH}-unknown-linux-musl.tar.gz | tar xz &&
cp sccache-v0.10.0-${ARCH}-unknown-linux-musl/sccache /usr/bin &&
sccache --show-stats
CIBW_BEFORE_BUILD_MACOS: brew install sccache
CIBW_BEFORE_BUILD_WINDOWS: >
del "C:\Strawberry\c\bin\ccache.exe" &&
choco install sccache
SCCACHE_GHA_ENABLED: "on"
SCCACHE_C_CUSTOM_CACHE_BUSTER: ${{ env.PYTHON_VERSION }}-${{ env.OS }}
ACTIONS_CACHE_SERVICE_V2: "1"
CIBW_ENVIRONMENT: CMAKE_C_COMPILER_LAUNCHER="" CMAKE_CXX_COMPILER_LAUNCHER="" CFLAGS="-Wno-attributes" CXXFLAGS="-Wno-attributes"
CIBW_ENVIRONMENT_PASS: SCCACHE_GHA_ENABLED ACTIONS_RUNTIME_TOKEN ACTIONS_RESULTS_URL ACTIONS_CACHE_SERVICE_V2 SCCACHE_C_CUSTOM_CACHE_BUSTER PYTHON_GIL
- name: Upload test requirements
uses: actions/upload-artifact@v4
with:
name: test-requirements-${{ env.PYTHON_VERSION }}-${{ env.CIBW_SYSTEM }}_${{ env.ARCH }}
path: test-requirements.txt

- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: wheel-${{ env.PYTHON_VERSION }}-${{ env.CIBW_SYSTEM }}_${{ env.ARCH }}
path: wheelhouse/

test:
name: 'Test: ${{ matrix.pytest_config.name }} - cp313-manylinux_x86_64'
runs-on: ubuntu-24.04
needs: build
strategy:
fail-fast: false
matrix:
pytest_config:
- name: "Random Order" # randomization is automatic due to pytest-randomly
args: ""
iterations: 3
- name: "Multiprocess" # uses pytest-xdist
args: "-n auto"
iterations: 3
- name: "Threaded" # uses pytest-run-parallel
# TODO: Update to use threading specific tests or explicitly mark unsafe tests. test_module was chosen as an example.
args: "--parallel-threads=4 --iterations=8 tests/fast/test_module.py --ignore"
iterations: 1

steps:
- uses: astral-sh/setup-uv@v6
with:
version: "0.8.16"
enable-cache: true
activate-environment: true
cache-suffix: -${{ env.PYTHON_VERSION }}-${{ env.OS }}
python-version: ${{ env.PYTHON_VERSION }}

- name: Checkout test files only
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true

- name: Download wheel
uses: actions/download-artifact@v4
with:
name: wheel-${{ env.PYTHON_VERSION }}-${{ env.CIBW_SYSTEM }}_${{ env.ARCH }}
path: wheelhouse/

- name: Download test requirements
uses: actions/download-artifact@v4
with:
name: test-requirements-${{ env.PYTHON_VERSION }}-${{ env.CIBW_SYSTEM }}_${{ env.ARCH }}
path: .

- name: Install dependencies
shell: bash
run: |
uv sync --no-install-project
uv pip install wheelhouse/*.whl

- name: Run ${{ matrix.pytest_config.name }} tests
shell: bash
run: |
TEST_TARGET="tests/fast"
ITERATIONS="${{ matrix.pytest_config.iterations }}"
PYTEST_ARGS="${{ matrix.pytest_config.args }}"

echo "Running ${{ matrix.pytest_config.name }} pytest $ITERATIONS times against: $TEST_TARGET"
for i in $(seq 1 $ITERATIONS); do
echo ""
echo "${{ matrix.pytest_config.name }} Run $i/$ITERATIONS:"
echo "--------"
pytest $PYTEST_ARGS "$TEST_TARGET" --durations=5
if [ $? -ne 0 ]; then
echo "${{ matrix.pytest_config.name }} Run $i failed!"
else
echo "${{ matrix.pytest_config.name }} Run $i passed!"
fi
done
9 changes: 6 additions & 3 deletions .github/workflows/packaging_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python: [ cp39, cp310, cp311, cp312, cp313, cp314, cp314t ]
python: [cp313, cp314t ] # cp39, cp310, cp311, cp312, cp313, cp314,
platform:
- { os: windows-2025, arch: amd64, cibw_system: win }
- { os: ubuntu-24.04, arch: x86_64, cibw_system: manylinux }
Expand All @@ -41,10 +41,13 @@ jobs:
minimal:
- ${{ inputs.minimal }}
exclude:
- { minimal: true, python: cp39 }
- { minimal: true, python: cp310 }
- { minimal: true, python: cp311 }
- { minimal: true, python: cp312 }
- { minimal: true, platform: { arch: universal2 } }
- { minimal: true, python: cp313 }
- { minimal: true, platform: { os: macos-15 } }
- { minimal: true, platform: { os: macos-13 } }
# Windows+cp314t disabled due to test failures in CI.
# TODO: Diagnose why tests fail (access violations) in some configurations
- { python: cp314t, platform: { os: windows-2025 } }
Expand All @@ -54,7 +57,7 @@ jobs:
CIBW_TEST_SKIP: ${{ inputs.testsuite == 'none' && '*' || '*-macosx_universal2' }}
CIBW_TEST_SOURCES: tests
CIBW_BEFORE_TEST: >
uv export --only-group test --no-emit-project --output-file pylock.toml --directory {project} &&
uv export --only-group test --no-emit-project --output-file pylock.toml --directory {project} --quiet &&
uv pip install -r pylock.toml
CIBW_TEST_COMMAND: >
uv run -v pytest ${{ inputs.testsuite == 'fast' && './tests/fast' || './tests' }} --verbose --ignore=./tests/stubs
Expand Down
19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,17 @@ if.env.COVERAGE = false
inherit.cmake.define = "append"
cmake.define.DISABLE_UNITY = "1"

# Override: CI minimal build - disable all extensions
[[tool.scikit-build.overrides]]
if.env.CI_MINIMAL_BUILD = true
inherit.cmake.define = "none"
cmake.define.CORE_EXTENSIONS = ""
cmake.define.BUILD_EXTENSIONS = ""
cmake.define.DISABLE_BUILTIN_EXTENSIONS = "ON"
cmake.define.BUILD_SHELL = "OFF"
cmake.define.BUILD_UNITTESTS = "OFF"
cmake.define.BUILD_BENCHMARKS = "OFF"

[tool.scikit-build.sdist]
include = [
"README.md",
Expand Down Expand Up @@ -227,6 +238,10 @@ test = [ # dependencies used for running tests
"pytest",
"pytest-reraise",
"pytest-timeout",
"pytest-xdist", # multi-processed tests, if `-n <num_workers> | auto`
"pytest-randomly", # randomizes test order to ensure no test dependencies, enabled on install
"pytest-run-parallel", # multi-threaded tests, if `--parallel-threads=N --iterations=N`
"pytest-timestamper", # Adds timestamps to test output
"mypy",
"coverage",
"gcovr; python_version < '3.14'",
Expand Down Expand Up @@ -306,6 +321,10 @@ filterwarnings = [
"ignore:distutils Version classes are deprecated:DeprecationWarning",
"ignore:is_datetime64tz_dtype is deprecated:DeprecationWarning",
]
timeout = 300 # don't let individual tests run for more than 5 minutes
thread_unsafe_fixtures = [ # https://pypi.org/project/pytest-run-parallel/
'default_con'
]

[tool.coverage.run]
branch = true
Expand Down
16 changes: 12 additions & 4 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,18 @@ def spark():


@pytest.fixture(scope='function')
def duckdb_cursor():
connection = duckdb.connect('')
yield connection
connection.close()
def duckdb_cursor(tmp_path):
with duckdb.connect(tmp_path / "mytest") as connection:
yield connection


@pytest.fixture(scope='function')
def default_con():
# ensures each test uses a fresh default connection to avoid test leakage
# threading_unsafe fixture, marked as such in pyproject.toml
duckdb.default_connection().close()
with duckdb.default_connection() as conn:
yield conn


@pytest.fixture(scope='function')
Expand Down
Loading
Loading