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
20 changes: 0 additions & 20 deletions .coveragerc

This file was deleted.

39 changes: 21 additions & 18 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,37 +36,40 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.py }}
architecture: ${{ matrix.architecture }}
- run: pip install tox
- name: Running tox
run: tox -e py
enable-cache: true
- name: Run tests
run: uv run pytest

coverage:
runs-on: ubuntu-latest
name: Validate coverage
# Assume coverage is identical across supported versions of Python.
# Choose the latest Python.
steps:
- uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: 3.12
architecture: x64
- run: pip install tox
- run: tox -e py312,coverage
python-version: "3.12"
enable-cache: true
- name: Run tests with coverage
run: uv run pytest --cov
- name: Check coverage
run: uv run coverage report --show-missing --fail-under=95

docs:
runs-on: ubuntu-latest
name: Build the documentation
steps:
- uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: 3.12
architecture: x64
- run: pip install tox
- run: tox -e docs
python-version: "3.12"
enable-cache: true
- name: Build docs
run: uv run --group docs sphinx-build -W -E -b html docs docs/_build/html
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ docs/_themes/
.settings/
.coverage*
eggs
uv.lock
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ News
------------------

- Nothing changed yet.
- Migrate the project to uv.


3.0.7 (2025-10-06)
Expand Down
9 changes: 0 additions & 9 deletions MANIFEST.in

This file was deleted.

81 changes: 30 additions & 51 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ Get your working copy :

$ git clone https://github.com/Pylons/webtest.git
$ cd webtest
$ virtualenv .
$ . bin/activate
$ python setup.py dev
$ uv sync

Now, you can hack.

Expand All @@ -23,72 +21,53 @@ Execute tests

.. code-block:: bash

$ bin/pytest
Doctest: forms.rst ... ok
Doctest: index.rst ... ok

...

test_url_class (tests.test_testing.TestTesting) ... ok
tests.test_testing.test_print_unicode ... °C
ok

Name Stmts Miss Cover Missing
------------------------------------------------
webtest 18 0 100%
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
webtest.compat 50 11 78% 28-34, 55-56, 61-62
webtest.debugapp 58 0 100%
webtest.ext 80 0 100%
webtest.forms 324 23 93% 23, 49, 58, 61, 92, 116, 177, 205, 411, 478, 482-486, 491-493, 522, 538, 558-561
webtest.http 78 0 100%
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
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
webtest.utils 99 11 89% 19-20, 23, 26, 32, 38, 100, 109, 152-154
------------------------------------------------
TOTAL 2004 500 75%
----------------------------------------------------------------------
Ran 70 tests in 14.940s
$ uv run pytest
============================= test session starts ==============================
platform linux -- Python 3.14.0, pytest-9.0.2, pluggy-1.6.0
rootdir: /home/user/webtest
configfile: pyproject.toml
plugins: cov-7.0.0
collected 206 items

tests/test_app.py ............................................ [ 21%]
tests/test_authorisation.py ... [ 22%]
tests/test_debugapp.py ...................... [ 33%]
tests/test_ext.py . [ 33%]
tests/test_forms.py .................................................... [ 59%]
. [ 59%]
tests/test_http.py .... [ 61%]
tests/test_lint.py ............................ [ 75%]
tests/test_response.py ............................... [ 90%]
tests/test_sel.py . [ 90%]
tests/test_utils.py .................. [ 99%]
webtest/forms.py . [100%]

============================= 206 passed in 3.81s ==============================


Use tox to test many Python versions
====================================

`Tox <https://tox.readthedocs.io/en/latest/>`_ installation :

.. code-block:: bash

$ pip install tox
$ tox

Launch tests with *tox* :

.. code-block:: bash

$ bin/tox
py26: commands succeeded
py27: commands succeeded
py32: commands succeeded
py33: commands succeeded
$ uvx --with tox-uv tox
py39: commands succeeded
py310: commands succeeded
py311: commands succeeded
py312: commands succeeded

