-
-
Notifications
You must be signed in to change notification settings - Fork 615
Open
Description
https://gitweb.gentoo.org/repo/gentoo.git/tree/eclass/python-utils-r1.eclass#n1433
Gentoo distro packaging normalizes warning filters when running packaging tests. Trying to upgrade isort to 3.14, I get a weird failure. Minimized:
$ git clone https://github.com/PyCQA/isort
$ cd isort
$ python3.13 -m venv venv13
$ python3.14 -m venv venv14
$ ./venv13/bin/pip install . pytest
$ ./venv14/bin/pip install . pytest
$ ./venv13/bin/python -Wdefault -m pytest tests/unit/test_isort.py -k test_command_line
============================= test session starts ==============================
platform linux -- Python 3.13.5, pytest-8.4.2, pluggy-1.6.0
rootdir: /var/tmp/portage/dev-python/isort-7.0.0/work/isort
configfile: pyproject.toml
collected 227 items / 225 deselected / 2 selected
tests/unit/test_isort.py .. [100%]
=============================== warnings summary ===============================
tests/unit/test_isort.py::test_command_line[True]
/usr/lib/python3.13/multiprocessing/pool.py:268: ResourceWarning: unclosed running multiprocessing pool <multiprocessing.pool.Pool state=RUN pool_size=2>
_warn(f"unclosed running multiprocessing pool {self!r}",
Enable tracemalloc to get traceback where the object was allocated.
See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
================= 2 passed, 225 deselected, 1 warning in 0.10s =================
$ ./venv14/bin/python -Wdefault -m pytest tests/unit/test_isort.py -k test_command_line
============================= test session starts ==============================
platform linux -- Python 3.14.0rc1, pytest-8.4.2, pluggy-1.6.0
rootdir: /var/tmp/portage/dev-python/isort-7.0.0/work/isort
configfile: pyproject.toml
collected 227 items / 225 deselected / 2 selected
tests/unit/test_isort.py .F [100%]
=================================== FAILURES ===================================
___________________________ test_command_line[True] ____________________________
tmpdir = local('/tmp/pytest-of-root/pytest-28/test_command_line_True_0')
capfd = <_pytest.capture.CaptureFixture object at 0x7f081eb1b390>
multiprocess = True
@pytest.mark.parametrize("multiprocess", [False, True])
def test_command_line(tmpdir, capfd, multiprocess: bool) -> None:
tmpdir.join("file1.py").write("import re\nimport os\n\nimport contextlib\n\n\nimport isort")
tmpdir.join("file2.py").write("import collections\nimport time\n\nimport abc\n\n\nimport isort")
arguments = [str(tmpdir), "--settings-path", os.getcwd()]
if multiprocess:
arguments.extend(["--jobs", "2"])
main(arguments)
assert (
tmpdir.join("file1.py").read()
== "import contextlib\nimport os\nimport re\n\nimport isort\n"
)
assert (
tmpdir.join("file2.py").read()
== "import abc\nimport collections\nimport time\n\nimport isort\n"
)
if not (sys.platform.startswith("win") or sys.platform.startswith("darwin")):
out, err = capfd.readouterr()
assert not [error for error in err.split("\n") if error and "warning:" not in error]
# it informs us about fixing the files:
> assert str(tmpdir.join("file1.py")) in out
E AssertionError: assert '/tmp/pytest-of-root/pytest-28/test_command_line_True_0/file1.py' in ''
E + where '/tmp/pytest-of-root/pytest-28/test_command_line_True_0/file1.py' = str(local('/tmp/pytest-of-root/pytest-28/test_command_line_True_0/file1.py'))
E + where local('/tmp/pytest-of-root/pytest-28/test_command_line_True_0/file1.py') = join('file1.py')
E + where join = local('/tmp/pytest-of-root/pytest-28/test_command_line_True_0').join
/var/tmp/portage/dev-python/isort-7.0.0/work/isort/tests/unit/test_isort.py:3740: AssertionError
=============================== warnings summary ===============================
tests/unit/test_isort.py::test_command_line[True]
/usr/lib/python3.14/multiprocessing/pool.py:268: ResourceWarning: unclosed running multiprocessing pool <multiprocessing.pool.Pool state=RUN pool_size=2>
_warn(f"unclosed running multiprocessing pool {self!r}",
Enable tracemalloc to get traceback where the object was allocated.
See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/unit/test_isort.py::test_command_line[True] - AssertionError: as...
============ 1 failed, 1 passed, 225 deselected, 1 warning in 0.25s ============
As far as I can tell, warnings control should not affect isort verbosity at all...
DanielNoord
Metadata
Metadata
Assignees
Labels
No labels