Skip to content

Commit b9e4d12

Browse files
committed
chore: migrate the project to uv
1 parent 090d6a5 commit b9e4d12

File tree

10 files changed

+185
-229
lines changed

10 files changed

+185
-229
lines changed

.coveragerc

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

.github/workflows/ci-tests.yml

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,37 +36,40 @@ jobs:
3636
runs-on: ${{ matrix.os }}
3737
steps:
3838
- uses: actions/checkout@v4
39-
- name: Setup python
40-
uses: actions/setup-python@v5
39+
- name: Install uv
40+
uses: astral-sh/setup-uv@v5
4141
with:
4242
python-version: ${{ matrix.py }}
43-
architecture: ${{ matrix.architecture }}
44-
- run: pip install tox
45-
- name: Running tox
46-
run: tox -e py
43+
enable-cache: true
44+
- name: Run tests
45+
run: uv run pytest
46+
4747
coverage:
4848
runs-on: ubuntu-latest
4949
name: Validate coverage
5050
# Assume coverage is identical across supported versions of Python.
5151
# Choose the latest Python.
5252
steps:
5353
- uses: actions/checkout@v4
54-
- name: Setup python
55-
uses: actions/setup-python@v5
54+
- name: Install uv
55+
uses: astral-sh/setup-uv@v5
5656
with:
57-
python-version: 3.12
58-
architecture: x64
59-
- run: pip install tox
60-
- run: tox -e py312,coverage
57+
python-version: "3.12"
58+
enable-cache: true
59+
- name: Run tests with coverage
60+
run: uv run pytest --cov
61+
- name: Check coverage
62+
run: uv run coverage report --show-missing --fail-under=95
63+
6164
docs:
6265
runs-on: ubuntu-latest
6366
name: Build the documentation
6467
steps:
6568
- uses: actions/checkout@v4
66-
- name: Setup python
67-
uses: actions/setup-python@v5
69+
- name: Install uv
70+
uses: astral-sh/setup-uv@v5
6871
with:
69-
python-version: 3.12
70-
architecture: x64
71-
- run: pip install tox
72-
- run: tox -e docs
72+
python-version: "3.12"
73+
enable-cache: true
74+
- name: Build docs
75+
run: uv run --group docs sphinx-build -W -E -b html docs docs/_build/html

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ docs/_themes/
1717
.settings/
1818
.coverage*
1919
eggs
20+
uv.lock

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ News
55
------------------
66

77
- Nothing changed yet.
8+
- Migrate the project to uv.
89

910

1011
3.0.7 (2025-10-06)

MANIFEST.in

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

docs/contributing.rst

Lines changed: 30 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ Get your working copy :
1111
1212
$ git clone https://github.com/Pylons/webtest.git
1313
$ cd webtest
14-
$ virtualenv .
15-
$ . bin/activate
16-
$ python setup.py dev
14+
$ uv sync
1715
1816
Now, you can hack.
1917

@@ -23,72 +21,53 @@ Execute tests
2321

