Open
Description
gsnedders@gsnedders-margot tools % tox p -e py38,py39,py310,py311,py312,py313 -- --no-cov 'wptserve/wptserve/cgi/test_cgi.py::CgiTests::test_log'
py313: OK ✔ in 0.84 seconds
py39: FAIL ✖ in 22.94 seconds
py39: install_deps> python -I -m pip install -r /Volumes/gsnedders/projects/wpt/web-platform-tests/tools/requirements_pytest.txt -r /Volumes/gsnedders/projects/wpt/web-platform-tests/tools/requirements_tests.txt
py39: commands[0]> pytest --cov=tools --cov-report=term --no-cov wptserve/wptserve/cgi/test_cgi.py::CgiTests::test_log
=========================================================== test session starts ===========================================================
platform darwin -- Python 3.9.6, pytest-8.3.2, pluggy-1.6.0
cachedir: .tox/py39/.pytest_cache
rootdir: /Volumes/gsnedders/projects/wpt/web-platform-tests/tools
configfile: pytest.ini
plugins: cov-5.0.0, anyio-4.9.0, hypothesis-6.112.0
collected 1 item
wptserve/wptserve/cgi/test_cgi.py F [100%]
================================================================ FAILURES =================================================================
____________________________________________________________ CgiTests.test_log ____________________________________________________________
self = <wptserve.cgi.test_cgi.CgiTests testMethod=test_log>
def test_log(self):
with warnings.catch_warnings():
warnings.simplefilter('ignore', category=DeprecationWarning)
cgi.log("Testing")
cgi.logfp = StringIO()
cgi.initlog("%s", "Testing initlog 1")
cgi.log("%s", "Testing log 2")
self.assertEqual(cgi.logfp.getvalue(), "Testing initlog 1\nTesting log 2\n")
if os.path.exists(os.devnull):
cgi.logfp = None
cgi.logfile = os.devnull
> cgi.initlog("%s", "Testing log 3")
wptserve/wptserve/cgi/test_cgi.py:302:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
allargs = ('%s', 'Testing log 3'), kwargs = {'encoding': 'locale'}
def initlog(*allargs):
"""Write a log message, if there is a log file.
Even though this function is called initlog(), you should always
use log(); log is a variable that is set either to initlog
(initially), to dolog (once the log file has been opened), or to
nolog (when logging is disabled).
The first argument is a format string; the remaining arguments (if
any) are arguments to the % operator, so e.g.
log("%s: %s", "a", "b")
will write "a: b" to the log file, followed by a newline.
If the global logfp is not None, it should be a file object to
which log data is written.
If the global logfp is None, the global logfile may be a string
giving a filename to open, in append mode. This file should be
world writable!!! If the file can't be opened, logging is
silently disabled (since there is no safe place where we could
send an error message).
"""
global log, logfile, logfp
warnings.warn("cgi.log() is deprecated as of 3.10. Use logging instead",
DeprecationWarning, stacklevel=2)
if logfile and not logfp:
try:
kwargs = {}
if sys.version_info > (3, 9):
kwargs["encoding"] = "locale"
> logfp = open(logfile, "a", **kwargs)
E LookupError: unknown encoding: locale
wptserve/wptserve/cgi/cgi.py:95: LookupError
========================================================= short test summary info =========================================================
FAILED wptserve/wptserve/cgi/test_cgi.py::CgiTests::test_log - LookupError: unknown encoding: locale
============================================================ 1 failed in 0.16s ============================================================
py39: exit 1 (1.79 seconds) /Volumes/gsnedders/projects/wpt/web-platform-tests/tools> pytest --cov=tools --cov-report=term --no-cov wptserve/wptserve/cgi/test_cgi.py::CgiTests::test_log pid=65393
py38: OK ✔ in 24.64 seconds
py310: OK ✔ in 25.32 seconds
py311: OK ✔ in 25.62 seconds
py38: OK (24.64=setup[22.63]+cmd[2.01] seconds)
py39: FAIL code 1 (22.94=setup[21.15]+cmd[1.79] seconds)
py310: OK (25.32=setup[20.66]+cmd[4.66] seconds)
py311: OK (25.62=setup[20.73]+cmd[4.89] seconds)
py312: OK (26.88=setup[22.25]+cmd[4.63] seconds)
py313: OK (0.84=setup[0.14]+cmd[0.70] seconds)
evaluation failed :( (27.05 seconds)
I guess the version check is wrong? This is what we get for only testing on 3.8 and 3.13. 😢