-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace bespoke logging facility with logging module #183
Conversation
0a50760
to
b6d204b
Compare
…version 65.5.0 Anderson Bravalheri (10): Improve warnings in editable install Document CWD limitations in editable docs Fix RST syntax in changelog Add news fragment Update validate_pyproject Add news fragment Docs: fix url Handle no-packages projects in editable_wheel Add news fragment Bump version: 65.4.1 → 65.5.0 Jason R. Coombs (10): Adopt furo theme for docs. Indicate to use latest Python version (workaround for readthedocs/readthedocs.org/#9623). Requires also specifying the OS version (workaround for readthedocs/readthedocs.org#9635). Extract context manager for suppressing logs. Ref pypa/distutils#183. Remove hack around distutils.dist.log, no longer relevant with pypa/distutils#183. Support caplog and capsys now that logs go through logging. Suppress monkeypatch when Log is gone, indicating distutils is using logging natively. Skip manifest tests as they're copy pasta and broken under a unified logging framework. Restore test for log module, but bypass when irrelevant. Restore protection of distutils.log patching. Update changelog. Ref #3626. Jason Veatch (3): Fix #3419. Update example versions to be PEP440-compliant Add changelog file with towncrier news fragment. Update docs/userguide/distribution.rst Mike Salvatore (2): Catch an edge case in expand._assert_local() Use abspath() instead of resolve() in expand._assert_local() Miro Hrončok (1): Skip stdlib distutils tests on Python 3.12 Per Jensen (1): Update pyproject_config.rst Stéphane Blondon (1): remove python2 cases alexzorin (1): fix small error message typo in editable_wheel.py
e824025
to
dce4098
Compare
I'm able to replicate the failures locally by injecting this branch of distutils into setuptools and running the tests. The error message suggests to me there may be something about the 'non-utf8' filename that's failing to serialize properly... presumably in the logging infra. It seems xdist may be implicated as well as the traceback points to execnet.gateway_base called by xdist.remote. |
The error doesn't occur if xdist is disabled. |
Here's the full run with the isolated test using xdist:
|
The failure is triggered on line 307 of the test: That's annoying. Github won't render the code, seemingly because it only does that for same-repo references :(. |
The issue occurs when the filelist attempts to log an error that the filename is not utf-8 encodable. So apparently, distutils old logging infrastructure could handle the value but the new one cannot. Perhaps the issue was previously suppressed by the quiet context. I can see how that would make sense. While working on this change, I've seen other situations where |
Simply adding the caplog fixture to that test doesn't solve the issue. |
I'm able to replicate the issue with this test file: # test.py
import logging
def test_log_non_utf8():
logging.getLogger().warn(
'föö'.encode('latin-1').decode('utf-8', errors='surrogateescape')
) invoked with |
…Ref pypa/distutils#183. Workaround for pytest/pytest-xdist#843.
…Ref pypa/distutils#183. Workaround for pytest/pytest-xdist#843.
v65.6.0 Changes Sync with pypa/distutils@e0787fa, including pypa/distutils#183 updating distutils to use the Python logging framework.
…version 65.6.0 Anderson Bravalheri (6): Fix misspelling in docs/userguide/development_mode.rst Highlight in docs: 'attr' directive needs MANIFEST.in config / SCM plugin Ensure pyproject.toml accepts UTF-8 in maintainers Minor stylistic change Minor stylistic change Minor stylistic change Jason R. Coombs (39): Remove docstring in distutils Prefer partition for splitting a string. Remove readme Prefer relative imports for better portability. No need to save 'threshold' on the instance. Use monkeypatch to set log and threshold. Extract fixture for capturing logs in _util modules. Expand 'logs' fixture to support features needed by LoggingSilencer. Consolidate fixture for capturing logs. Removes LoggingSilencer. Prefer capsys to test.support.captured* Fix broken test Prefer caplog to mocking the logging interface. GHA pretty env (#67) or maybe not Remove setting of dll_libraries in Mingw32CCompiler. One call superseded the other, and the result was redundant with what happens in the parent call. Short circuit when MSC version is not found. Prefer partition to find. Work with ints uniformally. Replace if/else with a lookup. Move lookup out of the function Prefer regex search to string manipulation. Use RangeMap to define the ranges in one place. Use try/except when assigning msc_ver. 👹 Feed the hobgoblins (delint). Re-paste RangeMap with newlines restored (unsure what made them disappear). Pin pytest to <7.2. Workaround for pypa/distutils#186. In TempdirManager, use pathlib and more_itertools to more simply write the text. Rewrite init/for/append loop as comprehension and if/else as tertiary statement. Pin mypy to '<0.990' due to realpython/pytest-mypy#141 Remove the hyperlink for the Python versions badge. The PyPI badge is a better anchor for the hyperlink. Apply explicit_package_bases for mypy and unpin the version. Ref python/mypy#14057. Replace bespoke logging facility with logging module, available since Python 2.3. Avoid use of the distutils.log module. Log to the root logger, as that's the one Setuptools patches/validates. ⚫ Fade to black. Skip test under xdist as it fails after migrating to Python logging. Ref pypa/distutils#183. Workaround for pytest/pytest-xdist#843. Skip an additional test under xdist. Ref pypa/distutils#183. Expanded workaround for pytest-dev/pytest-xdist#843. Update changelog. Bump version: 65.5.1 → 65.6.0 Sviatoslav Sydorenko (8): Make the `check` job a central gate in the CI Allow skipping `integration-test` unconditionally Upload accurate coverage flags from unit tests job Use job id as a coverage flag Report coverage from Cygwin jobs Explicitly point Codecov at `coverage.xml` Use an absolute path for codecov uploads Add a test for maintainers w/ international emails Zach Burnett (1): rename `.readthedocs.yml` to `.readthedocs.yaml` (RTD docs indicate that `.readthedocs.yml` will be deprecated) (#68) shripadbadithe (1): Fix typo in docs/userguide/development_mode.rst
The distutils.log module has its fingers in nearly every module in distutils and setuptools. By addressing the long-standing TODO of adopting Python's logging module (introduced in Python 2.3 IIRC), most of the callers can decouple from distutils, greatly simplifying the landscape as Setuptools aims to absorb distutils.