Skip to content

Commit

Permalink
Remove no longer needed normalizers + test on Windows. (#106)
Browse files Browse the repository at this point in the history
There are normalizers for windows, so make sure they work.
  • Loading branch information
icemac committed Dec 15, 2023
1 parent 52e8034 commit 061afa5
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 41 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
matrix:
os:
- ["ubuntu", "ubuntu-20.04"]
- ["windows", "windows-latest"]
config:
# [Python version, tox env]
- ["3.9", "lint"]
Expand All @@ -26,13 +27,18 @@ jobs:
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["3.12", "py312"]
- ["pypy-3.9", "pypy3"]
- ["3.9", "docs"]
- ["3.9", "coverage"]
exclude:
- { os: ["windows", "windows-latest"], config: ["3.9", "lint"] }
- { os: ["windows", "windows-latest"], config: ["3.9", "docs"] }
- { os: ["windows", "windows-latest"], config: ["3.9", "coverage"] }

runs-on: ${{ matrix.os[1] }}
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
name: ${{ matrix.config[1] }}
name: ${{ matrix.os[0] }}-${{ matrix.config[1] }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
Expand Down
5 changes: 3 additions & 2 deletions .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
[meta]
template = "pure-python"
commit-id = "fd874ae4"
commit-id = "13b9049c"

[python]
with-windows = false
with-windows = true
with-pypy = true
with-future-python = false
with-docs = true
Expand All @@ -23,6 +23,7 @@ fail-under = 70

[manifest]
additional-rules = [
"include *.yaml",
"recursive-include docs *.bat",
"recursive-include src *.gif",
"recursive-include src *.html",
Expand Down
25 changes: 25 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/pure-python
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py

# We recommend specifying your dependencies to enable reproducible builds:
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt
- method: pip
path: .
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ recursive-include docs *.txt
recursive-include docs Makefile

recursive-include src *.py
include *.yaml
recursive-include docs *.bat
recursive-include src *.gif
recursive-include src *.html
Expand Down
6 changes: 3 additions & 3 deletions docs/narrative.rst
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ The headers can be accessed as a string:
>>> print(browser.headers)
... # doctest: +NORMALIZE_WHITESPACE
Status: 200 OK
Content-Length: 109
Content-Length: ...
Content-Type: text/html; charset=UTF-8

Or as a mapping:
Expand Down Expand Up @@ -380,7 +380,7 @@ When finding a link by its text, whitespace is normalized.
.. doctest::

>>> browser.open('http://localhost/@@/testbrowser/navigate.html')
>>> browser.contents
>>> browser.contents.replace('\r', '')
'...> Link Text \n with Whitespace\tNormalization (and parens) </...'
>>> link = browser.getLink('Link Text with Whitespace Normalization '
... '(and parens)')
Expand Down Expand Up @@ -1002,7 +1002,7 @@ Text Area Control
<Control name='textarea-value' type='textarea'>
>>> verifyObject(interfaces.IControl, ctrl)
True
>>> ctrl.value
>>> ctrl.value.replace('\r', '')
' Text inside\n area!\n '
>>> ctrl.value = 'A lot of\n text.'
>>> ctrl.disabled
Expand Down
27 changes: 0 additions & 27 deletions src/zope/testbrowser/tests/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,9 @@ def sub(self, replacement, text):
(re.compile(r'boundary=\S+\.\S+\.\S+'), 'boundary=' + '-' * 30),
(re.compile(r'^---{10}.*', re.M), '-' * 30),
(re.compile(r'boundary=-{10}.*'), 'boundary=' + '-' * 30),
(re.compile(r'User-agent:\s+\S+'), 'User-agent: Python-urllib/2.4'),
(re.compile(r'HTTP_USER_AGENT:\s+\S+'),
'HTTP_USER_AGENT: Python-urllib/2.4'),
(re.compile(r'Content-[Ll]ength:.*'), 'Content-Length: 123'),
(re.compile(r'Status: 200.*'), 'Status: 200 OK'),
(win32CRLFtransformer(), None),
(re.compile(r'User-Agent: Python-urllib/2.[567]'),
'User-agent: Python-urllib/2.4'),
# (re.compile(r'Host: localhost(:80)?'), 'Connection: close'),
(re.compile(r'Content-Type: '), 'Content-type: '),
(re.compile(r'Content-Disposition: '), 'Content-disposition: '),
Expand All @@ -44,28 +39,6 @@ def sub(self, replacement, text):
r"59, 59, tzinfo=<UTC>\),"),
"'expires': datetime.datetime(2030, 1, 1, 0, 0, tzinfo=<UTC>),"),

# python3 formats exceptions differently
(re.compile(r'zope.testbrowser.browser.BrowserStateError'),
'BrowserStateError'),
(re.compile(r'zope.testbrowser.interfaces.ExpiredError'),
'ExpiredError'),
(re.compile(r'zope.testbrowser.browser.LinkNotFoundError'),
'LinkNotFoundError'),
(re.compile(r'zope.testbrowser.browser.AmbiguityError'),
'AmbiguityError'),
(re.compile(r'zope.testbrowser.ftests.wsgitestapp.NotFound'),
'NotFound'),
(re.compile(r'zope.testbrowser.interfaces.AlreadyExpiredError'),
'AlreadyExpiredError'),
(re.compile(r'zope.testbrowser.browser.RobotExclusionError'),
'RobotExclusionError'),
(re.compile(r'urllib.error.HTTPError'),
'HTTPError'),

# In py3 HTTPMessage class was moved and represented differently
(re.compile(r'<http.client.HTTPMessage object'),
'<httplib.HTTPMessage instance'),

# Ignore output returned by GHA for PyPy3
(re.compile('/etc/ssl/certs/ca-certificates.crt /etc/ssl/certs'), ''),
])
32 changes: 24 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,58 @@
[tox]
minversion = 3.18
envlist =
release-check
lint
py37
py38
py39
py310
py311
py312
pypy3
docs
coverage

[testenv]
usedevelop = true
package = wheel
wheel_build_env = .pkg
deps =
setenv =
ZOPE_INTERFACE_STRICT_IRO=1
py312: VIRTUALENV_PIP=23.1.2
py312: PIP_REQUIRE_VIRTUALENV=0
commands =
zope-testrunner --test-path=src {posargs:-vc}
sphinx-build -b doctest -d {envdir}/.cache/doctrees docs {envdir}/.cache/doctest
extras =
test
docs

[testenv:lint]
[testenv:release-check]
description = ensure that the distribution is ready to release
basepython = python3
skip_install = true
deps =
twine
build
check-manifest
check-python-versions >= 0.20.0
wheel
commands =
isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py
flake8 src setup.py
check-manifest
check-python-versions
python -m build --sdist --no-isolation
twine check dist/*

[testenv:lint]
basepython = python3
skip_install = true
deps =
check-manifest
check-python-versions >= 0.19.1
wheel
flake8
isort
flake8
commands =
isort --check-only --diff {toxinidir}/src {toxinidir}/setup.py
flake8 src setup.py

[testenv:isort-apply]
basepython = python3
Expand Down

0 comments on commit 061afa5

Please sign in to comment.