Skip to content

test_no_additional_output_in_verbose_mode fails on Linux #10396

@hrnciar

Description

@hrnciar

Description

Hello,

poetry 2.1.3 doesn't build on Fedora Rawhide. The newly added test_no_additional_output_in_verbose_mode fails with:

=================================== FAILURES ===================================
_________________ test_no_additional_output_in_verbose_mode[] __________________
[gw0] linux -- Python 3.13.3 /usr/bin/python3

tmp_venv = VirtualEnv("/tmp/pytest-of-mockbuild/pytest-0/popen-gw0/test_no_additional_output_in_v0/venv")
mocker = <pytest_mock.plugin.MockerFixture object at 0x7fd5f4bd5d90>
app_tester = <cleo.testers.application_tester.ApplicationTester object at 0x7fd5f58eb2f0>
verbosity = ''

    @pytest.mark.parametrize("verbosity", ["", "-v", "-vv", "-vvv"])
    def test_no_additional_output_in_verbose_mode(
        tmp_venv: VirtualEnv,
        mocker: MockerFixture,
        app_tester: ApplicationTester,
        verbosity: str,
    ) -> None:
        mocker.patch("shellingham.detect_shell", return_value=("pwsh", None))
        mocker.patch("poetry.utils.env.EnvManager.get", return_value=MockEnv(is_venv=True))
    
        # use an AppTester instead of a CommandTester to catch additional output
        app_tester.execute(f"env activate {verbosity}")
    
        lines = app_tester.io.fetch_output().splitlines()
>       assert len(lines) == 1
E       assert 0 == 1
E        +  where 0 = len([])