2422
.. code-block:: bash
2523
26-
$ bin/pytest
27-
Doctest: forms.rst ... ok
28-
Doctest: index.rst ... ok
29-
30-
...
31-
32-
test_url_class (tests.test_testing.TestTesting) ... ok
33-
tests.test_testing.test_print_unicode ... °C
34-
ok
35-
36-
Name Stmts Miss Cover Missing
37-
------------------------------------------------
38-
webtest 18 0 100%
39-
webtest.app 603 92 85% 48, 61-62, 94, 98, 212-221, 264-265, 268-272, 347, 379-386, 422, 426-428, 432-434, 455, 463, 471, 473, 488, 496-497, 515, 520-527, 548, 553-554, 558-559, 577, 592, 597-598, 618, 624, 661-664, 742, 808, 872, 940-941, 945-948, 961-964, 975, 982, 995, 1000, 1006, 1010, 1049, 1051, 1095-1096, 1118-1119, 1122-1127, 1135-1136, 1148, 1155-1160, 1175
40-
webtest.compat 50 11 78% 28-34, 55-56, 61-62
41-
webtest.debugapp 58 0 100%
42-
webtest.ext 80 0 100%
43-
webtest.forms 324 23 93% 23, 49, 58, 61, 92, 116, 177, 205, 411, 478, 482-486, 491-493, 522, 538, 558-561
44-
webtest.http 78 0 100%
45-
webtest.lint 215 45 79% 135, 176, 214-216, 219-224, 227-231, 234, 243-244, 247, 250-251, 254, 263-264, 270, 274, 307, 311, 335, 359, 407, 424-427, 441-444, 476-479, 493, 508
46-
webtest.sel 479 318 34% 38-39, 45-46, 64-78, 88-108, 120, 126, 151-153, 156-158, 164-165, 168-191, 194-201, 219-231, 236, 240, 243-259, 263-297, 301-306, 316-326, 331-336, 340, 344, 347-352, 357-359, 364, 392-394, 397-404, 408, 412-417, 421, 425-426, 430, 434, 438, 442, 445, 448-457, 470-480, 483-485, 488, 492, 495, 503, 506, 515-516, 520, 524, 528, 533, 538, 542-544, 547, 560-565, 576, 579, 582, 593-596, 599-602, 605-606, 617-620, 623-642, 668-677, 680-688, 715, 720, 732, 735, 744-754, 757-762, 770-779, 791, 794, 805-809, 813-826, 838-842
47-
webtest.utils 99 11 89% 19-20, 23, 26, 32, 38, 100, 109, 152-154
48-
------------------------------------------------
49-
TOTAL 2004 500 75%
50-
----------------------------------------------------------------------
51-
Ran 70 tests in 14.940s
24+
$ uv run pytest
25+
============================= test session starts ==============================
26+
platform linux -- Python 3.14.0, pytest-9.0.2, pluggy-1.6.0
27+
rootdir: /home/user/webtest
28+
configfile: pyproject.toml
29+
plugins: cov-7.0.0
30+
collected 206 items
31+
32+
tests/test_app.py ............................................ [ 21%]
33+
tests/test_authorisation.py ... [ 22%]
34+
tests/test_debugapp.py ...................... [ 33%]
35+
tests/test_ext.py . [ 33%]
36+
tests/test_forms.py .................................................... [ 59%]
37+
. [ 59%]
38+
tests/test_http.py .... [ 61%]
39+
tests/test_lint.py ............................ [ 75%]
40+
tests/test_response.py ............................... [ 90%]
41+
tests/test_sel.py . [ 90%]
42+
tests/test_utils.py .................. [ 99%]
43+
webtest/forms.py . [100%]
44+
45+
============================= 206 passed in 3.81s ==============================
5246
5347
5448
Use tox to test many Python versions
5549
====================================
5650

57-
`Tox <https://tox.readthedocs.io/en/latest/>`_ installation :
58-
59-
.. code-block:: bash
60-
61-
$ pip install tox
62-
$ tox
63-
64-
Launch tests with *tox* :
65-
6651
.. code-block:: bash
6752
68-
$ bin/tox
69-
py26: commands succeeded
70-
py27: commands succeeded
71-
py32: commands succeeded
72-
py33: commands succeeded
53+
$ uvx --with tox-uv tox
54+
py39: commands succeeded
55+
py310: commands succeeded
56+
py311: commands succeeded
57+
py312: commands succeeded
7358
74-
To execute test on all python versions, you need to have ``python2.6``, ``python2.7``, ``python3.2`` and ``python3.3`` in your ``PATH``.
59+
To execute tests on all Python versions, you need to have ``python3.9``, ``python3.10``, ``python3.11`` and ``python3.12`` in your ``PATH``.
7560

7661

7762
Generate documentation
7863
======================
7964

8065
.. code-block:: bash
8166
82-
$ pip install Sphinx
8367
$ cd docs
8468
$ make html
85-
../bin/sphinx-build -b html -d _build/doctrees . _build/html
86-
Running Sphinx v1.1.3
87-
loading pickled environment... done
88-
8969
...
90-
91-
build succeeded, 3 warnings.
70+
build succeeded.
9271
9372
Build finished. The HTML pages are in _build/html.
9473

pyproject.toml

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
[build-system]
2+
requires = ["hatchling"]
3+
build-backend = "hatchling.build"
4+
5+
[project]
6+
name = "WebTest"
7+
version = "3.0.8.dev0"
8+
description = "Helper to test WSGI applications"
9+
readme = "README.rst"
10+
license = "MIT"
11+
requires-python = ">=3.9"
12+
authors = [
13+
{ name = "Ian Bicking" },
14+
]
15+
maintainers = [
16+
{ name = "Gael Pasgrimaud", email = "[email protected]" },
17+
]
18+
keywords = ["wsgi", "test", "unit", "tests", "web"]
19+
classifiers = [
20+
"Development Status :: 5 - Production/Stable",
21+
"Framework :: Paste",
22+
"Intended Audience :: Developers",
23+
"License :: OSI Approved :: MIT License",
24+
"Topic :: Internet :: WWW/HTTP :: WSGI",
25+
"Topic :: Internet :: WWW/HTTP :: WSGI :: Server",
26+
"Programming Language :: Python :: 3",
27+
"Programming Language :: Python :: 3 :: Only",
28+
"Programming Language :: Python :: 3.9",
29+
"Programming Language :: Python :: 3.10",
30+
"Programming Language :: Python :: 3.11",
31+
"Programming Language :: Python :: 3.12",
32+
]
33+
dependencies = [
34+
"WebOb>=1.2",
35+
"waitress>=3.0.2",
36+
"beautifulsoup4",
37+
]
38+
39+
[project.urls]
40+
Homepage = "https://docs.pylonsproject.org/projects/webtest/en/latest/"
41+
42+
[dependency-groups]
43+
dev = [
44+
"coverage",
45+
"PasteDeploy",
46+
"pyquery",
47+
"pytest",
48+
"pytest-cov",
49+
"WSGIProxy2",
50+
]
51+
docs = [
52+
"docutils",
53+
"pylons-sphinx-themes>=1.0.8",
54+
"Sphinx>=3.0.0",
55+
]
56+
57+
[project.entry-points."paste.app_factory"]
58+
debug = "webtest.debugapp:make_debug_app"
59+
60+
[tool.pytest.ini_options]
61+
addopts = [
62+
"-p", "no:warnings",
63+
"--doctest-modules",
64+
"--doctest-glob=*.rst",
65+
"--ignore=docs/",
66+
"--ignore=CHANGES.rst",
67+
"--ignore=setup.py",
68+
"--ignore=bootstrap.py",
69+
"--ignore=examples/",
70+
"--ignore=docs/conf.py",
71+
"-W", "always",
72+
]
73+
doctest_optionflags = ["NORMALIZE_WHITESPACE", "ELLIPSIS"]
74+
75+
[tool.hatch.build.targets.sdist]
76+
include = [
77+
"webtest/",
78+
"tests/",
79+
"docs/",
80+
"pyproject.toml",
81+
"README.rst",
82+
"CHANGELOG.rst",
83+
"license.rst",
84+
]
85+
86+
[tool.hatch.build.targets.wheel]
87+
packages = ["webtest"]
88+
89+
[tool.coverage.run]
90+
source_pkgs = ["webtest"]
91+
branch = true
92+
relative_files = true
93+
94+
[tool.coverage.report]
95+
exclude_lines = [
96+
"pragma: no cover",
97+
"def __repr__",
98+
"raise NotImplementedError",
99+
"if __name__ == .__main__.:",
100+
"def parse_args",
101+
]
102+
103+
[tool.tox]
104+
env_list = ["py39", "py310", "py311", "py312", "coverage", "docs"]
105+
skip_missing_interpreters = true
106+
107+
[tool.tox.env_run_base]
108+
dependency_groups = ["dev"]
109+
set_env = { LC_ALL = "C", LANG = "C", COVERAGE_FILE = ".coverage.{env_name}" }
110+
commands = [
111+
["python", "--version"],
112+
["pytest", "--cov", "{posargs}"],
113+
]
114+
115+
[tool.tox.env.coverage]
116+
depends = ["py39", "py310", "py311", "py312"]
117+
skip_install = true
118+
deps = ["coverage"]
119+
set_env = { COVERAGE_FILE = ".coverage" }
120+
commands = [
121+
["coverage", "combine"],
122+
["coverage", "xml"],
123+
["coverage", "report", "--show-missing", "--fail-under=95"],
124+
]
125+
126+
[tool.tox.env.docs]
127+
base_python = ["python3.12"]
128+
dependency_groups = ["docs"]
129+
allowlist_externals = ["make"]
130+
commands = [
131+
["make", "-C", "docs", "html", "BUILDDIR={env_dir}", "SPHINXOPTS=-W -E"],
132+
]

setup.cfg

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

0 commit comments

Comments
 (0)