To execute test on all python versions, you need to have ``python2.6``, ``python2.7``, ``python3.2`` and ``python3.3`` in your ``PATH``.
To execute tests on all Python versions, you need to have ``python3.9``, ``python3.10``, ``python3.11`` and ``python3.12`` in your ``PATH``.


Generate documentation
======================

.. code-block:: bash

$ pip install Sphinx
$ cd docs
$ make html
../bin/sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v1.1.3
loading pickled environment... done

...

build succeeded, 3 warnings.
build succeeded.

Build finished. The HTML pages are in _build/html.

Expand Down
132 changes: 132 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "WebTest"
version = "3.0.8.dev0"
description = "Helper to test WSGI applications"
readme = "README.rst"
license = "MIT"
requires-python = ">=3.9"
authors = [
{ name = "Ian Bicking" },
]
maintainers = [
{ name = "Gael Pasgrimaud", email = "[email protected]" },
]
keywords = ["wsgi", "test", "unit", "tests", "web"]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Framework :: Paste",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Topic :: Internet :: WWW/HTTP :: WSGI",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Server",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"WebOb>=1.2",
"waitress>=3.0.2",
"beautifulsoup4",
]

[project.urls]
Homepage = "https://docs.pylonsproject.org/projects/webtest/en/latest/"

[dependency-groups]
dev = [
"coverage",
"PasteDeploy",
"pyquery",
"pytest",
"pytest-cov",
"WSGIProxy2",
]
docs = [
"docutils",
"pylons-sphinx-themes>=1.0.8",
"Sphinx>=3.0.0",
]

[project.entry-points."paste.app_factory"]
debug = "webtest.debugapp:make_debug_app"

[tool.pytest.ini_options]
addopts = [
"-p", "no:warnings",
"--doctest-modules",
"--doctest-glob=*.rst",
"--ignore=docs/",
"--ignore=CHANGES.rst",
"--ignore=setup.py",
"--ignore=bootstrap.py",
"--ignore=examples/",
"--ignore=docs/conf.py",
"-W", "always",
]
doctest_optionflags = ["NORMALIZE_WHITESPACE", "ELLIPSIS"]

[tool.hatch.build.targets.sdist]
include = [
"webtest/",
"tests/",
"docs/",
"pyproject.toml",
"README.rst",
"CHANGELOG.rst",
"license.rst",
]

[tool.hatch.build.targets.wheel]
packages = ["webtest"]

[tool.coverage.run]
source_pkgs = ["webtest"]
branch = true
relative_files = true

[tool.coverage.report]
exclude_lines = [
"pragma: no cover",
"def __repr__",
"raise NotImplementedError",
"if __name__ == .__main__.:",
"def parse_args",
]

[tool.tox]
env_list = ["py39", "py310", "py311", "py312", "coverage", "docs"]
skip_missing_interpreters = true

[tool.tox.env_run_base]
dependency_groups = ["dev"]
set_env = { LC_ALL = "C", LANG = "C", COVERAGE_FILE = ".coverage.{env_name}" }
commands = [
["python", "--version"],
["pytest", "--cov", "{posargs}"],
]

[tool.tox.env.coverage]
depends = ["py39", "py310", "py311", "py312"]
skip_install = true
deps = ["coverage"]
set_env = { COVERAGE_FILE = ".coverage" }
commands = [
["coverage", "combine"],
["coverage", "xml"],
["coverage", "report", "--show-missing", "--fail-under=95"],
]

[tool.tox.env.docs]
base_python = ["python3.12"]
dependency_groups = ["docs"]
allowlist_externals = ["make"]
commands = [
["make", "-C", "docs", "html", "BUILDDIR={env_dir}", "SPHINXOPTS=-W -E"],
]
18 changes: 0 additions & 18 deletions setup.cfg

This file was deleted.

Loading
Loading