/builddir/build/BUILD/poetry-2.1.3-build/poetry-2.1.3/tests/console/commands/env/test_activate.py:95: AssertionError
------------------------------ Captured log setup ------------------------------
INFO     virtualenv.discovery.builtin:builtin.py:76 find interpreter for spec PythonSpec(path=/usr/bin/python3)
INFO     virtualenv.discovery.builtin:builtin.py:83 proposed PythonInfo(spec=CPython3.13.3.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.13.3 (main, May  6 2025, 00:00:00) [GCC 15.1.1 20250425 (Red Hat 15.1.1-1)]', encoding_fs_io=utf-8-utf-8)
WARNING  virtualenv.seed.embed.base_embed:base_embed.py:39 The --no-wheel and --wheel options are deprecated. They have no effect for Python > 3.8 as wheel is no longer bundled in virtualenv.
INFO     virtualenv.run.session:session.py:52 create virtual environment via CPython3Posix(dest=/tmp/pytest-of-mockbuild/pytest-0/popen-gw0/test_no_additional_output_in_v0/venv, clear=False, no_vcs_ignore=False, global=False)
INFO     virtualenv.run.session:session.py:65 add activators for Bash, CShell, Fish, Nushell, PowerShell, Python
________________ test_no_additional_output_in_verbose_mode[-v] _________________
[gw0] linux -- Python 3.13.3 /usr/bin/python3

tmp_venv = VirtualEnv("/tmp/pytest-of-mockbuild/pytest-0/popen-gw0/test_no_additional_output_in_v1/venv")
mocker = <pytest_mock.plugin.MockerFixture object at 0x7fd5f4bd5570>
app_tester = <cleo.testers.application_tester.ApplicationTester object at 0x7fd5f4e97f00>
verbosity = '-v'

    @pytest.mark.parametrize("verbosity", ["", "-v", "-vv", "-vvv"])
    def test_no_additional_output_in_verbose_mode(
        tmp_venv: VirtualEnv,
        mocker: MockerFixture,
        app_tester: ApplicationTester,
        verbosity: str,
    ) -> None:
        mocker.patch("shellingham.detect_shell", return_value=("pwsh", None))
        mocker.patch("poetry.utils.env.EnvManager.get", return_value=MockEnv(is_venv=True))
    
        # use an AppTester instead of a CommandTester to catch additional output
        app_tester.execute(f"env activate {verbosity}")
    
        lines = app_tester.io.fetch_output().splitlines()
>       assert len(lines) == 1
E       assert 0 == 1
E        +  where 0 = len([])

/builddir/build/BUILD/poetry-2.1.3-build/poetry-2.1.3/tests/console/commands/env/test_activate.py:95: AssertionError
------------------------------ Captured log setup ------------------------------
INFO     virtualenv.discovery.builtin:builtin.py:76 find interpreter for spec PythonSpec(path=/usr/bin/python3)
INFO     virtualenv.discovery.builtin:builtin.py:83 proposed PythonInfo(spec=CPython3.13.3.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.13.3 (main, May  6 2025, 00:00:00) [GCC 15.1.1 20250425 (Red Hat 15.1.1-1)]', encoding_fs_io=utf-8-utf-8)
WARNING  virtualenv.seed.embed.base_embed:base_embed.py:39 The --no-wheel and --wheel options are deprecated. They have no effect for Python > 3.8 as wheel is no longer bundled in virtualenv.
INFO     virtualenv.run.session:session.py:52 create virtual environment via CPython3Posix(dest=/tmp/pytest-of-mockbuild/pytest-0/popen-gw0/test_no_additional_output_in_v1/venv, clear=False, no_vcs_ignore=False, global=False)
INFO     virtualenv.run.session:session.py:65 add activators for Bash, CShell, Fish, Nushell, PowerShell, Python
________________ test_no_additional_output_in_verbose_mode[-vv] ________________
[gw0] linux -- Python 3.13.3 /usr/bin/python3

tmp_venv = VirtualEnv("/tmp/pytest-of-mockbuild/pytest-0/popen-gw0/test_no_additional_output_in_v2/venv")
mocker = <pytest_mock.plugin.MockerFixture object at 0x7fd5f6dc2c30>
app_tester = <cleo.testers.application_tester.ApplicationTester object at 0x7fd5f59a4d10>
verbosity = '-vv'

    @pytest.mark.parametrize("verbosity", ["", "-v", "-vv", "-vvv"])
    def test_no_additional_output_in_verbose_mode(
        tmp_venv: VirtualEnv,
        mocker: MockerFixture,
        app_tester: ApplicationTester,
        verbosity: str,
    ) -> None:
        mocker.patch("shellingham.detect_shell", return_value=("pwsh", None))
        mocker.patch("poetry.utils.env.EnvManager.get", return_value=MockEnv(is_venv=True))
    
        # use an AppTester instead of a CommandTester to catch additional output
        app_tester.execute(f"env activate {verbosity}")
    
        lines = app_tester.io.fetch_output().splitlines()
>       assert len(lines) == 1
E       assert 0 == 1
E        +  where 0 = len([])

/builddir/build/BUILD/poetry-2.1.3-build/poetry-2.1.3/tests/console/commands/env/test_activate.py:95: AssertionError
------------------------------ Captured log setup ------------------------------
INFO     virtualenv.discovery.builtin:builtin.py:76 find interpreter for spec PythonSpec(path=/usr/bin/python3)
INFO     virtualenv.discovery.builtin:builtin.py:83 proposed PythonInfo(spec=CPython3.13.3.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.13.3 (main, May  6 2025, 00:00:00) [GCC 15.1.1 20250425 (Red Hat 15.1.1-1)]', encoding_fs_io=utf-8-utf-8)
WARNING  virtualenv.seed.embed.base_embed:base_embed.py:39 The --no-wheel and --wheel options are deprecated. They have no effect for Python > 3.8 as wheel is no longer bundled in virtualenv.
INFO     virtualenv.run.session:session.py:52 create virtual environment via CPython3Posix(dest=/tmp/pytest-of-mockbuild/pytest-0/popen-gw0/test_no_additional_output_in_v2/venv, clear=False, no_vcs_ignore=False, global=False)
INFO     virtualenv.run.session:session.py:65 add activators for Bash, CShell, Fish, Nushell, PowerShell, Python
_______________ test_no_additional_output_in_verbose_mode[-vvv] ________________
[gw0] linux -- Python 3.13.3 /usr/bin/python3

tmp_venv = VirtualEnv("/tmp/pytest-of-mockbuild/pytest-0/popen-gw0/test_no_additional_output_in_v3/venv")
mocker = <pytest_mock.plugin.MockerFixture object at 0x7fd5f6dc3930>
app_tester = <cleo.testers.application_tester.ApplicationTester object at 0x7fd5f4b0b450>
verbosity = '-vvv'

    @pytest.mark.parametrize("verbosity", ["", "-v", "-vv", "-vvv"])
    def test_no_additional_output_in_verbose_mode(
        tmp_venv: VirtualEnv,
        mocker: MockerFixture,
        app_tester: ApplicationTester,
        verbosity: str,
    ) -> None:
        mocker.patch("shellingham.detect_shell", return_value=("pwsh", None))
        mocker.patch("poetry.utils.env.EnvManager.get", return_value=MockEnv(is_venv=True))
    
        # use an AppTester instead of a CommandTester to catch additional output
        app_tester.execute(f"env activate {verbosity}")
    
        lines = app_tester.io.fetch_output().splitlines()
>       assert len(lines) == 1
E       assert 0 == 1
E        +  where 0 = len([])

/builddir/build/BUILD/poetry-2.1.3-build/poetry-2.1.3/tests/console/commands/env/test_activate.py:95: AssertionError
------------------------------ Captured log setup ------------------------------
INFO     virtualenv.discovery.builtin:builtin.py:76 find interpreter for spec PythonSpec(path=/usr/bin/python3)
INFO     virtualenv.discovery.builtin:builtin.py:83 proposed PythonInfo(spec=CPython3.13.3.final.0-64, exe=/usr/bin/python3, platform=linux, version='3.13.3 (main, May  6 2025, 00:00:00) [GCC 15.1.1 20250425 (Red Hat 15.1.1-1)]', encoding_fs_io=utf-8-utf-8)
WARNING  virtualenv.seed.embed.base_embed:base_embed.py:39 The --no-wheel and --wheel options are deprecated. They have no effect for Python > 3.8 as wheel is no longer bundled in virtualenv.
INFO     virtualenv.run.session:session.py:52 create virtual environment via CPython3Posix(dest=/tmp/pytest-of-mockbuild/pytest-0/popen-gw0/test_no_additional_output_in_v3/venv, clear=False, no_vcs_ignore=False, global=False)
INFO     virtualenv.run.session:session.py:65 add activators for Bash, CShell, Fish, Nushell, PowerShell, Python
=========================== short test summary info ============================
SKIPPED [3] tests/console/commands/env/test_activate.py:54: Only Windows shells
SKIPPED [1] tests/console/commands/self/test_sync.py:26: Only relevant for `poetry self install`
SKIPPED [1] tests/installation/test_executor.py:414: https://github.com/python-poetry/poetry/issues/7983
SKIPPED [1] tests/console/commands/test_sync.py:26: Only relevant for `poetry install`
SKIPPED [1] tests/console/commands/test_run.py:159: Poetry only installs CMD script files for console scripts of editable dependencies on Windows
SKIPPED [1] tests/utils/env/test_env_manager.py:1265: requires darwin
SKIPPED [1] tests/utils/test_python_manager.py:99: Windows only
FAILED tests/console/commands/env/test_activate.py::test_no_additional_output_in_verbose_mode[]
FAILED tests/console/commands/env/test_activate.py::test_no_additional_output_in_verbose_mode[-v]
FAILED tests/console/commands/env/test_activate.py::test_no_additional_output_in_verbose_mode[-vv]
FAILED tests/console/commands/env/test_activate.py::test_no_additional_output_in_verbose_mode[-vvv]
================== 4 failed, 2626 passed, 9 skipped in 58.78s ==================

I've tried to dig into it and app_tester.io.fetch_error() returns:

'\n  ShellNotSupportedError\n\n  Discovered shell \'pwsh\' doesn\'t have an activator in virtual environment\n\n  at ~/build/BUILD/poetry-2.1.3-build/BUILDROOT/usr/lib/python3.13/site-packages/poetry/console/commands/env/activate.py:39 in handle\n       
35│         if command := self._get_activate_command(env, shell):\n       
36│             self.line(command)\n       
37│             return 0\n       
38│ \n    →  
39│         raise ShellNotSupportedError(\n       
40│             f"Discovered shell \'{shell}\' doesn\'t have an activator in virtual environment"\n       
41│         )\n       
42│ \n       
43│     def _get_activate_command(self, env: Env, shell: str) -> str:\n'

I suppose the test is missing @pytest.mark.skipif(not WINDOWS, reason="Only Windows shells").

Workarounds

Skip the test on Linux.

Poetry Installation Method

system package manager (eg: dnf, apt etc.)

Operating System

Fedora Rawhide

Poetry Version

2.1.3

Poetry Configuration

N/A

Python Sysconfig

sysconfig.log
Paste the output of 'python -m sysconfig', over this line.

Example pyproject.toml

N/A

Poetry Runtime Logs

poetry-runtime.log
Paste the output of 'poetry -vvv <command>', over this line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working as expectedstatus/triageThis issue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions