Skip to content

Commit 4129b1c

Browse files
committed
Use Hatch to run unit tests
1 parent 18bfb72 commit 4129b1c

File tree

5 files changed

+46
-22
lines changed

5 files changed

+46
-22
lines changed

.ci/run-nox.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
runs-on: ["ubuntu-latest"]
4444

4545
runs-on: ${{ matrix.runs-on }}
46-
name: test-${{ matrix.python-version }}
46+
name: test.py${{ matrix.python-version }}
4747
continue-on-error: ${{ matrix.experimental }}
4848
steps:
4949
- name: Checkout repository
@@ -54,17 +54,7 @@ jobs:
5454
python-version: ${{ matrix.python-version }}
5555
- name: Install dependencies
5656
run: |
57-
python -m pip install nox
57+
python -m pip install hatch
5858
- name: Run tests
5959
shell: bash
60-
run: .ci/run-nox.sh
61-
env:
62-
PYTHON_VERSION: ${{ matrix.python-version }}
63-
NOX_SESSION: ${{ matrix.nox-session }}
64-
# TEMPORARY for 3.11
65-
# https://github.com/aio-libs/aiohttp/issues/6600
66-
AIOHTTP_NO_EXTENSIONS: 1
67-
# https://github.com/aio-libs/frozenlist/issues/285
68-
FROZENLIST_NO_EXTENSIONS: 1
69-
# https://github.com/aio-libs/yarl/issues/680
70-
YARL_NO_EXTENSIONS: 1
60+
run: "hatch run test.py${{ matrix.python-version }}:test"

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ include MANIFEST.in
44
include README.rst
55
include NOTICE
66
include CHANGELOG.md
7-
include setup.py
7+
include pyproject.toml
88
recursive-include elasticsearch_serverless* py.typed *.pyi
99
recursive-include docs/sphinx *
1010

noxfile.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
SOURCE_DIR = os.path.dirname(os.path.abspath(__file__))
2323
SOURCE_FILES = (
2424
"docs/sphinx/conf.py",
25-
"setup.py",
2625
"noxfile.py",
2726
"elasticsearch_serverless/",
2827
"test_elasticsearch_serverless/",

pyproject.toml

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ Homepage = "https://github.com/elastic/elasticsearch-serverless-python"
4949
"Source Code" = "https://github.com/elastic/elasticsearch-serverless-python"
5050

5151
[tool.hatch.version]
52-
path = "elasticsearch_serverless/__init__.py"
52+
path = "elasticsearch_serverless/_version.py"
53+
pattern = "__versionstr__ = \"(?P<version>[^\"]+)\""
5354

5455
[tool.hatch.build.targets.sdist]
5556
include = [
@@ -70,3 +71,43 @@ exclude_lines = [
7071

7172
[tool.mypy]
7273
ignore_missing_imports = true
74+
75+
[tool.hatch.envs.test]
76+
extra-dependencies = [
77+
"requests>=2, <3",
78+
"aiohttp",
79+
"pytest",
80+
"pytest-cov",
81+
"pytest-asyncio",
82+
"coverage",
83+
"sphinx",
84+
"jinja2",
85+
"python-dateutil",
86+
"unasync",
87+
"pyyaml>=5.4",
88+
"isort",
89+
"black",
90+
"twine",
91+
"build",
92+
"nox",
93+
"numpy; python_version<'3.10'",
94+
"pandas; python_version<'3.10'",
95+
"mapbox-vector-tile; python_version<'3.10'",
96+
]
97+
98+
[tool.hatch.envs.test.scripts]
99+
test = [
100+
"""
101+
pytest \
102+
--cov-report=term-missing \
103+
--cov=elasticsearch_serverless \
104+
--cov-config=pyproject.toml \
105+
--junitxml=junit/elasticsearch-serverless-python-junit.xml \
106+
--log-level=DEBUG \
107+
--cache-clear \
108+
-vv
109+
""",
110+
]
111+
112+
[[tool.hatch.envs.test.matrix]]
113+
python = ["3.7", "3.8", "3.9", "3.10", "3.11"]

0 commit comments

Comments
 (0)