Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 0 additions & 12 deletions .coveragerc

This file was deleted.

9 changes: 6 additions & 3 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
os: ['ubuntu-22.04']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
cratedb-version: ['nightly']

fail-fast: false
Expand All @@ -35,11 +35,14 @@ jobs:
uses: astral-sh/setup-uv@v6
with:
cache-dependency-glob: |
setup.py
pyproject.toml
cache-suffix: ${{ matrix.python-version }}
enable-cache: true
version: "latest"

- name: Setup env
run: uv sync

- name: Invoke tests
run: |

Expand All @@ -56,4 +59,4 @@ jobs:
poe lint

# Run tests.
bin/test -vvv
poe test
20 changes: 10 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,15 @@ jobs:
- name: Set up uv
uses: astral-sh/setup-uv@v6
with:
cache-dependency-glob: |
pyproject.toml
cache-suffix: ${{ matrix.python-version }}
enable-cache: true
version: "latest"

- name: Setup env
run: uv sync

- name: Invoke tests
run: |

Expand All @@ -63,18 +67,14 @@ jobs:
# Bootstrap environment.
source bootstrap.sh

# Run linter.
uv run ruff check .

# Run type testing
uv run mypy

# Report about the test matrix slot.
echo "Invoking tests with CrateDB ${CRATEDB_VERSION}"
uv run coverage run -m pytest

# Set the stage for uploading the coverage report.
uv run coverage xml

# Run linter.
poe lint

# Run tests.
poe test

# https://github.com/codecov/codecov-action
- name: Upload coverage results to Codecov
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ coverage.xml
.installed.cfg
.tox/
*.DS_Store
*.lock
*.pyc
bin/*
!bin/test
Expand Down
34 changes: 11 additions & 23 deletions DEVELOP.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,9 @@ Running tests
=============

All tests will be invoked using the Python interpreter that was used when
creating the Python virtualenv. The test runner is `zope.testrunner`_.
creating the Python virtualenv. The test runner is `pytest`_.

Some examples are outlined below. In order to learn about more details,
see, for example, `useful command-line options for zope-testrunner`_.
Some examples are outlined below.

Run all tests::

Expand All @@ -37,35 +36,25 @@ Run all tests::
Run specific tests::

# Select modules.
bin/test -t test_cursor
bin/test -t client
bin/test -t testing
pytest -k test_cursor
pytest -k client
pytest -k testing

# Select doctests.
bin/test -t http.rst

Ignore specific test directories::

bin/test --ignore_dir=testing
pytest -k http.rst

The ``LayerTest`` test cases have quite some overhead. Omitting them will save
a few cycles (~70 seconds runtime)::

bin/test -t '!LayerTest'

Invoke all tests without integration tests (~10 seconds runtime)::

bin/test --layer '!crate.testing.layer.crate' --test '!LayerTest'
pytest -k 'not LayerTest'

Yet ~60 test cases, but only ~1 second runtime::
Yet ~75 test cases, but only ~2 seconds runtime::

bin/test --layer '!crate.testing.layer.crate' --test '!LayerTest' \
-t '!test_client_threaded' -t '!test_no_retry_on_read_timeout' \
-t '!test_wait_for_http' -t '!test_table_clustered_by'
pytest -k 'not (layer or multithreaded or read_timeout or wait_for or clustered_by or keep_alive)'

To inspect the whole list of test cases, run::

bin/test --list-tests
pytest --collect-only

The CI setup on GitHub Actions (GHA) provides a full test matrix covering
relevant Python versions. You can invoke the software tests against a specific
Expand Down Expand Up @@ -163,14 +152,13 @@ nothing special you need to do to get the live docs to update.
.. _@crate/docs: https://github.com/orgs/crate/teams/docs
.. _buildout: https://pypi.python.org/pypi/zc.buildout
.. _PyPI: https://pypi.python.org/pypi
.. _pytest: https://pytest.org/
.. _Python versions: https://docs.astral.sh/uv/concepts/python-versions/
.. _Read the Docs: http://readthedocs.org
.. _ReStructuredText: http://docutils.sourceforge.net/rst.html
.. _Sphinx: http://sphinx-doc.org/
.. _tests/assets/pki/*.pem: https://github.com/crate/crate-python/tree/main/tests/assets/pki
.. _twine: https://pypi.python.org/pypi/twine
.. _useful command-line options for zope-testrunner: https://pypi.org/project/zope.testrunner/#some-useful-command-line-options-to-get-you-started
.. _uv: https://docs.astral.sh/uv/
.. _UV_PYTHON: https://docs.astral.sh/uv/configuration/environment/#uv_python
.. _versions hosted on ReadTheDocs: https://readthedocs.org/projects/crate-python/versions/
.. _zope.testrunner: https://pypi.org/project/zope.testrunner/
17 changes: 0 additions & 17 deletions bin/test

This file was deleted.

45 changes: 42 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,19 +35,43 @@ classifiers = [
dependencies = [
"orjson>=3.11.3",
"urllib3>=2.5.0",
"verlib2>=0.3.1",
]

[dependency-groups]
dev = [
"certifi>=2025.10.5",
"coverage>=7.11.0",
"mypy>=1.18.2",
"poethepoet<1",
"pytest>=8.4.2",
"pytest-cov<8",
"pytz>=2025.2",
"ruff>=0.14.2",
"setuptools>=80.9.0",
"stopit>=1.1.2",
"verlib2>=0.3.1",
]


[tool.coverage.run]
branch = false
omit = [
"tests/*",
]
source = [ "src" ]

[tool.coverage.report]
fail_under = 0
show_missing = true
exclude_lines = [
"# pragma: no cover",
"raise NotImplemented",
]
omit = [
"*/.buildout/eggs/*",
"buildout-cache/eggs/*",
"eggs/*",
"parts/*",
"src/crate/client/_pep440.py",
]


Expand All @@ -67,6 +91,21 @@ namespace_packages = true
non_interactive = true


[tool.pytest.ini_options]
addopts = "-rA --verbosity=3 --cov --cov-report=term-missing --cov-report=xml"
minversion = "2.0"
log_level = "DEBUG"
log_cli_level = "DEBUG"
log_format = "%(asctime)-15s [%(name)-24s] %(levelname)-8s: %(message)s"
testpaths = [
"src",
"tests",
]
xfail_strict = true
markers = [
]


[tool.ruff]
line-length = 80

Expand Down Expand Up @@ -160,5 +199,5 @@ lint = [
]

test = [
{ cmd = "bin/test" },
{ cmd = "pytest" },
]
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ def read(path):
"pytz",
"zc.customdoctests>=1.0.1,<2",
"zope.testing>=4,<7",
"zope.testrunner>=5,<8",
],
},
python_requires=">=3.6",
Expand Down
Loading
Loading