python-poetry / poetry

Python packaging and dependency management made easy
https://python-poetry.org
MIT License
31.43k stars 2.27k forks source link

1.3.2: pytest is failing because in test units is hardcoded `python` executable name #7348

Open kloczek opened 1 year ago

kloczek commented 1 year ago

Issue

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

Lookd lik in some uits python executable name is hardcoded. It should be used sys.executable instead.

Here is pytest output:

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-poetry-1.3.2-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-poetry-1.3.2-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -m 'not network' ==================================================================================== test session starts ==================================================================================== platform linux -- Python 3.8.16, pytest-7.2.0, pluggy-1.0.0 rootdir: /home/tkloczko/rpmbuild/BUILD/poetry-1.3.2, configfile: pyproject.toml, testpaths: tests plugins: mock-3.10.0 collected 1253 items / 22 deselected / 1231 selected tests/test_factory.py ................. [ 1%] tests/config/test_config.py ..................... [ 3%] tests/console/test_application.py ........ [ 3%] tests/console/commands/test_about.py . [ 3%] tests/console/commands/test_add.py ............................................................................ [ 9%] tests/console/commands/test_check.py .. [ 10%] tests/console/commands/test_config.py .................... [ 11%] tests/console/commands/test_init.py ............................................... [ 15%] tests/console/commands/test_install.py ............................................ [ 19%] tests/console/commands/test_lock.py ........ [ 19%] tests/console/commands/test_new.py ................... [ 21%] tests/console/commands/test_publish.py ........ [ 22%] tests/console/commands/test_remove.py ...... [ 22%] tests/console/commands/test_run.py ...s. [ 22%] tests/console/commands/test_search.py . [ 22%] tests/console/commands/test_shell.py .............. [ 24%] tests/console/commands/test_show.py ......................................... [ 27%] tests/console/commands/test_update.py .. [ 27%] tests/console/commands/test_version.py .......................... [ 29%] tests/console/commands/cache/test_clear.py ..... [ 30%] tests/console/commands/cache/test_list.py .. [ 30%] tests/console/commands/debug/test_resolve.py ... [ 30%] tests/console/commands/env/test_info.py F. [ 30%] tests/console/commands/env/test_list.py FFFF. [ 31%] tests/console/commands/env/test_remove.py .FFFF [ 31%] tests/console/commands/env/test_use.py FFF [ 31%] tests/console/commands/self/test_add_plugins.py ......... [ 32%] tests/console/commands/self/test_remove_plugins.py .. [ 32%] tests/console/commands/self/test_show_plugins.py .... [ 32%] tests/console/commands/self/test_update.py . [ 33%] tests/console/commands/source/test_add.py ...... [ 33%] tests/console/commands/source/test_remove.py .. [ 33%] tests/console/commands/source/test_show.py .... [ 34%] tests/inspection/test_info.py ................... [ 35%] tests/installation/test_chef.py .... [ 35%] tests/installation/test_chooser.py ......................... [ 37%] tests/installation/test_executor.py ...........FFFFFFFF........ [ 40%] tests/installation/test_installer.py ......................................................s................... [ 46%] tests/installation/test_installer_old.py .........................................s........ [ 50%] tests/installation/test_pip_installer.py ........F.. [ 51%] tests/json/test_schema_sources.py .. [ 51%] tests/masonry/builders/test_editable_builder.py ..F.. [ 51%] tests/mixology/solutions/providers/test_python_requirement_solution_provider.py .. [ 51%] tests/mixology/solutions/solutions/test_python_requirement_solution.py . [ 51%] tests/mixology/version_solver/test_backtracking.py ........ [ 52%] tests/mixology/version_solver/test_basic_graph.py .............. [ 53%] tests/mixology/version_solver/test_dependency_cache.py .. [ 53%] tests/mixology/version_solver/test_python_constraint.py . [ 53%] tests/mixology/version_solver/test_unsolvable.py ....... [ 54%] tests/mixology/version_solver/test_with_lock.py ........ [ 55%] tests/packages/test_locker.py ........................ [ 57%] tests/plugins/test_plugin_manager.py ... [ 57%] tests/publishing/test_publisher.py ........ [ 58%] tests/publishing/test_uploader.py ............ [ 58%] tests/puzzle/test_provider.py ...................................... [ 62%] tests/puzzle/test_solver.py ...................................................................................................s....................... [ 72%] tests/puzzle/test_transaction.py .... [ 72%] tests/repositories/test_installed_repository.py ................. [ 73%] tests/repositories/test_legacy_repository.py ........................................... [ 77%] tests/repositories/test_lockfile_repository.py .. [ 77%] tests/repositories/test_pypi_repository.py .......................... [ 79%] tests/repositories/test_repository.py ......... [ 80%] tests/repositories/test_repository_pool.py ................... [ 81%] tests/repositories/test_single_page_repository.py .. [ 81%] tests/repositories/link_sources/test_base.py ............ [ 82%] tests/repositories/link_sources/test_html.py ................ [ 84%] tests/utils/test_authenticator.py ..................................... [ 87%] tests/utils/test_cache.py ............ [ 88%] tests/utils/test_dependency_specification.py ...................... [ 90%] tests/utils/test_env.py .sF..F.FFFFFFFFFFF.F......F.........FF..FF.F................F....F [ 95%] tests/utils/test_env_site.py .. [ 95%] tests/utils/test_extras.py ....... [ 96%] tests/utils/test_helpers.py ............. [ 97%] tests/utils/test_password_manager.py .................... [ 98%] tests/utils/test_patterns.py .. [ 98%] tests/utils/test_pip.py F. [ 99%] tests/utils/test_setup_reader.py ......... [ 99%] tests/utils/test_source.py .. [100%] ========================================================================================= FAILURES ========================================================================================== ___________________________________________________________________________ test_env_info_displays_complete_info ____________________________________________________________________________ tester = def test_env_info_displays_complete_info(tester: CommandTester): > tester.execute() tests/console/commands/env/test_info.py:36: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/cleo/testers/command_tester.py:88: in execute self._status_code = self._command.run(self._io) /usr/lib/python3.8/site-packages/cleo/commands/base_command.py:119: in run status_code = self.execute(io) /usr/lib/python3.8/site-packages/cleo/commands/command.py:62: in execute return self.handle() ../../BUILDROOT/python-poetry-1.3.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/console/commands/env/info.py:33: in handle self._display_complete_info(env) ../../BUILDROOT/python-poetry-1.3.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/console/commands/env/info.py:61: in _display_complete_info system_env = env.parent_env ../../BUILDROOT/python-poetry-1.3.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env.py:1291: in parent_env return GenericEnv(self.base, child_env=self) ../../BUILDROOT/python-poetry-1.3.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env.py:1824: in __init__ super().__init__(path, base=base) ../../BUILDROOT/python-poetry-1.3.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env.py:1716: in __init__ output = self.run_python_script(GET_BASE_PREFIX) ../../BUILDROOT/python-poetry-1.3.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env.py:1500: in run_python_script return self.run( ../../BUILDROOT/python-poetry-1.3.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env.py:1492: in run return self._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.3.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env.py:1897: in _run return super(VirtualEnv, self)._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.3.2-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env.py:1523: in _run output = subprocess.run( /usr/lib64/python3.8/subprocess.py:493: in run with Popen(*popenargs, **kwargs) as process: /usr/lib64/python3.8/subprocess.py:858: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , args = ['python', '-I', '-W', 'ignore', '-'], executable = b'python', preexec_fn = None, close_fds = True, pass_fds = (), cwd = None env = None, startupinfo = None, creationflags = 0, shell = False, p2cread = 14, p2cwrite = 15, c2pread = 16, c2pwrite = 17, errread = -1, errwrite = 17, restore_signals = True start_new_session = False def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _posixsubprocess.fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, preexec_fn) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") if child_exec_never_called: err_msg = "" # The error must be from chdir(cwd). err_filename = cwd else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'python' /usr/lib64/python3.8/subprocess.py:1704: FileNotFoundError [..] ================================================================================== short test summary info ================================================================================== SKIPPED [1] tests/console/commands/test_run.py:90: Poetry only installs CMD script files for console scripts of editable dependencies on Windows SKIPPED [1] tests/installation/test_installer.py:1877: This is not working at the moment due to limitations in the resolver SKIPPED [1] tests/installation/test_installer_old.py:1531: This is not working at the moment due to limitations in the resolver SKIPPED [1] tests/puzzle/test_solver.py:3172: Poetry no longer has critical package requirements SKIPPED [1] tests/utils/test_env.py:99: requires darwin FAILED tests/console/commands/env/test_info.py::test_env_info_displays_complete_info - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/console/commands/env/test_list.py::test_none_activated - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/console/commands/env/test_list.py::test_activated - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/console/commands/env/test_list.py::test_in_project_venv - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/console/commands/env/test_list.py::test_in_project_venv_no_explicit_config - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/console/commands/env/test_remove.py::test_remove_by_name - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/console/commands/env/test_remove.py::test_remove_all - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/console/commands/env/test_remove.py::test_remove_all_and_version - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/console/commands/env/test_remove.py::test_remove_multiple - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/console/commands/env/test_use.py::test_activate_activates_non_existing_virtualenv_no_envs_file - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/console/commands/env/test_use.py::test_get_prefers_explicitly_activated_virtualenvs_over_env_var - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/console/commands/env/test_use.py::test_get_prefers_explicitly_activated_non_existing_virtualenvs_over_env_var - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/installation/test_executor.py::test_executor_should_not_write_pep610_url_references_for_cached_package[package0] - assert 0 == 1 FAILED tests/installation/test_executor.py::test_executor_should_not_write_pep610_url_references_for_cached_package[package1] - assert 0 == 1 FAILED tests/installation/test_executor.py::test_executor_should_write_pep610_url_references_for_files - assert 0 == 1 FAILED tests/installation/test_executor.py::test_executor_should_write_pep610_url_references_for_directories - assert 0 == 1 FAILED tests/installation/test_executor.py::test_executor_should_write_pep610_url_references_for_editable_directories - assert 0 == 1 FAILED tests/installation/test_executor.py::test_executor_should_write_pep610_url_references_for_urls - assert 0 == 1 FAILED tests/installation/test_executor.py::test_executor_should_write_pep610_url_references_for_git - assert 0 == 1 FAILED tests/installation/test_executor.py::test_executor_should_write_pep610_url_references_for_git_with_subdirectories - assert 0 == 1 FAILED tests/installation/test_pip_installer.py::test_uninstall_git_package_nspkg_pth_cleanup - poetry.exceptions.PoetryException: Failed to install /tmp/poetry_626ix3du/venv/src/demo/namespace-package-one FAILED tests/masonry/builders/test_editable_builder.py::test_builder_setup_generation_runs_with_pip_editable - poetry.utils.env.EnvCommandError: Command ['/tmp/tmp38gbt41n/.venv/bin/python', '/usr/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-22.3.1-py3-none-any.whl/pip', '--vers... FAILED tests/utils/test_env.py::test_env_commands_with_spaces_in_their_arg_work_as_expected - poetry.utils.env.EnvCommandError: Command "/tmp/poetry_iy3v0tzn/Virtual Env/bin/python" /usr/lib/python3.8/site-packages/virtualenv/seed/wheels/embed/pip-22.3.1-py3-none-any.whl/pip --... FAILED tests/utils/test_env.py::test_env_get_venv_with_venv_folder_present[True] - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/utils/test_env.py::test_env_get_venv_with_venv_folder_present[None] - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/utils/test_env.py::test_activate_activates_non_existing_virtualenv_no_envs_file - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/utils/test_env.py::test_activate_activates_existing_virtualenv_no_envs_file - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/utils/test_env.py::test_activate_activates_same_virtualenv_with_envs_file - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/utils/test_env.py::test_activate_activates_different_virtualenv_with_envs_file - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/utils/test_env.py::test_activate_activates_recreates_for_different_patch - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/utils/test_env.py::test_activate_does_not_recreate_when_switching_minor - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/utils/test_env.py::test_deactivate_non_activated_but_existing - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/utils/test_env.py::test_deactivate_activated - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/utils/test_env.py::test_get_prefers_explicitly_activated_virtualenvs_over_env_var - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/utils/test_env.py::test_list - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/utils/test_env.py::test_remove_by_name - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/utils/test_env.py::test_remove_keeps_dir_if_not_deleteable - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/utils/test_env.py::test_create_venv_tries_to_find_a_compatible_python_executable_using_generic_ones_first - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/utils/test_env.py::test_create_venv_tries_to_find_a_compatible_python_executable_using_specific_ones - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/utils/test_env.py::test_create_venv_uses_patch_version_to_detect_compatibility - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/utils/test_env.py::test_create_venv_uses_patch_version_to_detect_compatibility_with_executable - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/utils/test_env.py::test_activate_with_in_project_setting_does_not_fail_if_no_venvs_dir - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/utils/test_env.py::test_create_venv_accepts_fallback_version_w_nonzero_patchlevel - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/utils/test_env.py::test_create_venv_project_name_empty_sets_correct_prompt - FileNotFoundError: [Errno 2] No such file or directory: 'python' FAILED tests/utils/test_pip.py::test_pip_install_successful - poetry.exceptions.PoetryException: Failed to install /home/tkloczko/rpmbuild/BUILD/poetry-1.3.2/tests/fixtures/distributions/demo-0.1.0-py2.py3-none-any.whl =========================================================== 45 failed, 1181 passed, 5 skipped, 22 deselected in 133.88s (0:02:13) =========================================================== ```

Here is list of installed modules in build env

```console ------------------ -------------- attrs 22.2.0 build 0.9.0 CacheControl 0.12.11 cachy 0.3.0 cffi 1.15.1 charset-normalizer 3.0.1 cleo 2.0.1 crashtest 0.4.1 cryptography 38.0.4 deepdiff 6.2.3 distlib 0.3.6 distro 1.8.0 dulwich 0.20.50 exceptiongroup 1.0.0 extras 1.0.0 filelock 3.8.2 fixtures 4.0.0 flatdict 4.0.1 gpg 1.18.0-unknown html5lib 1.1 httpretty 1.1.4 idna 3.4 importlib-metadata 5.1.0 iniconfig 1.1.1 jaraco.classes 3.2.3 jeepney 0.8.0 keyring 23.11.0 libcomps 0.1.19 lockfile 0.12.2 more-itertools 9.0.0 msgpack 1.0.4 ordered-set 4.1.0 orjson 3.8.5 packaging 21.3 pbr 5.9.0 pep517 0.13.0 pexpect 4.8.0 pip 22.3.1 pkginfo 1.9.2 platformdirs 2.6.0 pluggy 1.0.0 ply 3.11 poetry-core 1.4.0 ptyprocess 0.7.0 pycparser 2.21 PyGObject 3.42.2 pyparsing 3.0.9 pytest 7.2.0 pytest-mock 3.10.0 python-dateutil 2.8.2 rapidfuzz 2.13.6 requests 2.28.1 requests-toolbelt 0.10.1 rpm 4.17.0 SecretStorage 3.3.2 shellingham 1.5.0.post1 six 1.16.0 testtools 2.5.0 tomli 2.0.1 trove-classifiers 2022.12.25 urllib3 1.26.12 virtualenv 20.17.1 webencodings 0.5.1 wheel 0.38.4 zipp 3.11.0 ```
dimbleby commented 1 year ago

sys.executable probably isn't what's wanted, I guess that you are running into code that wants the python in the environment under management - which isn't in general the same as the python that is executing poetry. See https://github.com/python-poetry/poetry/blob/df9d3c91bf6ebf95bf951bea320c8723383f9ca1/src/poetry/utils/env.py#L1297.

This looks much the same as #5184, which was ignored for a while and then closed for inactivity. I guess this is not important to anyone who works on poetry: the test scripts work just fine for development purposes. So you'd have to guess that this issue risks the same fate.

Which is to say that if this is important to you, you'll probably want to work on it yourself.

kloczek commented 1 year ago

I guess this is not important to anyone who works on poetry: the test scripts work just fine for development purposes. So you'd have to guess that this issue risks the same fate.

Issue only is that projects test suites are used on packaging to confirm that that project behaves correctly in build env which may be different that what you ae using 😄 Even other developers or people trying to prepare some patches which could be submitted as PRs may be running test suite as well just to confirm that everything is fine .. 😋 On Win python executable name may be different so hardcoding exact name is not the best design. For exactly that propose was designed sys.executable.

dimbleby commented 1 year ago

Nevertheless, the evidence so far is that you're the only person who cares about this, and that if you just leave it alone then the chances are no-one else will bother.

I expect that if you submit a merge request that makes this work for you then it's likely to be accepted.

kloczek commented 1 year ago

Just FTR: just tested 1.4.1 and some units are failing not because hardcoded python executable name. I've added to --deselect list all units failing because of that harcoding and there are other faiing units

Here is pytest output:

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -m 'not network' --deselect 'tests/console/commands/test_init.py::test_respect_prefer_active_on_init[True-1.1]' --deselect 'tests/console/commands/test_new.py::test_respect_prefer_active_on_new[True-1.1]' --deselect tests/console/commands/env/test_info.py::test_env_info_displays_complete_info --deselect tests/console/commands/env/test_list.py::test_none_activated --deselect tests/console/commands/env/test_list.py::test_activated --deselect tests/console/commands/env/test_list.py::test_in_project_venv --deselect tests/console/commands/env/test_list.py::test_in_project_venv_no_explicit_config --deselect tests/console/commands/env/test_remove.py::test_remove_by_name --deselect tests/console/commands/env/test_remove.py::test_remove_all --deselect tests/console/commands/env/test_remove.py::test_remove_all_and_version --deselect tests/console/commands/env/test_remove.py::test_remove_multiple --deselect tests/console/commands/env/test_use.py::test_activate_activates_non_existing_virtualenv_no_envs_file --deselect tests/console/commands/env/test_use.py::test_get_prefers_explicitly_activated_virtualenvs_over_env_var --deselect tests/console/commands/env/test_use.py::test_get_prefers_explicitly_activated_non_existing_virtualenvs_over_env_var --deselect 'tests/utils/test_env.py::test_env_get_venv_with_venv_folder_present[True]' --deselect 'tests/utils/test_env.py::test_env_get_venv_with_venv_folder_present[None]' --deselect tests/utils/test_env.py::test_activate_activates_non_existing_virtualenv_no_envs_file --deselect tests/utils/test_env.py::test_activate_activates_existing_virtualenv_no_envs_file --deselect tests/utils/test_env.py::test_activate_activates_same_virtualenv_with_envs_file --deselect tests/utils/test_env.py::test_activate_activates_different_virtualenv_with_envs_file --deselect tests/utils/test_env.py::test_activate_activates_recreates_for_different_patch --deselect tests/utils/test_env.py::test_activate_does_not_recreate_when_switching_minor --deselect tests/utils/test_env.py::test_deactivate_non_activated_but_existing --deselect tests/utils/test_env.py::test_deactivate_activated --deselect tests/utils/test_env.py::test_get_prefers_explicitly_activated_virtualenvs_over_env_var --deselect tests/utils/test_env.py::test_list --deselect tests/utils/test_env.py::test_remove_by_name --deselect tests/utils/test_env.py::test_remove_keeps_dir_if_not_deleteable --deselect tests/utils/test_env.py::test_create_venv_tries_to_find_a_compatible_python_executable_using_generic_ones_first --deselect tests/utils/test_env.py::test_create_venv_tries_to_find_a_compatible_python_executable_using_specific_ones --deselect tests/utils/test_env.py::test_create_venv_uses_patch_version_to_detect_compatibility --deselect tests/utils/test_env.py::test_create_venv_uses_patch_version_to_detect_compatibility_with_executable --deselect tests/utils/test_env.py::test_activate_with_in_project_setting_does_not_fail_if_no_venvs_dir --deselect tests/utils/test_env.py::test_create_venv_accepts_fallback_version_w_nonzero_patchlevel --deselect tests/utils/test_env.py::test_create_venv_project_name_empty_sets_correct_prompt ==================================================================================== test session starts ==================================================================================== platform linux -- Python 3.8.16, pytest-7.2.2, pluggy-1.0.0 rootdir: /home/tkloczko/rpmbuild/BUILD/poetry-1.4.1, configfile: pyproject.toml, testpaths: tests plugins: mock-3.10.0 collected 1322 items / 58 deselected / 1264 selected tests/test_factory.py ................. [ 1%] tests/test_helpers.py . [ 1%] tests/config/test_config.py ....................... [ 3%] tests/console/test_application.py ........ [ 3%] tests/console/commands/test_about.py . [ 3%] tests/console/commands/test_add.py ............................................................................ [ 9%] tests/console/commands/test_build.py . [ 10%] tests/console/commands/test_check.py ... [ 10%] tests/console/commands/test_config.py ..................... [ 11%] tests/console/commands/test_init.py ................................................ [ 15%] tests/console/commands/test_install.py .................................................. [ 19%] tests/console/commands/test_lock.py ................ [ 20%] tests/console/commands/test_new.py .................... [ 22%] tests/console/commands/test_publish.py ........ [ 23%] tests/console/commands/test_remove.py ...... [ 23%] tests/console/commands/test_run.py ...s... [ 24%] tests/console/commands/test_search.py . [ 24%] tests/console/commands/test_shell.py .............. [ 25%] tests/console/commands/test_show.py .......................................... [ 28%] tests/console/commands/test_update.py .. [ 28%] tests/console/commands/test_version.py .......................... [ 30%] tests/console/commands/cache/test_clear.py ..... [ 31%] tests/console/commands/cache/test_list.py .. [ 31%] tests/console/commands/debug/test_resolve.py ... [ 31%] tests/console/commands/env/test_info.py . [ 31%] tests/console/commands/env/test_remove.py . [ 31%] tests/console/commands/self/test_add_plugins.py ......... [ 32%] tests/console/commands/self/test_remove_plugins.py .. [ 32%] tests/console/commands/self/test_show_plugins.py .... [ 33%] tests/console/commands/self/test_update.py . [ 33%] tests/console/commands/source/test_add.py ...... [ 33%] tests/console/commands/source/test_remove.py .. [ 33%] tests/console/commands/source/test_show.py .... [ 34%] tests/inspection/test_info.py ................... [ 35%] tests/installation/test_chef.py ........FFFF [ 36%] tests/installation/test_chooser.py ......................... [ 38%] tests/installation/test_executor.py .F.F..FF...FFFFFFFFFFFFF.F.......F.F.. [ 41%] tests/installation/test_installer.py ......................................................s................... [ 47%] tests/installation/test_installer_old.py .........................................s........ [ 51%] tests/installation/test_pip_installer.py ........... [ 52%] tests/installation/test_wheel_installer.py EEEEFF [ 52%] tests/json/test_schema_sources.py .. [ 52%] tests/masonry/builders/test_editable_builder.py ...... [ 53%] tests/mixology/solutions/providers/test_python_requirement_solution_provider.py .. [ 53%] tests/mixology/solutions/solutions/test_python_requirement_solution.py . [ 53%] tests/mixology/version_solver/test_backtracking.py ........ [ 54%] tests/mixology/version_solver/test_basic_graph.py .............. [ 55%] tests/mixology/version_solver/test_dependency_cache.py .. [ 55%] tests/mixology/version_solver/test_python_constraint.py . [ 55%] tests/mixology/version_solver/test_unsolvable.py ....... [ 56%] tests/mixology/version_solver/test_with_lock.py ........ [ 56%] tests/packages/test_locker.py .......................... [ 58%] tests/plugins/test_plugin_manager.py ... [ 59%] tests/publishing/test_publisher.py ........ [ 59%] tests/publishing/test_uploader.py ................... [ 61%] tests/puzzle/test_provider.py ...................................... [ 64%] tests/puzzle/test_solver.py ....................................................................................................s....................... [ 73%] tests/puzzle/test_transaction.py ..... [ 74%] tests/repositories/test_installed_repository.py ................. [ 75%] tests/repositories/test_legacy_repository.py ........................................... [ 79%] tests/repositories/test_lockfile_repository.py .. [ 79%] tests/repositories/test_pypi_repository.py ........................... [ 81%] tests/repositories/test_repository.py ......... [ 82%] tests/repositories/test_repository_pool.py ................... [ 83%] tests/repositories/test_single_page_repository.py .. [ 83%] tests/repositories/link_sources/test_base.py ............ [ 84%] tests/repositories/link_sources/test_html.py ................ [ 85%] tests/utils/test_authenticator.py ..................................... [ 88%] tests/utils/test_cache.py ............ [ 89%] tests/utils/test_dependency_specification.py ...................... [ 91%] tests/utils/test_env.py .s............................................... [ 95%] tests/utils/test_env_site.py .. [ 95%] tests/utils/test_extras.py ....... [ 96%] tests/utils/test_helpers.py ............. [ 97%] tests/utils/test_password_manager.py .................... [ 98%] tests/utils/test_patterns.py .. [ 98%] tests/utils/test_pip.py .. [ 99%] tests/utils/test_setup_reader.py ......... [ 99%] tests/utils/test_source.py .. [100%] ========================================================================================== ERRORS =========================================================================================== ______________________________________________________________ ERROR at setup of test_default_installation_source_dir_content _______________________________________________________________ tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-28')) demo_wheel = PosixPath('/home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/distributions/demo-0.1.0-py2.py3-none-any.whl') @pytest.fixture(scope="module") def default_installation(tmp_path_factory: TempPathFactory, demo_wheel: Path) -> Path: env = MockEnv(path=tmp_path_factory.mktemp("default_install")) installer = WheelInstaller(env) > installer.install(demo_wheel) tests/installation/test_wheel_installer.py:36: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = wheel = PosixPath('/home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/distributions/demo-0.1.0-py2.py3-none-any.whl') def install(self, wheel: Path) -> None: with WheelFile.open(wheel) as source: > source.validate_record() E AttributeError: 'WheelFile' object has no attribute 'validate_record' ../../BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/installation/wheel_installer.py:101: AttributeError _____________________________________________________________ ERROR at setup of test_default_installation_dist_info_dir_content _____________________________________________________________ tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-28')) demo_wheel = PosixPath('/home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/distributions/demo-0.1.0-py2.py3-none-any.whl') @pytest.fixture(scope="module") def default_installation(tmp_path_factory: TempPathFactory, demo_wheel: Path) -> Path: env = MockEnv(path=tmp_path_factory.mktemp("default_install")) installer = WheelInstaller(env) > installer.install(demo_wheel) tests/installation/test_wheel_installer.py:36: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = wheel = PosixPath('/home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/distributions/demo-0.1.0-py2.py3-none-any.whl') def install(self, wheel: Path) -> None: with WheelFile.open(wheel) as source: > source.validate_record() E AttributeError: 'WheelFile' object has no attribute 'validate_record' ../../BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/installation/wheel_installer.py:101: AttributeError _______________________________________________________________ ERROR at setup of test_installer_file_contains_valid_version ________________________________________________________________ tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-28')) demo_wheel = PosixPath('/home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/distributions/demo-0.1.0-py2.py3-none-any.whl') @pytest.fixture(scope="module") def default_installation(tmp_path_factory: TempPathFactory, demo_wheel: Path) -> Path: env = MockEnv(path=tmp_path_factory.mktemp("default_install")) installer = WheelInstaller(env) > installer.install(demo_wheel) tests/installation/test_wheel_installer.py:36: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = wheel = PosixPath('/home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/distributions/demo-0.1.0-py2.py3-none-any.whl') def install(self, wheel: Path) -> None: with WheelFile.open(wheel) as source: > source.validate_record() E AttributeError: 'WheelFile' object has no attribute 'validate_record' ../../BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/installation/wheel_installer.py:101: AttributeError __________________________________________________________________ ERROR at setup of test_default_installation_no_bytecode __________________________________________________________________ tmp_path_factory = TempPathFactory(_given_basetemp=None, _trace=, _basetemp=PosixPath('/tmp/pytest-of-tkloczko/pytest-28')) demo_wheel = PosixPath('/home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/distributions/demo-0.1.0-py2.py3-none-any.whl') @pytest.fixture(scope="module") def default_installation(tmp_path_factory: TempPathFactory, demo_wheel: Path) -> Path: env = MockEnv(path=tmp_path_factory.mktemp("default_install")) installer = WheelInstaller(env) > installer.install(demo_wheel) tests/installation/test_wheel_installer.py:36: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = wheel = PosixPath('/home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/distributions/demo-0.1.0-py2.py3-none-any.whl') def install(self, wheel: Path) -> None: with WheelFile.open(wheel) as source: > source.validate_record() E AttributeError: 'WheelFile' object has no attribute 'validate_record' ../../BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/installation/wheel_installer.py:101: AttributeError ========================================================================================= FAILURES ========================================================================================== ____________________________________________________________________________________ test_prepare_sdist _____________________________________________________________________________________ config = , config_cache_dir = PosixPath('/tmp/poetry_uvijo0sp/.cache/pypoetry') def test_prepare_sdist(config: Config, config_cache_dir: Path) -> None: chef = Chef(config, EnvManager.get_system_env(), Factory.create_pool(config)) archive = ( Path(__file__) .parent.parent.joinpath("fixtures/distributions/demo-0.1.0.tar.gz") .resolve() ) destination = chef.get_cache_directory_for_link(Link(archive.as_uri())) > wheel = chef.prepare(archive) tests/installation/test_chef.py:204: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/installation/chef.py:106: in prepare return self._prepare_sdist(archive, destination=output_dir) ../../BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/installation/chef.py:188: in _prepare_sdist return self._prepare( _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , directory = PosixPath('/tmp/tmprb277ssx/demo-0.1.0') destination = PosixPath('/tmp/poetry_uvijo0sp/.cache/pypoetry/artifacts/f9/9c/87/2c514aa4a284ae3d9232cbd0e65bf6d0d8c60c77df5768b49623b450d4') def _prepare( self, directory: Path, destination: Path, *, editable: bool = False ) -> Path: from subprocess import CalledProcessError with ephemeral_environment(self._env.python) as venv: env = IsolatedEnv(venv, self._pool) builder = ProjectBuilder( directory, python_executable=env.executable, scripts_dir=env.scripts_dir, runner=quiet_subprocess_runner, ) env.install(builder.build_system_requires) stdout = StringIO() error: Exception | None = None try: with redirect_stdout(stdout): dist_format = "wheel" if not editable else "editable" env.install( builder.build_system_requires | builder.get_requires_for_build(dist_format) ) path = Path( builder.build( dist_format, destination.as_posix(), ) ) except BuildBackendException as e: message_parts = [str(e)] if isinstance(e.exception, CalledProcessError) and ( e.exception.stdout is not None or e.exception.stderr is not None ): message_parts.append( e.exception.stderr.decode() if e.exception.stderr is not None else e.exception.stdout.decode() ) error = ChefBuildError("\n\n".join(message_parts)) if error is not None: > raise error from None E poetry.installation.chef.ChefBuildError: Backend 'poetry.core.masonry.api' is not available. ../../BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/installation/chef.py:152: ChefBuildError __________________________________________________________________________________ test_prepare_directory ___________________________________________________________________________________ config = , config_cache_dir = PosixPath('/tmp/poetry_2yboewk_/.cache/pypoetry') def test_prepare_directory(config: Config, config_cache_dir: Path): chef = Chef(config, EnvManager.get_system_env(), Factory.create_pool(config)) archive = Path(__file__).parent.parent.joinpath("fixtures/simple_project").resolve() > wheel = chef.prepare(archive) tests/installation/test_chef.py:215: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/installation/chef.py:104: in prepare return self._prepare(archive, Path(tmp_dir), editable=editable) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , directory = PosixPath('/home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/simple_project') destination = PosixPath('/tmp/poetry-chef-hfecb2hd') def _prepare( self, directory: Path, destination: Path, *, editable: bool = False ) -> Path: from subprocess import CalledProcessError with ephemeral_environment(self._env.python) as venv: env = IsolatedEnv(venv, self._pool) builder = ProjectBuilder( directory, python_executable=env.executable, scripts_dir=env.scripts_dir, runner=quiet_subprocess_runner, ) env.install(builder.build_system_requires) stdout = StringIO() error: Exception | None = None try: with redirect_stdout(stdout): dist_format = "wheel" if not editable else "editable" env.install( builder.build_system_requires | builder.get_requires_for_build(dist_format) ) path = Path( builder.build( dist_format, destination.as_posix(), ) ) except BuildBackendException as e: message_parts = [str(e)] if isinstance(e.exception, CalledProcessError) and ( e.exception.stdout is not None or e.exception.stderr is not None ): message_parts.append( e.exception.stderr.decode() if e.exception.stderr is not None else e.exception.stdout.decode() ) error = ChefBuildError("\n\n".join(message_parts)) if error is not None: > raise error from None E poetry.installation.chef.ChefBuildError: Backend 'poetry.core.masonry.api' is not available. ../../BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/installation/chef.py:152: ChefBuildError __________________________________________________________________________ test_prepare_directory_with_extensions ___________________________________________________________________________ config = , config_cache_dir = PosixPath('/tmp/poetry_ga9idza9/.cache/pypoetry') def test_prepare_directory_with_extensions( config: Config, config_cache_dir: Path ) -> None: env = EnvManager.get_system_env() chef = Chef(config, env, Factory.create_pool(config)) archive = ( Path(__file__) .parent.parent.joinpath("fixtures/extended_with_no_setup") .resolve() ) > wheel = chef.prepare(archive) tests/installation/test_chef.py:236: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/installation/chef.py:104: in prepare return self._prepare(archive, Path(tmp_dir), editable=editable) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , directory = PosixPath('/home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/extended_with_no_setup') destination = PosixPath('/tmp/poetry-chef-tlsotuhs') def _prepare( self, directory: Path, destination: Path, *, editable: bool = False ) -> Path: from subprocess import CalledProcessError with ephemeral_environment(self._env.python) as venv: env = IsolatedEnv(venv, self._pool) builder = ProjectBuilder( directory, python_executable=env.executable, scripts_dir=env.scripts_dir, runner=quiet_subprocess_runner, ) env.install(builder.build_system_requires) stdout = StringIO() error: Exception | None = None try: with redirect_stdout(stdout): dist_format = "wheel" if not editable else "editable" env.install( builder.build_system_requires | builder.get_requires_for_build(dist_format) ) path = Path( builder.build( dist_format, destination.as_posix(), ) ) except BuildBackendException as e: message_parts = [str(e)] if isinstance(e.exception, CalledProcessError) and ( e.exception.stdout is not None or e.exception.stderr is not None ): message_parts.append( e.exception.stderr.decode() if e.exception.stderr is not None else e.exception.stdout.decode() ) error = ChefBuildError("\n\n".join(message_parts)) if error is not None: > raise error from None E poetry.installation.chef.ChefBuildError: Backend 'poetry.core.masonry.api' is not available. ../../BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/installation/chef.py:152: ChefBuildError ______________________________________________________________________________ test_prepare_directory_editable ______________________________________________________________________________ config = , config_cache_dir = PosixPath('/tmp/poetry_p68lk9qh/.cache/pypoetry') def test_prepare_directory_editable(config: Config, config_cache_dir: Path): chef = Chef(config, EnvManager.get_system_env(), Factory.create_pool(config)) archive = Path(__file__).parent.parent.joinpath("fixtures/simple_project").resolve() > wheel = chef.prepare(archive, editable=True) tests/installation/test_chef.py:250: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/installation/chef.py:104: in prepare return self._prepare(archive, Path(tmp_dir), editable=editable) _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = , directory = PosixPath('/home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/simple_project') destination = PosixPath('/tmp/poetry-chef-jtyjejnn') def _prepare( self, directory: Path, destination: Path, *, editable: bool = False ) -> Path: from subprocess import CalledProcessError with ephemeral_environment(self._env.python) as venv: env = IsolatedEnv(venv, self._pool) builder = ProjectBuilder( directory, python_executable=env.executable, scripts_dir=env.scripts_dir, runner=quiet_subprocess_runner, ) env.install(builder.build_system_requires) stdout = StringIO() error: Exception | None = None try: with redirect_stdout(stdout): dist_format = "wheel" if not editable else "editable" env.install( builder.build_system_requires | builder.get_requires_for_build(dist_format) ) path = Path( builder.build( dist_format, destination.as_posix(), ) ) except BuildBackendException as e: message_parts = [str(e)] if isinstance(e.exception, CalledProcessError) and ( e.exception.stdout is not None or e.exception.stderr is not None ): message_parts.append( e.exception.stderr.decode() if e.exception.stderr is not None else e.exception.stdout.decode() ) error = ChefBuildError("\n\n".join(message_parts)) if error is not None: > raise error from None E poetry.installation.chef.ChefBuildError: Backend 'poetry.core.masonry.api' is not available. ../../BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/installation/chef.py:152: ChefBuildError _____________________________________________________________ test_execute_prints_warning_for_yanked_package[operations0-True] ______________________________________________________________ config = , pool = io = , tmp_dir = '/tmp/poetry_b0nmijwh', mock_file_downloads = None, env = MockEnv("/tmp/poetry_b0nmijwh/.venv") operations = [, ], has_warning = True @pytest.mark.parametrize( "operations, has_warning", [ ( [Install(Package("black", "21.11b0")), Install(Package("pytest", "3.5.1"))], True, ), ( [ Uninstall(Package("black", "21.11b0")), Uninstall(Package("pytest", "3.5.1")), ], False, ), ( [ Update(Package("black", "19.10b0"), Package("black", "21.11b0")), Update(Package("pytest", "3.5.0"), Package("pytest", "3.5.1")), ], True, ), ], ) def test_execute_prints_warning_for_yanked_package( config: Config, pool: RepositoryPool, io: BufferedIO, tmp_dir: str, mock_file_downloads: None, env: MockEnv, operations: list[Operation], has_warning: bool, ): config.merge({"cache-dir": tmp_dir}) executor = Executor(env, pool, config, io) return_code = executor.execute(operations) expected = ( "Warning: The file chosen for install of black 21.11b0 " "(black-21.11b0-py3-none-any.whl) is yanked. Reason for being yanked: " "Broken regex dependency. Use 21.11b1 instead." ) output = io.fetch_output() error = io.fetch_error() > assert return_code == 0, f"\noutput: {output}\nerror: {error}\n" E AssertionError: E output: E Package operations: 2 installs, 0 updates, 0 removals E E • Installing black (21.11b0) E • Installing pytest (3.5.1) E E AttributeError E E 'WheelFile' object has no attribute 'validate_record' E E at ~/rpmbuild/BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/installation/wheel_installer.py:101 in install E 97│ self._destination.bytecode_optimization_levels = (-1,) if enable else () E 98│ E 99│ def install(self, wheel: Path) -> None: E 100│ with WheelFile.open(wheel) as source: E → 101│ source.validate_record() E 102│ install( E 103│ source=source, E 104│ destination=self._destination.for_source(source), E 105│ # Additional metadata that is generated by the installation tool. E E E AttributeError E E 'WheelFile' object has no attribute 'validate_record' E E at ~/rpmbuild/BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/installation/wheel_installer.py:101 in install E 97│ self._destination.bytecode_optimization_levels = (-1,) if enable else () E 98│ E 99│ def install(self, wheel: Path) -> None: E 100│ with WheelFile.open(wheel) as source: E → 101│ source.validate_record() E 102│ install( E 103│ source=source, E 104│ destination=self._destination.for_source(source), E 105│ # Additional metadata that is generated by the installation tool. E E E error: Warning: The file chosen for install of black 21.11b0 (black-21.11b0-py3-none-any.whl) is yanked. Reason for being yanked: Broken regex dependency. Use 21.11b1 instead. E E E assert 1 == 0 tests/installation/test_executor.py:335: AssertionError ------------------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------------- DEBUG poetry.utils.authenticator:authenticator.py:182 Creating new session for files.pythonhosted.org DEBUG urllib3.connectionpool:connectionpool.py:1003 Starting new HTTPS connection (1): files.pythonhosted.org:443 DEBUG urllib3.connectionpool:connectionpool.py:456 https://files.pythonhosted.org:443 "GET /packages/76/52/fc48d02492d9e6070cb672d9133382e83084f567f88eff1c27bd2c6c27a8/pytest-3.5.1-py2.py3-none-any.whl HTTP/1.1" 200 3708 DEBUG urllib3.connectionpool:connectionpool.py:273 Resetting dropped connection: files.pythonhosted.org DEBUG urllib3.connectionpool:connectionpool.py:456 https://files.pythonhosted.org:443 "GET /packages/3d/ad/1cf514e7f9ee4c3d8df7c839d7977f7605ad76557f3fca741ec67f76dba6/black-21.11b0-py3-none-any.whl HTTP/1.1" 200 14949 _____________________________________________________________ test_execute_prints_warning_for_yanked_package[operations2-True] ______________________________________________________________ config = , pool = io = , tmp_dir = '/tmp/poetry_b39agvn4', mock_file_downloads = None, env = MockEnv("/tmp/poetry_b39agvn4/.venv") operations = [, ], has_warning = True @pytest.mark.parametrize( "operations, has_warning", [ ( [Install(Package("black", "21.11b0")), Install(Package("pytest", "3.5.1"))], True, ), ( [ Uninstall(Package("black", "21.11b0")), Uninstall(Package("pytest", "3.5.1")), ], False, ), ( [ Update(Package("black", "19.10b0"), Package("black", "21.11b0")), Update(Package("pytest", "3.5.0"), Package("pytest", "3.5.1")), ], True, ), ], ) def test_execute_prints_warning_for_yanked_package( config: Config, pool: RepositoryPool, io: BufferedIO, tmp_dir: str, mock_file_downloads: None, env: MockEnv, operations: list[Operation], has_warning: bool, ): config.merge({"cache-dir": tmp_dir}) executor = Executor(env, pool, config, io) return_code = executor.execute(operations) expected = ( "Warning: The file chosen for install of black 21.11b0 " "(black-21.11b0-py3-none-any.whl) is yanked. Reason for being yanked: " "Broken regex dependency. Use 21.11b1 instead." ) output = io.fetch_output() error = io.fetch_error() > assert return_code == 0, f"\noutput: {output}\nerror: {error}\n" E AssertionError: E output: E Package operations: 0 installs, 2 updates, 0 removals E E • Updating black (19.10b0 -> 21.11b0) E • Updating pytest (3.5.0 -> 3.5.1) E E AttributeError E E 'WheelFile' object has no attribute 'validate_record' E E at ~/rpmbuild/BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/installation/wheel_installer.py:101 in install E 97│ self._destination.bytecode_optimization_levels = (-1,) if enable else () E 98│ E 99│ def install(self, wheel: Path) -> None: E 100│ with WheelFile.open(wheel) as source: E → 101│ source.validate_record() E 102│ install( E 103│ source=source, E 104│ destination=self._destination.for_source(source), E 105│ # Additional metadata that is generated by the installation tool. E E E AttributeError E E 'WheelFile' object has no attribute 'validate_record' E E at ~/rpmbuild/BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/installation/wheel_installer.py:101 in install E 97│ self._destination.bytecode_optimization_levels = (-1,) if enable else () E 98│ E 99│ def install(self, wheel: Path) -> None: E 100│ with WheelFile.open(wheel) as source: E → 101│ source.validate_record() E 102│ install( E 103│ source=source, E 104│ destination=self._destination.for_source(source), E 105│ # Additional metadata that is generated by the installation tool. E E E error: Warning: The file chosen for install of black 21.11b0 (black-21.11b0-py3-none-any.whl) is yanked. Reason for being yanked: Broken regex dependency. Use 21.11b1 instead. E E E assert 1 == 0 tests/installation/test_executor.py:335: AssertionError ------------------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------------- DEBUG poetry.utils.authenticator:authenticator.py:182 Creating new session for files.pythonhosted.org DEBUG urllib3.connectionpool:connectionpool.py:1003 Starting new HTTPS connection (1): files.pythonhosted.org:443 DEBUG urllib3.connectionpool:connectionpool.py:456 https://files.pythonhosted.org:443 "GET /packages/3d/ad/1cf514e7f9ee4c3d8df7c839d7977f7605ad76557f3fca741ec67f76dba6/black-21.11b0-py3-none-any.whl HTTP/1.1" 200 14949 DEBUG urllib3.connectionpool:connectionpool.py:273 Resetting dropped connection: files.pythonhosted.org DEBUG urllib3.connectionpool:connectionpool.py:456 https://files.pythonhosted.org:443 "GET /packages/76/52/fc48d02492d9e6070cb672d9133382e83084f567f88eff1c27bd2c6c27a8/pytest-3.5.1-py2.py3-none-any.whl HTTP/1.1" 200 3708 ____________________________________________________________________________ test_execute_works_with_ansi_output ____________________________________________________________________________ config = , pool = io_decorated = , tmp_dir = '/tmp/poetry_ec8abwaj', mock_file_downloads = None, env = MockEnv("/tmp/poetry_ec8abwaj/.venv") def test_execute_works_with_ansi_output( config: Config, pool: RepositoryPool, io_decorated: BufferedIO, tmp_dir: str, mock_file_downloads: None, env: MockEnv, ): config.merge({"cache-dir": tmp_dir}) executor = Executor(env, pool, config, io_decorated) return_code = executor.execute( [ Install(Package("cleo", "1.0.0a5")), ] ) # fmt: off expected = [ "\x1b[39;1mPackage operations\x1b[39;22m: \x1b[34m1\x1b[39m install, \x1b[34m0\x1b[39m updates, \x1b[34m0\x1b[39m removals", # noqa: E501 "\x1b[34;1m•\x1b[39;22m \x1b[39mInstalling \x1b[39m\x1b[36mcleo\x1b[39m\x1b[39m (\x1b[39m\x1b[39;1m1.0.0a5\x1b[39;22m\x1b[39m)\x1b[39m: \x1b[34mPending...\x1b[39m", # noqa: E501 "\x1b[34;1m•\x1b[39;22m \x1b[39mInstalling \x1b[39m\x1b[36mcleo\x1b[39m\x1b[39m (\x1b[39m\x1b[39;1m1.0.0a5\x1b[39;22m\x1b[39m)\x1b[39m: \x1b[34mDownloading...\x1b[39m", # noqa: E501 "\x1b[34;1m•\x1b[39;22m \x1b[39mInstalling \x1b[39m\x1b[36mcleo\x1b[39m\x1b[39m (\x1b[39m\x1b[39;1m1.0.0a5\x1b[39;22m\x1b[39m)\x1b[39m: \x1b[34mInstalling...\x1b[39m", # noqa: E501 "\x1b[32;1m•\x1b[39;22m \x1b[39mInstalling \x1b[39m\x1b[36mcleo\x1b[39m\x1b[39m (\x1b[39m\x1b[32m1.0.0a5\x1b[39m\x1b[39m)\x1b[39m", # finished # noqa: E501 ] # fmt: on output = io_decorated.fetch_output() # hint: use print(repr(output)) if you need to debug this for line in expected: > assert line in output E AssertionError: assert '\x1b[32;1m•\x1b[39;22m \x1b[39mInstalling \x1b[39m\x1b[36mcleo\x1b[39m\x1b[39m (\x1b[39m\x1b[32m1.0.0a5\x1b[39m\x1b[39m)\x1b[39m' in '\n\x1b[39;1mPackage operations\x1b[39;22m: \x1b[34m1\x1b[39m install, \x1b[34m0\x1b[39m updates, \x1b[34m0\x1b[39m re... \x1b[39m\x1b[39;2;3m# Additional metadata that is generated by the installation tool.\x1b[39;22;23m\n\n' tests/installation/test_executor.py:432: AssertionError ------------------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------------- DEBUG poetry.utils.authenticator:authenticator.py:182 Creating new session for files.pythonhosted.org DEBUG urllib3.connectionpool:connectionpool.py:1003 Starting new HTTPS connection (1): files.pythonhosted.org:443 DEBUG urllib3.connectionpool:connectionpool.py:456 https://files.pythonhosted.org:443 "GET /packages/45/0c/3825603bf62f360829b1eea29a43dadce30829067e288170b3bf738aafd0/cleo-1.0.0a5-py3-none-any.whl HTTP/1.1" 200 78701 __________________________________________________________________________ test_execute_works_with_no_ansi_output ___________________________________________________________________________ mocker = , config = pool = , io_not_decorated = tmp_dir = '/tmp/poetry_aa288fkl', mock_file_downloads = None, env = MockEnv("/tmp/poetry_aa288fkl/.venv") def test_execute_works_with_no_ansi_output( mocker: MockerFixture, config: Config, pool: RepositoryPool, io_not_decorated: BufferedIO, tmp_dir: str, mock_file_downloads: None, env: MockEnv, ): config.merge({"cache-dir": tmp_dir}) executor = Executor(env, pool, config, io_not_decorated) return_code = executor.execute( [ Install(Package("cleo", "1.0.0a5")), ] ) expected = """ Package operations: 1 install, 0 updates, 0 removals • Installing cleo (1.0.0a5) """ expected = set(expected.splitlines()) output = set(io_not_decorated.fetch_output().splitlines()) > assert output == expected E AssertionError: assert {'', ' ...nstall(', ...} == {'', ' • Ins..., 0 removals'} E Extra items in the left set: E ' 105│ # Additional metadata that is generated by the installation tool.' E ' → 101│ source.validate_record()' E ' 102│ install(' E ' 104│ destination=self._destination.for_source(source),' E ' AttributeError' E ' 99│ def install(self, wheel: Path) -> None:'... E E ...Full output truncated (8 lines hidden), use '-vv' to show tests/installation/test_executor.py:462: AssertionError ------------------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------------- DEBUG poetry.utils.authenticator:authenticator.py:182 Creating new session for files.pythonhosted.org DEBUG urllib3.connectionpool:connectionpool.py:1003 Starting new HTTPS connection (1): files.pythonhosted.org:443 DEBUG urllib3.connectionpool:connectionpool.py:456 https://files.pythonhosted.org:443 "GET /packages/45/0c/3825603bf62f360829b1eea29a43dadce30829067e288170b3bf738aafd0/cleo-1.0.0a5-py3-none-any.whl HTTP/1.1" 200 78701 _____________________________________________________ test_executor_should_not_write_pep610_url_references_for_cached_package[package0] _____________________________________________________ package = Package('demo', '0.1.0'), mocker = , fixture_dir = ._fixture_dir at 0x7f9db57748b0> tmp_venv = VirtualEnv("/tmp/poetry_kpynwswd/venv"), pool = config = , io = @pytest.mark.parametrize( "package", [ Package("demo", "0.1.0"), # PyPI Package( # private source "demo", "0.1.0", source_type="legacy", source_url="http://localhost:3141/root/pypi/+simple", source_reference="private", ), ], ) def test_executor_should_not_write_pep610_url_references_for_cached_package( package: Package, mocker: MockerFixture, fixture_dir: FixtureDirGetter, tmp_venv: VirtualEnv, pool: RepositoryPool, config: Config, io: BufferedIO, ): link_cached = fixture_dir("distributions") / "demo-0.1.0-py2.py3-none-any.whl" package.files = [ { "file": "demo-0.1.0-py2.py3-none-any.whl", "hash": "sha256:70e704135718fffbcbf61ed1fc45933cfd86951a744b681000eaaa75da31f17a", # noqa: E501 } ] mocker.patch( "poetry.installation.executor.Executor._download", return_value=link_cached ) executor = Executor(tmp_venv, pool, config, io) executor.execute([Install(package)]) > verify_installed_distribution(tmp_venv, package) tests/installation/test_executor.py:623: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ venv = VirtualEnv("/tmp/poetry_kpynwswd/venv"), package = Package('demo', '0.1.0'), url_reference = None def verify_installed_distribution( venv: VirtualEnv, package: Package, url_reference: dict[str, Any] | None = None ): distributions = list(venv.site_packages.distributions(name=package.name)) > assert len(distributions) == 1 E assert 0 == 1 E + where 0 = len([]) tests/installation/test_executor.py:563: AssertionError _____________________________________________________ test_executor_should_not_write_pep610_url_references_for_cached_package[package1] _____________________________________________________ package = Package('demo', '0.1.0', source_type='legacy', source_url='http://localhost:3141/root/pypi/+simple', source_reference='private') mocker = , fixture_dir = ._fixture_dir at 0x7f9db57748b0> tmp_venv = VirtualEnv("/tmp/poetry_5u7yvt3j/venv"), pool = config = , io = @pytest.mark.parametrize( "package", [ Package("demo", "0.1.0"), # PyPI Package( # private source "demo", "0.1.0", source_type="legacy", source_url="http://localhost:3141/root/pypi/+simple", source_reference="private", ), ], ) def test_executor_should_not_write_pep610_url_references_for_cached_package( package: Package, mocker: MockerFixture, fixture_dir: FixtureDirGetter, tmp_venv: VirtualEnv, pool: RepositoryPool, config: Config, io: BufferedIO, ): link_cached = fixture_dir("distributions") / "demo-0.1.0-py2.py3-none-any.whl" package.files = [ { "file": "demo-0.1.0-py2.py3-none-any.whl", "hash": "sha256:70e704135718fffbcbf61ed1fc45933cfd86951a744b681000eaaa75da31f17a", # noqa: E501 } ] mocker.patch( "poetry.installation.executor.Executor._download", return_value=link_cached ) executor = Executor(tmp_venv, pool, config, io) executor.execute([Install(package)]) > verify_installed_distribution(tmp_venv, package) tests/installation/test_executor.py:623: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ venv = VirtualEnv("/tmp/poetry_5u7yvt3j/venv"), package = Package('demo', '0.1.0', source_type='legacy', source_url='http://localhost:3141/root/pypi/+simple', source_reference='private') url_reference = None def verify_installed_distribution( venv: VirtualEnv, package: Package, url_reference: dict[str, Any] | None = None ): distributions = list(venv.site_packages.distributions(name=package.name)) > assert len(distributions) == 1 E assert 0 == 1 E + where 0 = len([]) tests/installation/test_executor.py:563: AssertionError _____________________________________________________________ test_executor_should_write_pep610_url_references_for_wheel_files ______________________________________________________________ tmp_venv = VirtualEnv("/tmp/poetry_kh78osl4/venv"), pool = config = , io = def test_executor_should_write_pep610_url_references_for_wheel_files( tmp_venv: VirtualEnv, pool: RepositoryPool, config: Config, io: BufferedIO ): url = ( Path(__file__) .parent.parent.joinpath( "fixtures/distributions/demo-0.1.0-py2.py3-none-any.whl" ) .resolve() ) package = Package("demo", "0.1.0", source_type="file", source_url=url.as_posix()) # Set package.files so the executor will attempt to hash the package package.files = [ { "file": "demo-0.1.0-py2.py3-none-any.whl", "hash": "sha256:70e704135718fffbcbf61ed1fc45933cfd86951a744b681000eaaa75da31f17a", # noqa: E501 } ] executor = Executor(tmp_venv, pool, config, io) executor.execute([Install(package)]) expected_url_reference = { "archive_info": { "hashes": { "sha256": ( "70e704135718fffbcbf61ed1fc45933cfd86951a744b681000eaaa75da31f17a" ) }, }, "url": url.as_uri(), } > verify_installed_distribution(tmp_venv, package, expected_url_reference) tests/installation/test_executor.py:657: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ venv = VirtualEnv("/tmp/poetry_kh78osl4/venv") package = Package('demo', '0.1.0', source_type='file', source_url='/home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/distributions/demo-0.1.0-py2.py3-none-any.whl') url_reference = {'archive_info': {'hashes': {'sha256': '70e704135718fffbcbf61ed1fc45933cfd86951a744b681000eaaa75da31f17a'}}, 'url': 'file:///home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/distributions/demo-0.1.0-py2.py3-none-any.whl'} def verify_installed_distribution( venv: VirtualEnv, package: Package, url_reference: dict[str, Any] | None = None ): distributions = list(venv.site_packages.distributions(name=package.name)) > assert len(distributions) == 1 E assert 0 == 1 E + where 0 = len([]) tests/installation/test_executor.py:563: AssertionError ___________________________________________________________ test_executor_should_write_pep610_url_references_for_non_wheel_files ____________________________________________________________ tmp_venv = VirtualEnv("/tmp/poetry_70l_pyw7/venv"), pool = config = , io = def test_executor_should_write_pep610_url_references_for_non_wheel_files( tmp_venv: VirtualEnv, pool: RepositoryPool, config: Config, io: BufferedIO ): url = ( Path(__file__) .parent.parent.joinpath("fixtures/distributions/demo-0.1.0.tar.gz") .resolve() ) package = Package("demo", "0.1.0", source_type="file", source_url=url.as_posix()) # Set package.files so the executor will attempt to hash the package package.files = [ { "file": "demo-0.1.0.tar.gz", "hash": "sha256:9fa123ad707a5c6c944743bf3e11a0e80d86cb518d3cf25320866ca3ef43e2ad", # noqa: E501 } ] executor = Executor(tmp_venv, pool, config, io) executor.execute([Install(package)]) expected_url_reference = { "archive_info": { "hashes": { "sha256": ( "9fa123ad707a5c6c944743bf3e11a0e80d86cb518d3cf25320866ca3ef43e2ad" ) }, }, "url": url.as_uri(), } > verify_installed_distribution(tmp_venv, package, expected_url_reference) tests/installation/test_executor.py:689: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ venv = VirtualEnv("/tmp/poetry_70l_pyw7/venv") package = Package('demo', '0.1.0', source_type='file', source_url='/home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/distributions/demo-0.1.0.tar.gz') url_reference = {'archive_info': {'hashes': {'sha256': '9fa123ad707a5c6c944743bf3e11a0e80d86cb518d3cf25320866ca3ef43e2ad'}}, 'url': 'file:///home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/distributions/demo-0.1.0.tar.gz'} def verify_installed_distribution( venv: VirtualEnv, package: Package, url_reference: dict[str, Any] | None = None ): distributions = list(venv.site_packages.distributions(name=package.name)) > assert len(distributions) == 1 E assert 0 == 1 E + where 0 = len([]) tests/installation/test_executor.py:563: AssertionError _____________________________________________________________ test_executor_should_write_pep610_url_references_for_directories ______________________________________________________________ tmp_venv = VirtualEnv("/tmp/poetry_521w1mmd/venv"), pool = config = , io = wheel = PosixPath('/tmp/tmpei1si_18/demo-0.1.2-py2.py3-none-any.whl') def test_executor_should_write_pep610_url_references_for_directories( tmp_venv: VirtualEnv, pool: RepositoryPool, config: Config, io: BufferedIO, wheel: Path, ): url = ( Path(__file__) .parent.parent.joinpath("fixtures/git/github.com/demo/demo") .resolve() ) package = Package( "demo", "0.1.2", source_type="directory", source_url=url.as_posix() ) chef = Chef(config, tmp_venv, Factory.create_pool(config)) chef.set_directory_wheel(wheel) executor = Executor(tmp_venv, pool, config, io) executor._chef = chef executor.execute([Install(package)]) > verify_installed_distribution( tmp_venv, package, {"dir_info": {}, "url": url.as_uri()} ) tests/installation/test_executor.py:714: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ venv = VirtualEnv("/tmp/poetry_521w1mmd/venv") package = Package('demo', '0.1.2', source_type='directory', source_url='/home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/git/github.com/demo/demo') url_reference = {'dir_info': {}, 'url': 'file:///home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/git/github.com/demo/demo'} def verify_installed_distribution( venv: VirtualEnv, package: Package, url_reference: dict[str, Any] | None = None ): distributions = list(venv.site_packages.distributions(name=package.name)) > assert len(distributions) == 1 E assert 0 == 1 E + where 0 = len([]) tests/installation/test_executor.py:563: AssertionError _________________________________________________________ test_executor_should_write_pep610_url_references_for_editable_directories _________________________________________________________ tmp_venv = VirtualEnv("/tmp/poetry_80h0obzn/venv"), pool = config = , io = wheel = PosixPath('/tmp/tmpeaqb2bx4/demo-0.1.2-py2.py3-none-any.whl') def test_executor_should_write_pep610_url_references_for_editable_directories( tmp_venv: VirtualEnv, pool: RepositoryPool, config: Config, io: BufferedIO, wheel: Path, ): url = ( Path(__file__) .parent.parent.joinpath("fixtures/git/github.com/demo/demo") .resolve() ) package = Package( "demo", "0.1.2", source_type="directory", source_url=url.as_posix(), develop=True, ) chef = Chef(config, tmp_venv, Factory.create_pool(config)) chef.set_directory_wheel(wheel) executor = Executor(tmp_venv, pool, config, io) executor._chef = chef executor.execute([Install(package)]) > verify_installed_distribution( tmp_venv, package, {"dir_info": {"editable": True}, "url": url.as_uri()} ) tests/installation/test_executor.py:745: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ venv = VirtualEnv("/tmp/poetry_80h0obzn/venv") package = Package('demo', '0.1.2', source_type='directory', source_url='/home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/git/github.com/demo/demo') url_reference = {'dir_info': {'editable': True}, 'url': 'file:///home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/git/github.com/demo/demo'} def verify_installed_distribution( venv: VirtualEnv, package: Package, url_reference: dict[str, Any] | None = None ): distributions = list(venv.site_packages.distributions(name=package.name)) > assert len(distributions) == 1 E assert 0 == 1 E + where 0 = len([]) tests/installation/test_executor.py:563: AssertionError __________________________________________________________ test_executor_should_write_pep610_url_references_for_wheel_urls[False] ___________________________________________________________ tmp_venv = VirtualEnv("/tmp/poetry_aklphk1d/venv"), pool = config = , io = , mock_file_downloads = None mocker = , fixture_dir = ._fixture_dir at 0x7f9db57748b0>, is_artifact_cached = False @pytest.mark.parametrize("is_artifact_cached", [False, True]) def test_executor_should_write_pep610_url_references_for_wheel_urls( tmp_venv: VirtualEnv, pool: RepositoryPool, config: Config, io: BufferedIO, mock_file_downloads: None, mocker: MockerFixture, fixture_dir: FixtureDirGetter, is_artifact_cached: bool, ): if is_artifact_cached: link_cached = fixture_dir("distributions") / "demo-0.1.0-py2.py3-none-any.whl" mocker.patch( "poetry.installation.chef.Chef.get_cached_archive_for_link", return_value=link_cached, ) download_spy = mocker.spy(Executor, "_download_archive") package = Package( "demo", "0.1.0", source_type="url", source_url="https://files.pythonhosted.org/demo-0.1.0-py2.py3-none-any.whl", ) # Set package.files so the executor will attempt to hash the package package.files = [ { "file": "demo-0.1.0-py2.py3-none-any.whl", "hash": "sha256:70e704135718fffbcbf61ed1fc45933cfd86951a744b681000eaaa75da31f17a", # noqa: E501 } ] executor = Executor(tmp_venv, pool, config, io) operation = Install(package) executor.execute([operation]) expected_url_reference = { "archive_info": { "hashes": { "sha256": ( "70e704135718fffbcbf61ed1fc45933cfd86951a744b681000eaaa75da31f17a" ) }, }, "url": package.source_url, } > verify_installed_distribution(tmp_venv, package, expected_url_reference) tests/installation/test_executor.py:796: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ venv = VirtualEnv("/tmp/poetry_aklphk1d/venv"), package = Package('demo', '0.1.0', source_type='url', source_url='https://files.pythonhosted.org/demo-0.1.0-py2.py3-none-any.whl') url_reference = {'archive_info': {'hashes': {'sha256': '70e704135718fffbcbf61ed1fc45933cfd86951a744b681000eaaa75da31f17a'}}, 'url': 'https://files.pythonhosted.org/demo-0.1.0-py2.py3-none-any.whl'} def verify_installed_distribution( venv: VirtualEnv, package: Package, url_reference: dict[str, Any] | None = None ): distributions = list(venv.site_packages.distributions(name=package.name)) > assert len(distributions) == 1 E assert 0 == 1 E + where 0 = len([]) tests/installation/test_executor.py:563: AssertionError ------------------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------------- DEBUG poetry.utils.authenticator:authenticator.py:182 Creating new session for files.pythonhosted.org DEBUG urllib3.connectionpool:connectionpool.py:1003 Starting new HTTPS connection (1): files.pythonhosted.org:443 DEBUG urllib3.connectionpool:connectionpool.py:456 https://files.pythonhosted.org:443 "GET /demo-0.1.0-py2.py3-none-any.whl HTTP/1.1" 200 1116 ___________________________________________________________ test_executor_should_write_pep610_url_references_for_wheel_urls[True] ___________________________________________________________ tmp_venv = VirtualEnv("/tmp/poetry_49qr9o8x/venv"), pool = config = , io = , mock_file_downloads = None mocker = , fixture_dir = ._fixture_dir at 0x7f9db57748b0>, is_artifact_cached = True @pytest.mark.parametrize("is_artifact_cached", [False, True]) def test_executor_should_write_pep610_url_references_for_wheel_urls( tmp_venv: VirtualEnv, pool: RepositoryPool, config: Config, io: BufferedIO, mock_file_downloads: None, mocker: MockerFixture, fixture_dir: FixtureDirGetter, is_artifact_cached: bool, ): if is_artifact_cached: link_cached = fixture_dir("distributions") / "demo-0.1.0-py2.py3-none-any.whl" mocker.patch( "poetry.installation.chef.Chef.get_cached_archive_for_link", return_value=link_cached, ) download_spy = mocker.spy(Executor, "_download_archive") package = Package( "demo", "0.1.0", source_type="url", source_url="https://files.pythonhosted.org/demo-0.1.0-py2.py3-none-any.whl", ) # Set package.files so the executor will attempt to hash the package package.files = [ { "file": "demo-0.1.0-py2.py3-none-any.whl", "hash": "sha256:70e704135718fffbcbf61ed1fc45933cfd86951a744b681000eaaa75da31f17a", # noqa: E501 } ] executor = Executor(tmp_venv, pool, config, io) operation = Install(package) executor.execute([operation]) expected_url_reference = { "archive_info": { "hashes": { "sha256": ( "70e704135718fffbcbf61ed1fc45933cfd86951a744b681000eaaa75da31f17a" ) }, }, "url": package.source_url, } > verify_installed_distribution(tmp_venv, package, expected_url_reference) tests/installation/test_executor.py:796: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ venv = VirtualEnv("/tmp/poetry_49qr9o8x/venv"), package = Package('demo', '0.1.0', source_type='url', source_url='https://files.pythonhosted.org/demo-0.1.0-py2.py3-none-any.whl') url_reference = {'archive_info': {'hashes': {'sha256': '70e704135718fffbcbf61ed1fc45933cfd86951a744b681000eaaa75da31f17a'}}, 'url': 'https://files.pythonhosted.org/demo-0.1.0-py2.py3-none-any.whl'} def verify_installed_distribution( venv: VirtualEnv, package: Package, url_reference: dict[str, Any] | None = None ): distributions = list(venv.site_packages.distributions(name=package.name)) > assert len(distributions) == 1 E assert 0 == 1 E + where 0 = len([]) tests/installation/test_executor.py:563: AssertionError ________________________________________________ test_executor_should_write_pep610_url_references_for_non_wheel_urls[True-False-True-False] _________________________________________________ tmp_venv = VirtualEnv("/tmp/poetry_ajmrkn1m/venv"), pool = config = , io = , mock_file_downloads = None mocker = , fixture_dir = ._fixture_dir at 0x7f9db57748b0>, is_sdist_cached = True is_wheel_cached = False, expect_artifact_building = True, expect_artifact_download = False @pytest.mark.parametrize( ( "is_sdist_cached", "is_wheel_cached", "expect_artifact_building", "expect_artifact_download", ), [ (True, False, True, False), (True, True, False, False), (False, False, True, True), (False, True, False, True), ], ) def test_executor_should_write_pep610_url_references_for_non_wheel_urls( tmp_venv: VirtualEnv, pool: RepositoryPool, config: Config, io: BufferedIO, mock_file_downloads: None, mocker: MockerFixture, fixture_dir: FixtureDirGetter, is_sdist_cached: bool, is_wheel_cached: bool, expect_artifact_building: bool, expect_artifact_download: bool, ): built_wheel = fixture_dir("distributions") / "demo-0.1.0-py2.py3-none-any.whl" mock_prepare = mocker.patch( "poetry.installation.chef.Chef._prepare", return_value=built_wheel, ) download_spy = mocker.spy(Executor, "_download_archive") if is_sdist_cached | is_wheel_cached: cached_sdist = fixture_dir("distributions") / "demo-0.1.0.tar.gz" cached_wheel = fixture_dir("distributions") / "demo-0.1.0-py2.py3-none-any.whl" def mock_get_cached_archive_for_link_func(_: Link, strict: bool): if is_wheel_cached and not strict: return cached_wheel if is_sdist_cached: return cached_sdist return None mocker.patch( "poetry.installation.chef.Chef.get_cached_archive_for_link", side_effect=mock_get_cached_archive_for_link_func, ) package = Package( "demo", "0.1.0", source_type="url", source_url="https://files.pythonhosted.org/demo-0.1.0.tar.gz", ) # Set package.files so the executor will attempt to hash the package package.files = [ { "file": "demo-0.1.0.tar.gz", "hash": "sha256:9fa123ad707a5c6c944743bf3e11a0e80d86cb518d3cf25320866ca3ef43e2ad", # noqa: E501 } ] executor = Executor(tmp_venv, pool, config, io) operation = Install(package) executor.execute([operation]) expected_url_reference = { "archive_info": { "hashes": { "sha256": ( "9fa123ad707a5c6c944743bf3e11a0e80d86cb518d3cf25320866ca3ef43e2ad" ) }, }, "url": package.source_url, } > verify_installed_distribution(tmp_venv, package, expected_url_reference) tests/installation/test_executor.py:882: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ venv = VirtualEnv("/tmp/poetry_ajmrkn1m/venv"), package = Package('demo', '0.1.0', source_type='url', source_url='https://files.pythonhosted.org/demo-0.1.0.tar.gz') url_reference = {'archive_info': {'hashes': {'sha256': '9fa123ad707a5c6c944743bf3e11a0e80d86cb518d3cf25320866ca3ef43e2ad'}}, 'url': 'https://files.pythonhosted.org/demo-0.1.0.tar.gz'} def verify_installed_distribution( venv: VirtualEnv, package: Package, url_reference: dict[str, Any] | None = None ): distributions = list(venv.site_packages.distributions(name=package.name)) > assert len(distributions) == 1 E assert 0 == 1 E + where 0 = len([]) tests/installation/test_executor.py:563: AssertionError ________________________________________________ test_executor_should_write_pep610_url_references_for_non_wheel_urls[True-True-False-False] _________________________________________________ tmp_venv = VirtualEnv("/tmp/poetry_pij7trrc/venv"), pool = config = , io = , mock_file_downloads = None mocker = , fixture_dir = ._fixture_dir at 0x7f9db57748b0>, is_sdist_cached = True is_wheel_cached = True, expect_artifact_building = False, expect_artifact_download = False @pytest.mark.parametrize( ( "is_sdist_cached", "is_wheel_cached", "expect_artifact_building", "expect_artifact_download", ), [ (True, False, True, False), (True, True, False, False), (False, False, True, True), (False, True, False, True), ], ) def test_executor_should_write_pep610_url_references_for_non_wheel_urls( tmp_venv: VirtualEnv, pool: RepositoryPool, config: Config, io: BufferedIO, mock_file_downloads: None, mocker: MockerFixture, fixture_dir: FixtureDirGetter, is_sdist_cached: bool, is_wheel_cached: bool, expect_artifact_building: bool, expect_artifact_download: bool, ): built_wheel = fixture_dir("distributions") / "demo-0.1.0-py2.py3-none-any.whl" mock_prepare = mocker.patch( "poetry.installation.chef.Chef._prepare", return_value=built_wheel, ) download_spy = mocker.spy(Executor, "_download_archive") if is_sdist_cached | is_wheel_cached: cached_sdist = fixture_dir("distributions") / "demo-0.1.0.tar.gz" cached_wheel = fixture_dir("distributions") / "demo-0.1.0-py2.py3-none-any.whl" def mock_get_cached_archive_for_link_func(_: Link, strict: bool): if is_wheel_cached and not strict: return cached_wheel if is_sdist_cached: return cached_sdist return None mocker.patch( "poetry.installation.chef.Chef.get_cached_archive_for_link", side_effect=mock_get_cached_archive_for_link_func, ) package = Package( "demo", "0.1.0", source_type="url", source_url="https://files.pythonhosted.org/demo-0.1.0.tar.gz", ) # Set package.files so the executor will attempt to hash the package package.files = [ { "file": "demo-0.1.0.tar.gz", "hash": "sha256:9fa123ad707a5c6c944743bf3e11a0e80d86cb518d3cf25320866ca3ef43e2ad", # noqa: E501 } ] executor = Executor(tmp_venv, pool, config, io) operation = Install(package) executor.execute([operation]) expected_url_reference = { "archive_info": { "hashes": { "sha256": ( "9fa123ad707a5c6c944743bf3e11a0e80d86cb518d3cf25320866ca3ef43e2ad" ) }, }, "url": package.source_url, } > verify_installed_distribution(tmp_venv, package, expected_url_reference) tests/installation/test_executor.py:882: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ venv = VirtualEnv("/tmp/poetry_pij7trrc/venv"), package = Package('demo', '0.1.0', source_type='url', source_url='https://files.pythonhosted.org/demo-0.1.0.tar.gz') url_reference = {'archive_info': {'hashes': {'sha256': '9fa123ad707a5c6c944743bf3e11a0e80d86cb518d3cf25320866ca3ef43e2ad'}}, 'url': 'https://files.pythonhosted.org/demo-0.1.0.tar.gz'} def verify_installed_distribution( venv: VirtualEnv, package: Package, url_reference: dict[str, Any] | None = None ): distributions = list(venv.site_packages.distributions(name=package.name)) > assert len(distributions) == 1 E assert 0 == 1 E + where 0 = len([]) tests/installation/test_executor.py:563: AssertionError ________________________________________________ test_executor_should_write_pep610_url_references_for_non_wheel_urls[False-False-True-True] _________________________________________________ tmp_venv = VirtualEnv("/tmp/poetry_1i3hqo_9/venv"), pool = config = , io = , mock_file_downloads = None mocker = , fixture_dir = ._fixture_dir at 0x7f9db57748b0>, is_sdist_cached = False is_wheel_cached = False, expect_artifact_building = True, expect_artifact_download = True @pytest.mark.parametrize( ( "is_sdist_cached", "is_wheel_cached", "expect_artifact_building", "expect_artifact_download", ), [ (True, False, True, False), (True, True, False, False), (False, False, True, True), (False, True, False, True), ], ) def test_executor_should_write_pep610_url_references_for_non_wheel_urls( tmp_venv: VirtualEnv, pool: RepositoryPool, config: Config, io: BufferedIO, mock_file_downloads: None, mocker: MockerFixture, fixture_dir: FixtureDirGetter, is_sdist_cached: bool, is_wheel_cached: bool, expect_artifact_building: bool, expect_artifact_download: bool, ): built_wheel = fixture_dir("distributions") / "demo-0.1.0-py2.py3-none-any.whl" mock_prepare = mocker.patch( "poetry.installation.chef.Chef._prepare", return_value=built_wheel, ) download_spy = mocker.spy(Executor, "_download_archive") if is_sdist_cached | is_wheel_cached: cached_sdist = fixture_dir("distributions") / "demo-0.1.0.tar.gz" cached_wheel = fixture_dir("distributions") / "demo-0.1.0-py2.py3-none-any.whl" def mock_get_cached_archive_for_link_func(_: Link, strict: bool): if is_wheel_cached and not strict: return cached_wheel if is_sdist_cached: return cached_sdist return None mocker.patch( "poetry.installation.chef.Chef.get_cached_archive_for_link", side_effect=mock_get_cached_archive_for_link_func, ) package = Package( "demo", "0.1.0", source_type="url", source_url="https://files.pythonhosted.org/demo-0.1.0.tar.gz", ) # Set package.files so the executor will attempt to hash the package package.files = [ { "file": "demo-0.1.0.tar.gz", "hash": "sha256:9fa123ad707a5c6c944743bf3e11a0e80d86cb518d3cf25320866ca3ef43e2ad", # noqa: E501 } ] executor = Executor(tmp_venv, pool, config, io) operation = Install(package) executor.execute([operation]) expected_url_reference = { "archive_info": { "hashes": { "sha256": ( "9fa123ad707a5c6c944743bf3e11a0e80d86cb518d3cf25320866ca3ef43e2ad" ) }, }, "url": package.source_url, } > verify_installed_distribution(tmp_venv, package, expected_url_reference) tests/installation/test_executor.py:882: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ venv = VirtualEnv("/tmp/poetry_1i3hqo_9/venv"), package = Package('demo', '0.1.0', source_type='url', source_url='https://files.pythonhosted.org/demo-0.1.0.tar.gz') url_reference = {'archive_info': {'hashes': {'sha256': '9fa123ad707a5c6c944743bf3e11a0e80d86cb518d3cf25320866ca3ef43e2ad'}}, 'url': 'https://files.pythonhosted.org/demo-0.1.0.tar.gz'} def verify_installed_distribution( venv: VirtualEnv, package: Package, url_reference: dict[str, Any] | None = None ): distributions = list(venv.site_packages.distributions(name=package.name)) > assert len(distributions) == 1 E assert 0 == 1 E + where 0 = len([]) tests/installation/test_executor.py:563: AssertionError ------------------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------------- DEBUG poetry.utils.authenticator:authenticator.py:182 Creating new session for files.pythonhosted.org DEBUG urllib3.connectionpool:connectionpool.py:1003 Starting new HTTPS connection (1): files.pythonhosted.org:443 DEBUG urllib3.connectionpool:connectionpool.py:456 https://files.pythonhosted.org:443 "GET /demo-0.1.0.tar.gz HTTP/1.1" 200 1003 ________________________________________________ test_executor_should_write_pep610_url_references_for_non_wheel_urls[False-True-False-True] _________________________________________________ tmp_venv = VirtualEnv("/tmp/poetry_z1xeks8h/venv"), pool = config = , io = , mock_file_downloads = None mocker = , fixture_dir = ._fixture_dir at 0x7f9db57748b0>, is_sdist_cached = False is_wheel_cached = True, expect_artifact_building = False, expect_artifact_download = True @pytest.mark.parametrize( ( "is_sdist_cached", "is_wheel_cached", "expect_artifact_building", "expect_artifact_download", ), [ (True, False, True, False), (True, True, False, False), (False, False, True, True), (False, True, False, True), ], ) def test_executor_should_write_pep610_url_references_for_non_wheel_urls( tmp_venv: VirtualEnv, pool: RepositoryPool, config: Config, io: BufferedIO, mock_file_downloads: None, mocker: MockerFixture, fixture_dir: FixtureDirGetter, is_sdist_cached: bool, is_wheel_cached: bool, expect_artifact_building: bool, expect_artifact_download: bool, ): built_wheel = fixture_dir("distributions") / "demo-0.1.0-py2.py3-none-any.whl" mock_prepare = mocker.patch( "poetry.installation.chef.Chef._prepare", return_value=built_wheel, ) download_spy = mocker.spy(Executor, "_download_archive") if is_sdist_cached | is_wheel_cached: cached_sdist = fixture_dir("distributions") / "demo-0.1.0.tar.gz" cached_wheel = fixture_dir("distributions") / "demo-0.1.0-py2.py3-none-any.whl" def mock_get_cached_archive_for_link_func(_: Link, strict: bool): if is_wheel_cached and not strict: return cached_wheel if is_sdist_cached: return cached_sdist return None mocker.patch( "poetry.installation.chef.Chef.get_cached_archive_for_link", side_effect=mock_get_cached_archive_for_link_func, ) package = Package( "demo", "0.1.0", source_type="url", source_url="https://files.pythonhosted.org/demo-0.1.0.tar.gz", ) # Set package.files so the executor will attempt to hash the package package.files = [ { "file": "demo-0.1.0.tar.gz", "hash": "sha256:9fa123ad707a5c6c944743bf3e11a0e80d86cb518d3cf25320866ca3ef43e2ad", # noqa: E501 } ] executor = Executor(tmp_venv, pool, config, io) operation = Install(package) executor.execute([operation]) expected_url_reference = { "archive_info": { "hashes": { "sha256": ( "9fa123ad707a5c6c944743bf3e11a0e80d86cb518d3cf25320866ca3ef43e2ad" ) }, }, "url": package.source_url, } > verify_installed_distribution(tmp_venv, package, expected_url_reference) tests/installation/test_executor.py:882: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ venv = VirtualEnv("/tmp/poetry_z1xeks8h/venv"), package = Package('demo', '0.1.0', source_type='url', source_url='https://files.pythonhosted.org/demo-0.1.0.tar.gz') url_reference = {'archive_info': {'hashes': {'sha256': '9fa123ad707a5c6c944743bf3e11a0e80d86cb518d3cf25320866ca3ef43e2ad'}}, 'url': 'https://files.pythonhosted.org/demo-0.1.0.tar.gz'} def verify_installed_distribution( venv: VirtualEnv, package: Package, url_reference: dict[str, Any] | None = None ): distributions = list(venv.site_packages.distributions(name=package.name)) > assert len(distributions) == 1 E assert 0 == 1 E + where 0 = len([]) tests/installation/test_executor.py:563: AssertionError ------------------------------------------------------------------------------------- Captured log call ------------------------------------------------------------------------------------- DEBUG poetry.utils.authenticator:authenticator.py:182 Creating new session for files.pythonhosted.org DEBUG urllib3.connectionpool:connectionpool.py:1003 Starting new HTTPS connection (1): files.pythonhosted.org:443 DEBUG urllib3.connectionpool:connectionpool.py:456 https://files.pythonhosted.org:443 "GET /demo-0.1.0.tar.gz HTTP/1.1" 200 1003 _________________________________________________________________ test_executor_should_write_pep610_url_references_for_git __________________________________________________________________ tmp_venv = VirtualEnv("/tmp/poetry_xn8qetuf/venv"), pool = config = , io = , mock_file_downloads = None wheel = PosixPath('/tmp/tmpnqi6gtac/demo-0.1.2-py2.py3-none-any.whl') def test_executor_should_write_pep610_url_references_for_git( tmp_venv: VirtualEnv, pool: RepositoryPool, config: Config, io: BufferedIO, mock_file_downloads: None, wheel: Path, ): package = Package( "demo", "0.1.2", source_type="git", source_reference="master", source_resolved_reference="123456", source_url="https://github.com/demo/demo.git", ) chef = Chef(config, tmp_venv, Factory.create_pool(config)) chef.set_directory_wheel(wheel) executor = Executor(tmp_venv, pool, config, io) executor._chef = chef executor.execute([Install(package)]) > verify_installed_distribution( tmp_venv, package, { "vcs_info": { "vcs": "git", "requested_revision": "master", "commit_id": "123456", }, "url": package.source_url, }, ) tests/installation/test_executor.py:920: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ venv = VirtualEnv("/tmp/poetry_xn8qetuf/venv") package = Package('demo', '0.1.2', source_type='git', source_url='https://github.com/demo/demo.git', source_reference='master', source_resolved_reference='123456') url_reference = {'url': 'https://github.com/demo/demo.git', 'vcs_info': {'commit_id': '123456', 'requested_revision': 'master', 'vcs': 'git'}} def verify_installed_distribution( venv: VirtualEnv, package: Package, url_reference: dict[str, Any] | None = None ): distributions = list(venv.site_packages.distributions(name=package.name)) > assert len(distributions) == 1 E assert 0 == 1 E + where 0 = len([]) tests/installation/test_executor.py:563: AssertionError _______________________________________________________ test_executor_should_write_pep610_url_references_for_git_with_subdirectories ________________________________________________________ tmp_venv = VirtualEnv("/tmp/poetry_u_j06c3o/venv"), pool = config = , io = , mock_file_downloads = None wheel = PosixPath('/tmp/tmpqvrq7_cf/demo-0.1.2-py2.py3-none-any.whl') def test_executor_should_write_pep610_url_references_for_git_with_subdirectories( tmp_venv: VirtualEnv, pool: RepositoryPool, config: Config, io: BufferedIO, mock_file_downloads: None, wheel: Path, ): package = Package( "demo", "0.1.2", source_type="git", source_reference="master", source_resolved_reference="123456", source_url="https://github.com/demo/subdirectories.git", source_subdirectory="two", ) chef = Chef(config, tmp_venv, Factory.create_pool(config)) chef.set_directory_wheel(wheel) executor = Executor(tmp_venv, pool, config, io) executor._chef = chef executor.execute([Install(package)]) > verify_installed_distribution( tmp_venv, package, { "vcs_info": { "vcs": "git", "requested_revision": "master", "commit_id": "123456", }, "url": package.source_url, "subdirectory": package.source_subdirectory, }, ) tests/installation/test_executor.py:989: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ venv = VirtualEnv("/tmp/poetry_u_j06c3o/venv") package = Package('demo', '0.1.2', source_type='git', source_url='https://github.com/demo/subdirectories.git', source_reference='master', source_resolved_reference='123456', source_subdirectory='two') url_reference = {'subdirectory': 'two', 'url': 'https://github.com/demo/subdirectories.git', 'vcs_info': {'commit_id': '123456', 'requested_revision': 'master', 'vcs': 'git'}} def verify_installed_distribution( venv: VirtualEnv, package: Package, url_reference: dict[str, Any] | None = None ): distributions = list(venv.site_packages.distributions(name=package.name)) > assert len(distributions) == 1 E assert 0 == 1 E + where 0 = len([]) tests/installation/test_executor.py:563: AssertionError ___________________________________________________ test_build_backend_errors_are_reported_correctly_if_caused_by_subprocess[False-build] ___________________________________________________ failing_method = 'build', editable = False, mocker = , config = pool = , io = , tmp_dir = '/tmp/poetry_3frovw9g' mock_file_downloads = None, env = MockEnv("/tmp/poetry_3frovw9g/.venv") @pytest.mark.parametrize("failing_method", ["build", "get_requires_for_build"]) @pytest.mark.parametrize("editable", [False, True]) def test_build_backend_errors_are_reported_correctly_if_caused_by_subprocess( failing_method: str, editable: bool, mocker: MockerFixture, config: Config, pool: RepositoryPool, io: BufferedIO, tmp_dir: str, mock_file_downloads: None, env: MockEnv, ) -> None: error = BuildBackendException( CalledProcessError(1, ["pip"], output=b"Error on stdout") ) mocker.patch.object(ProjectBuilder, failing_method, side_effect=error) io.set_verbosity(Verbosity.NORMAL) executor = Executor(env, pool, config, io) package_name = "simple-project" package_version = "1.2.3" directory_package = Package( package_name, package_version, source_type="directory", source_url=Path(__file__) .parent.parent.joinpath("fixtures/simple_project") .resolve() .as_posix(), develop=editable, ) # must not be included in the error message directory_package.python_versions = ">=3.7" return_code = executor.execute( [ Install(directory_package), ] ) assert return_code == 1 package_url = directory_package.source_url expected_start = f""" Package operations: 1 install, 0 updates, 0 removals • Installing {package_name} ({package_version} {package_url}) ChefBuildError Backend operation failed: CalledProcessError(1, ['pip']) \ Error on stdout """ if editable: pip_command = "pip wheel --use-pep517 --editable" requirement = directory_package.source_url assert Path(requirement).exists() else: pip_command = "pip wheel --use-pep517" requirement = f"{package_name} @ {path_to_url(directory_package.source_url)}" expected_end = f""" Note: This error originates from the build backend, and is likely not a problem with \ poetry but with {package_name} ({package_version} {package_url}) not supporting \ PEP 517 builds. You can verify this by running '{pip_command} "{requirement}"'. """ output = io.fetch_output() > assert output.startswith(expected_start) E assert False E + where False = ("\nPackage operations: 1 install, 0 updates, 0 removals\n\n • Installing simple-project (1.2.3 /home/tkloczko/rpmbuil...le_project)\n\n ChefBuildError\n\n Backend operation failed: CalledProcessError(1, ['pip'])\n \n Error on stdout\n") E + where = '\nPackage operations: 1 install, 0 updates, 0 removals\n\n • Installing simple-project (1.2.3 /home/tkloczko/rpmbuil...--use-pep517 "simple-project @ file:///home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/simple_project"\'.\n\n'.startswith tests/installation/test_executor.py:1169: AssertionError ___________________________________________________ test_build_backend_errors_are_reported_correctly_if_caused_by_subprocess[True-build] ____________________________________________________ failing_method = 'build', editable = True, mocker = , config = pool = , io = , tmp_dir = '/tmp/poetry_xv9tt_vg' mock_file_downloads = None, env = MockEnv("/tmp/poetry_xv9tt_vg/.venv") @pytest.mark.parametrize("failing_method", ["build", "get_requires_for_build"]) @pytest.mark.parametrize("editable", [False, True]) def test_build_backend_errors_are_reported_correctly_if_caused_by_subprocess( failing_method: str, editable: bool, mocker: MockerFixture, config: Config, pool: RepositoryPool, io: BufferedIO, tmp_dir: str, mock_file_downloads: None, env: MockEnv, ) -> None: error = BuildBackendException( CalledProcessError(1, ["pip"], output=b"Error on stdout") ) mocker.patch.object(ProjectBuilder, failing_method, side_effect=error) io.set_verbosity(Verbosity.NORMAL) executor = Executor(env, pool, config, io) package_name = "simple-project" package_version = "1.2.3" directory_package = Package( package_name, package_version, source_type="directory", source_url=Path(__file__) .parent.parent.joinpath("fixtures/simple_project") .resolve() .as_posix(), develop=editable, ) # must not be included in the error message directory_package.python_versions = ">=3.7" return_code = executor.execute( [ Install(directory_package), ] ) assert return_code == 1 package_url = directory_package.source_url expected_start = f""" Package operations: 1 install, 0 updates, 0 removals • Installing {package_name} ({package_version} {package_url}) ChefBuildError Backend operation failed: CalledProcessError(1, ['pip']) \ Error on stdout """ if editable: pip_command = "pip wheel --use-pep517 --editable" requirement = directory_package.source_url assert Path(requirement).exists() else: pip_command = "pip wheel --use-pep517" requirement = f"{package_name} @ {path_to_url(directory_package.source_url)}" expected_end = f""" Note: This error originates from the build backend, and is likely not a problem with \ poetry but with {package_name} ({package_version} {package_url}) not supporting \ PEP 517 builds. You can verify this by running '{pip_command} "{requirement}"'. """ output = io.fetch_output() > assert output.startswith(expected_start) E assert False E + where False = ("\nPackage operations: 1 install, 0 updates, 0 removals\n\n • Installing simple-project (1.2.3 /home/tkloczko/rpmbuil...le_project)\n\n ChefBuildError\n\n Backend operation failed: CalledProcessError(1, ['pip'])\n \n Error on stdout\n") E + where = '\nPackage operations: 1 install, 0 updates, 0 removals\n\n • Installing simple-project (1.2.3 /home/tkloczko/rpmbuil... \'pip wheel --use-pep517 --editable "/home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/simple_project"\'.\n\n'.startswith tests/installation/test_executor.py:1169: AssertionError __________________________________________________________________________ test_enable_bytecode_compilation[True] ___________________________________________________________________________ env = MockEnv("/tmp/pytest-of-tkloczko/pytest-28/test_enable_bytecode_compilati0") demo_wheel = PosixPath('/home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/distributions/demo-0.1.0-py2.py3-none-any.whl'), compile = True @pytest.mark.parametrize("compile", [True, False]) def test_enable_bytecode_compilation( env: MockEnv, demo_wheel: Path, compile: bool ) -> None: installer = WheelInstaller(env) installer.enable_bytecode_compilation(compile) > installer.install(demo_wheel) tests/installation/test_wheel_installer.py:75: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = wheel = PosixPath('/home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/distributions/demo-0.1.0-py2.py3-none-any.whl') def install(self, wheel: Path) -> None: with WheelFile.open(wheel) as source: > source.validate_record() E AttributeError: 'WheelFile' object has no attribute 'validate_record' ../../BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/installation/wheel_installer.py:101: AttributeError __________________________________________________________________________ test_enable_bytecode_compilation[False] __________________________________________________________________________ env = MockEnv("/tmp/pytest-of-tkloczko/pytest-28/test_enable_bytecode_compilati1") demo_wheel = PosixPath('/home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/distributions/demo-0.1.0-py2.py3-none-any.whl'), compile = False @pytest.mark.parametrize("compile", [True, False]) def test_enable_bytecode_compilation( env: MockEnv, demo_wheel: Path, compile: bool ) -> None: installer = WheelInstaller(env) installer.enable_bytecode_compilation(compile) > installer.install(demo_wheel) tests/installation/test_wheel_installer.py:75: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = wheel = PosixPath('/home/tkloczko/rpmbuild/BUILD/poetry-1.4.1/tests/fixtures/distributions/demo-0.1.0-py2.py3-none-any.whl') def install(self, wheel: Path) -> None: with WheelFile.open(wheel) as source: > source.validate_record() E AttributeError: 'WheelFile' object has no attribute 'validate_record' ../../BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/installation/wheel_installer.py:101: AttributeError ===================================================================================== warnings summary ====================================================================================== tests/repositories/test_installed_repository.py::test_load_successful_with_invalid_distribution /home/tkloczko/rpmbuild/BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/repositories/installed_repository.py:261: DeprecationWarning: Implicit None on return values is deprecated and will raise KeyErrors. name = canonicalize_name(distribution.metadata["name"]) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ================================================================================== short test summary info ================================================================================== SKIPPED [1] tests/console/commands/test_run.py:87: Poetry only installs CMD script files for console scripts of editable dependencies on Windows SKIPPED [1] tests/installation/test_installer.py:1875: This is not working at the moment due to limitations in the resolver SKIPPED [1] tests/installation/test_installer_old.py:1536: This is not working at the moment due to limitations in the resolver SKIPPED [1] tests/puzzle/test_solver.py:3211: Poetry no longer has critical package requirements SKIPPED [1] tests/utils/test_env.py:100: requires darwin ERROR tests/installation/test_wheel_installer.py::test_default_installation_source_dir_content - AttributeError: 'WheelFile' object has no attribute 'validate_record' ERROR tests/installation/test_wheel_installer.py::test_default_installation_dist_info_dir_content - AttributeError: 'WheelFile' object has no attribute 'validate_record' ERROR tests/installation/test_wheel_installer.py::test_installer_file_contains_valid_version - AttributeError: 'WheelFile' object has no attribute 'validate_record' ERROR tests/installation/test_wheel_installer.py::test_default_installation_no_bytecode - AttributeError: 'WheelFile' object has no attribute 'validate_record' FAILED tests/installation/test_chef.py::test_prepare_sdist - poetry.installation.chef.ChefBuildError: Backend 'poetry.core.masonry.api' is not available. FAILED tests/installation/test_chef.py::test_prepare_directory - poetry.installation.chef.ChefBuildError: Backend 'poetry.core.masonry.api' is not available. FAILED tests/installation/test_chef.py::test_prepare_directory_with_extensions - poetry.installation.chef.ChefBuildError: Backend 'poetry.core.masonry.api' is not available. FAILED tests/installation/test_chef.py::test_prepare_directory_editable - poetry.installation.chef.ChefBuildError: Backend 'poetry.core.masonry.api' is not available. FAILED tests/installation/test_executor.py::test_execute_prints_warning_for_yanked_package[operations0-True] - AssertionError: FAILED tests/installation/test_executor.py::test_execute_prints_warning_for_yanked_package[operations2-True] - AssertionError: FAILED tests/installation/test_executor.py::test_execute_works_with_ansi_output - AssertionError: assert '\x1b[32;1m•\x1b[39;22m \x1b[39mInstalling \x1b[39m\x1b[36mcleo\x1b[39m\x1b[39m (\x1b[39m\x1b[32m1.0.0a5\x1b[39m\x1b[39m)\x1b[39m' in '\n\x1b[39;1mPackage operat... FAILED tests/installation/test_executor.py::test_execute_works_with_no_ansi_output - AssertionError: assert {'', ' ...nstall(', ...} == {'', ' • Ins..., 0 removals'} FAILED tests/installation/test_executor.py::test_executor_should_not_write_pep610_url_references_for_cached_package[package0] - assert 0 == 1 FAILED tests/installation/test_executor.py::test_executor_should_not_write_pep610_url_references_for_cached_package[package1] - assert 0 == 1 FAILED tests/installation/test_executor.py::test_executor_should_write_pep610_url_references_for_wheel_files - assert 0 == 1 FAILED tests/installation/test_executor.py::test_executor_should_write_pep610_url_references_for_non_wheel_files - assert 0 == 1 FAILED tests/installation/test_executor.py::test_executor_should_write_pep610_url_references_for_directories - assert 0 == 1 FAILED tests/installation/test_executor.py::test_executor_should_write_pep610_url_references_for_editable_directories - assert 0 == 1 FAILED tests/installation/test_executor.py::test_executor_should_write_pep610_url_references_for_wheel_urls[False] - assert 0 == 1 FAILED tests/installation/test_executor.py::test_executor_should_write_pep610_url_references_for_wheel_urls[True] - assert 0 == 1 FAILED tests/installation/test_executor.py::test_executor_should_write_pep610_url_references_for_non_wheel_urls[True-False-True-False] - assert 0 == 1 FAILED tests/installation/test_executor.py::test_executor_should_write_pep610_url_references_for_non_wheel_urls[True-True-False-False] - assert 0 == 1 FAILED tests/installation/test_executor.py::test_executor_should_write_pep610_url_references_for_non_wheel_urls[False-False-True-True] - assert 0 == 1 FAILED tests/installation/test_executor.py::test_executor_should_write_pep610_url_references_for_non_wheel_urls[False-True-False-True] - assert 0 == 1 FAILED tests/installation/test_executor.py::test_executor_should_write_pep610_url_references_for_git - assert 0 == 1 FAILED tests/installation/test_executor.py::test_executor_should_write_pep610_url_references_for_git_with_subdirectories - assert 0 == 1 FAILED tests/installation/test_executor.py::test_build_backend_errors_are_reported_correctly_if_caused_by_subprocess[False-build] - assert False FAILED tests/installation/test_executor.py::test_build_backend_errors_are_reported_correctly_if_caused_by_subprocess[True-build] - assert False FAILED tests/installation/test_wheel_installer.py::test_enable_bytecode_compilation[True] - AttributeError: 'WheelFile' object has no attribute 'validate_record' FAILED tests/installation/test_wheel_installer.py::test_enable_bytecode_compilation[False] - AttributeError: 'WheelFile' object has no attribute 'validate_record' ================================================ 26 failed, 1229 passed, 5 skipped, 58 deselected, 1 warning, 4 errors in 132.08s (0:02:12) ================================================= ```

Could you please have a look on above and asses maybe I have sometbing missing in build env of that module? 🤔 Here is list of installed modules in build env

```console Package Version ------------------- -------------- attrs 22.2.0 black 23.1.0 build 0.10.0 CacheControl 0.12.11 cachy 0.3.0 cffi 1.15.1 charset-normalizer 3.1.0 cleo 2.0.1 click 8.1.3 crashtest 0.4.1 cryptography 39.0.2 deepdiff 6.3.0 distlib 0.3.6 distro 1.8.0 dulwich 0.21.3 exceptiongroup 1.0.0 filelock 3.9.0 flatdict 4.0.1 gpg 1.18.0-unknown html5lib 1.1 httpretty 1.1.4 idna 3.4 importlib-metadata 6.1.0 importlib-resources 5.12.0 iniconfig 2.0.0 installer 0.6.0 jaraco.classes 3.2.3 jeepney 0.8.0 keyring 23.13.1 libcomps 0.1.19 lockfile 0.12.2 more-itertools 9.1.0 msgpack 1.0.5 mypy-extensions 1.0.0 ordered-set 4.1.0 packaging 23.0 pathspec 0.11.0 pexpect 4.8.0 pip 23.0.1 pkginfo 1.9.6 platformdirs 3.1.1 pluggy 1.0.0 ply 3.11 poetry-core 1.5.2 ptyprocess 0.7.0 pycparser 2.21 pyproject_hooks 1.0.0 pytest 7.2.2 pytest-mock 3.10.0 python-dateutil 2.8.2 rapidfuzz 2.13.7 requests 2.28.2 requests-toolbelt 0.10.1 rpm 4.17.0 SecretStorage 3.3.3 shellingham 1.5.0.post1 six 1.16.0 tomli 2.0.1 trove-classifiers 2023.1.28 typing_extensions 4.5.0 urllib3 1.26.15 virtualenv 20.21.0 webencodings 0.5.1 wheel 0.38.4 zipp 3.15.0 ```
dimbleby commented 1 year ago

you need installer 0.7.0

since that's the dependency that poetry declares - https://github.com/python-poetry/poetry/blob/fc1014b592290796f6d6a7d43a39b41aa77b0704/pyproject.toml#L61 - there's something wrong with your process if you're not getting it

kloczek commented 1 year ago

OK after upgrade `installer' and add gcc and python devel resources to package build env I was able to pass test suite with deselected all units which have hardcoded python executable name. Thank you 👍

Pytest shows one deprecaion warning.

```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -m 'not network' --deselect tests/console/commands/env/test_info.py::test_env_info_displays_complete_info --deselect tests/console/commands/env/test_list.py::test_activated --deselect tests/console/commands/env/test_list.py::test_in_project_venv --deselect tests/console/commands/env/test_list.py::test_in_project_venv_no_explicit_config --deselect tests/console/commands/env/test_list.py::test_none_activated --deselect tests/console/commands/env/test_remove.py::test_remove_all --deselect tests/console/commands/env/test_remove.py::test_remove_all_and_version --deselect tests/console/commands/env/test_remove.py::test_remove_by_name --deselect tests/console/commands/env/test_remove.py::test_remove_multiple --deselect tests/console/commands/env/test_use.py::test_activate_activates_non_existing_virtualenv_no_envs_file --deselect tests/console/commands/env/test_use.py::test_get_prefers_explicitly_activated_non_existing_virtualenvs_over_env_var --deselect tests/console/commands/env/test_use.py::test_get_prefers_explicitly_activated_virtualenvs_over_env_var --deselect 'tests/console/commands/test_init.py::test_respect_prefer_active_on_init[True-1.1]' --deselect 'tests/console/commands/test_new.py::test_respect_prefer_active_on_new[True-1.1]' --deselect tests/utils/test_env.py::test_activate_activates_different_virtualenv_with_envs_file --deselect tests/utils/test_env.py::test_activate_activates_existing_virtualenv_no_envs_file --deselect tests/utils/test_env.py::test_activate_activates_non_existing_virtualenv_no_envs_file --deselect tests/utils/test_env.py::test_activate_activates_recreates_for_different_patch --deselect tests/utils/test_env.py::test_activate_activates_same_virtualenv_with_envs_file --deselect tests/utils/test_env.py::test_activate_does_not_recreate_when_switching_minor --deselect tests/utils/test_env.py::test_activate_with_in_project_setting_does_not_fail_if_no_venvs_dir --deselect tests/utils/test_env.py::test_create_venv_accepts_fallback_version_w_nonzero_patchlevel --deselect tests/utils/test_env.py::test_create_venv_project_name_empty_sets_correct_prompt --deselect tests/utils/test_env.py::test_create_venv_tries_to_find_a_compatible_python_executable_using_generic_ones_first --deselect tests/utils/test_env.py::test_create_venv_tries_to_find_a_compatible_python_executable_using_specific_ones --deselect tests/utils/test_env.py::test_create_venv_uses_patch_version_to_detect_compatibility --deselect tests/utils/test_env.py::test_create_venv_uses_patch_version_to_detect_compatibility_with_executable --deselect tests/utils/test_env.py::test_deactivate_activated --deselect tests/utils/test_env.py::test_deactivate_non_activated_but_existing --deselect 'tests/utils/test_env.py::test_env_get_venv_with_venv_folder_present[None]' --deselect 'tests/utils/test_env.py::test_env_get_venv_with_venv_folder_present[True]' --deselect tests/utils/test_env.py::test_get_prefers_explicitly_activated_virtualenvs_over_env_var --deselect tests/utils/test_env.py::test_list --deselect tests/utils/test_env.py::test_remove_by_name --deselect tests/utils/test_env.py::test_remove_keeps_dir_if_not_deleteable ============================= test session starts ============================== platform linux -- Python 3.8.16, pytest-7.2.2, pluggy-1.0.0 rootdir: /home/tkloczko/rpmbuild/BUILD/poetry-1.4.1, configfile: pyproject.toml, testpaths: tests plugins: mock-3.10.0 collected 1322 items / 58 deselected / 1264 selected tests/test_factory.py ................. [ 1%] tests/test_helpers.py . [ 1%] tests/config/test_config.py ....................... [ 3%] tests/console/test_application.py ........ [ 3%] tests/console/commands/test_about.py . [ 3%] tests/console/commands/test_add.py ..................................... [ 6%] ....................................... [ 9%] tests/console/commands/test_build.py . [ 10%] tests/console/commands/test_check.py ... [ 10%] tests/console/commands/test_config.py ..................... [ 11%] tests/console/commands/test_init.py .................................... [ 14%] ............ [ 15%] tests/console/commands/test_install.py ................................. [ 18%] ................. [ 19%] tests/console/commands/test_lock.py ................ [ 20%] tests/console/commands/test_new.py .................... [ 22%] tests/console/commands/test_publish.py ........ [ 23%] tests/console/commands/test_remove.py ...... [ 23%] tests/console/commands/test_run.py ...s... [ 24%] tests/console/commands/test_search.py . [ 24%] tests/console/commands/test_shell.py .............. [ 25%] tests/console/commands/test_show.py .................................... [ 28%] ...... [ 28%] tests/console/commands/test_update.py .. [ 28%] tests/console/commands/test_version.py .......................... [ 30%] tests/console/commands/cache/test_clear.py ..... [ 31%] tests/console/commands/cache/test_list.py .. [ 31%] tests/console/commands/debug/test_resolve.py ... [ 31%] tests/console/commands/env/test_info.py . [ 31%] tests/console/commands/env/test_remove.py . [ 31%] tests/console/commands/self/test_add_plugins.py ......... [ 32%] tests/console/commands/self/test_remove_plugins.py .. [ 32%] tests/console/commands/self/test_show_plugins.py .... [ 33%] tests/console/commands/self/test_update.py . [ 33%] tests/console/commands/source/test_add.py ...... [ 33%] tests/console/commands/source/test_remove.py .. [ 33%] tests/console/commands/source/test_show.py .... [ 34%] tests/inspection/test_info.py ................... [ 35%] tests/installation/test_chef.py ............ [ 36%] tests/installation/test_chooser.py ......................... [ 38%] tests/installation/test_executor.py .................................... [ 41%] .. [ 41%] tests/installation/test_installer.py ................................... [ 44%] ...................s................... [ 47%] tests/installation/test_installer_old.py ............................... [ 49%] ..........s........ [ 51%] tests/installation/test_pip_installer.py ........... [ 52%] tests/installation/test_wheel_installer.py ...... [ 52%] tests/json/test_schema_sources.py .. [ 52%] tests/masonry/builders/test_editable_builder.py ...... [ 53%] tests/mixology/solutions/providers/test_python_requirement_solution_provider.py . [ 53%] . [ 53%] tests/mixology/solutions/solutions/test_python_requirement_solution.py . [ 53%] [ 53%] tests/mixology/version_solver/test_backtracking.py ........ [ 54%] tests/mixology/version_solver/test_basic_graph.py .............. [ 55%] tests/mixology/version_solver/test_dependency_cache.py .. [ 55%] tests/mixology/version_solver/test_python_constraint.py . [ 55%] tests/mixology/version_solver/test_unsolvable.py ....... [ 56%] tests/mixology/version_solver/test_with_lock.py ........ [ 56%] tests/packages/test_locker.py .......................... [ 58%] tests/plugins/test_plugin_manager.py ... [ 59%] tests/publishing/test_publisher.py ........ [ 59%] tests/publishing/test_uploader.py ................... [ 61%] tests/puzzle/test_provider.py ...................................... [ 64%] tests/puzzle/test_solver.py ............................................ [ 67%] ........................................................s............... [ 73%] ........ [ 73%] tests/puzzle/test_transaction.py ..... [ 74%] tests/repositories/test_installed_repository.py ................. [ 75%] tests/repositories/test_legacy_repository.py ........................... [ 77%] ................ [ 79%] tests/repositories/test_lockfile_repository.py .. [ 79%] tests/repositories/test_pypi_repository.py ........................... [ 81%] tests/repositories/test_repository.py ......... [ 82%] tests/repositories/test_repository_pool.py ................... [ 83%] tests/repositories/test_single_page_repository.py .. [ 83%] tests/repositories/link_sources/test_base.py ............ [ 84%] tests/repositories/link_sources/test_html.py ................ [ 85%] tests/utils/test_authenticator.py ..................................... [ 88%] tests/utils/test_cache.py ............ [ 89%] tests/utils/test_dependency_specification.py ...................... [ 91%] tests/utils/test_env.py .s.............................................. [ 95%] . [ 95%] tests/utils/test_env_site.py .. [ 95%] tests/utils/test_extras.py ....... [ 96%] tests/utils/test_helpers.py ............. [ 97%] tests/utils/test_password_manager.py .................... [ 98%] tests/utils/test_patterns.py .. [ 98%] tests/utils/test_pip.py .. [ 99%] tests/utils/test_setup_reader.py ......... [ 99%] tests/utils/test_source.py .. [100%] =============================== warnings summary =============================== tests/repositories/test_installed_repository.py::test_load_successful_with_invalid_distribution /home/tkloczko/rpmbuild/BUILDROOT/python-poetry-1.4.1-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/repositories/installed_repository.py:261: DeprecationWarning: Implicit None on return values is deprecated and will raise KeyErrors. name = canonicalize_name(distribution.metadata["name"]) -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html =========================== short test summary info ============================ SKIPPED [1] tests/console/commands/test_run.py:87: Poetry only installs CMD script files for console scripts of editable dependencies on Windows SKIPPED [1] tests/installation/test_installer.py:1875: This is not working at the moment due to limitations in the resolver SKIPPED [1] tests/installation/test_installer_old.py:1536: This is not working at the moment due to limitations in the resolver SKIPPED [1] tests/puzzle/test_solver.py:3211: Poetry no longer has critical package requirements SKIPPED [1] tests/utils/test_env.py:100: requires darwin ==== 1259 passed, 5 skipped, 58 deselected, 1 warning in 136.81s (0:02:16) ===== ```
kloczek commented 7 months ago

Just FTR poetry 1.8.0

Here is pytest output: ```console + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages + /usr/bin/pytest -ra -m 'not network' ============================= test session starts ============================== platform linux -- Python 3.8.18, pytest-8.0.1, pluggy-1.3.0 rootdir: /home/tkloczko/rpmbuild/BUILD/poetry-1.8.0 configfile: pyproject.toml testpaths: tests plugins: mock-3.12.0 collected 1630 items / 35 deselected / 1595 selected tests/config/test_config.py ................................. [ 2%] tests/console/commands/cache/test_clear.py ..... [ 2%] tests/console/commands/cache/test_list.py .. [ 2%] tests/console/commands/debug/test_resolve.py ... [ 2%] tests/console/commands/env/test_info.py F.. [ 2%] tests/console/commands/env/test_list.py FFFF. [ 3%] tests/console/commands/env/test_remove.py .FFFFFFFF [ 3%] tests/console/commands/env/test_use.py ... [ 3%] tests/console/commands/self/test_add_plugins.py ......... [ 4%] tests/console/commands/self/test_remove_plugins.py .. [ 4%] tests/console/commands/self/test_self_command.py ... [ 4%] tests/console/commands/self/test_show_plugins.py .... [ 5%] tests/console/commands/self/test_update.py . [ 5%] tests/console/commands/source/test_add.py ...................... [ 6%] tests/console/commands/source/test_remove.py ......... [ 7%] tests/console/commands/source/test_show.py .............. [ 7%] tests/console/commands/test_about.py . [ 8%] tests/console/commands/test_add.py ..................................... [ 10%] .................. [ 11%] tests/console/commands/test_build.py ........... [ 12%] tests/console/commands/test_check.py .......... [ 12%] tests/console/commands/test_config.py .................................. [ 14%] ......... [ 15%] tests/console/commands/test_export.py EE [ 15%] tests/console/commands/test_init.py .................................... [ 17%] .............F.. [ 18%] tests/console/commands/test_install.py ................................. [ 20%] ........................................ [ 23%] tests/console/commands/test_lock.py ................ [ 24%] tests/console/commands/test_new.py ...................F. [ 25%] tests/console/commands/test_publish.py ................ [ 26%] tests/console/commands/test_remove.py ........ [ 27%] tests/console/commands/test_run.py ...s... [ 27%] tests/console/commands/test_search.py . [ 27%] tests/console/commands/test_shell.py .............. [ 28%] tests/console/commands/test_show.py .................................... [ 30%] ........... [ 31%] tests/console/commands/test_update.py ...... [ 31%] tests/console/commands/test_version.py ................................. [ 34%] ... [ 34%] tests/console/logging/test_io_formatter.py .......... [ 34%] tests/console/test_application.py F....... [ 35%] tests/inspection/test_info.py ................. [ 36%] tests/inspection/test_lazy_wheel.py ............ [ 37%] tests/installation/test_chef.py ....... [ 37%] tests/installation/test_chooser.py .......................... [ 39%] tests/installation/test_executor.py ....s............................... [ 41%] ................... [ 42%] tests/installation/test_installer.py ................................... [ 44%] ......................s........................ [ 47%] tests/installation/test_wheel_installer.py ...... [ 48%] tests/json/test_schema_sources.py .... [ 48%] tests/masonry/builders/test_editable_builder.py ....... [ 48%] tests/mixology/solutions/providers/test_python_requirement_solution_provider.py . [ 48%] . [ 49%] tests/mixology/solutions/solutions/test_python_requirement_solution.py . [ 49%] [ 49%] tests/mixology/test_incompatibility.py .... [ 49%] tests/mixology/version_solver/test_backtracking.py ......... [ 49%] tests/mixology/version_solver/test_basic_graph.py .............. [ 50%] tests/mixology/version_solver/test_dependency_cache.py ... [ 50%] tests/mixology/version_solver/test_python_constraint.py . [ 51%] tests/mixology/version_solver/test_unsolvable.py ....... [ 51%] tests/mixology/version_solver/test_with_lock.py ........ [ 51%] tests/packages/test_direct_origin.py ... [ 52%] tests/packages/test_locker.py ........................... [ 53%] tests/plugins/test_plugin_manager.py ... [ 54%] tests/publishing/test_publisher.py ........ [ 54%] tests/publishing/test_uploader.py ................... [ 55%] tests/puzzle/test_provider.py .......................................... [ 58%] ..... [ 58%] tests/puzzle/test_solver.py ............................................ [ 61%] ....................................................................s... [ 65%] ......................... [ 67%] tests/puzzle/test_transaction.py ..... [ 67%] tests/pyproject/test_pyproject_toml.py .. [ 67%] tests/pyproject/test_pyproject_toml_file.py .. [ 68%] tests/repositories/link_sources/test_base.py ............ [ 68%] tests/repositories/link_sources/test_html.py ........................... [ 70%] ...... [ 70%] tests/repositories/link_sources/test_json.py .................. [ 72%] tests/repositories/parsers/test_html_page_parser.py .. [ 72%] tests/repositories/parsers/test_pypi_search_parser.py . [ 72%] tests/repositories/test_http_repository.py ....... [ 72%] tests/repositories/test_installed_repository.py .................. [ 73%] tests/repositories/test_legacy_repository.py ........................... [ 75%] ................... [ 76%] tests/repositories/test_lockfile_repository.py .. [ 76%] tests/repositories/test_pypi_repository.py ............................ [ 78%] tests/repositories/test_repository.py ......... [ 79%] tests/repositories/test_repository_pool.py ............................. [ 80%] [ 80%] tests/repositories/test_single_page_repository.py .. [ 81%] tests/test_factory.py .................................... [ 83%] tests/test_helpers.py . [ 83%] tests/utils/env/test_env.py ......................................Fs. [ 85%] tests/utils/env/test_env_manager.py ................F.F.F............... [ 88%] .....s.. [ 88%] tests/utils/env/test_env_site_packages.py .. [ 88%] tests/utils/test_authenticator.py ...................................... [ 91%] .... [ 91%] tests/utils/test_cache.py .......................... [ 93%] tests/utils/test_dependency_specification.py ....................... [ 94%] tests/utils/test_extras.py ....... [ 94%] tests/utils/test_helpers.py ...................... [ 96%] tests/utils/test_password_manager.py ........................... [ 98%] tests/utils/test_patterns.py .. [ 98%] tests/utils/test_pip.py .. [ 98%] tests/utils/test_setup_reader.py ........... [ 98%] tests/utils/test_source.py ........ [ 99%] tests/vcs/git/test_backend.py .... [ 99%] tests/vcs/git/test_system.py .... [100%] ==================================== ERRORS ==================================== _________________ ERROR at setup of test_export_prints_warning _________________ command_tester_factory = ._tester at 0x7f92a4764820> @pytest.fixture def tester(command_tester_factory: CommandTesterFactory) -> CommandTester: > return command_tester_factory("export") tests/console/commands/test_export.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/console/conftest.py:125: in _tester command_obj = app.find(command) /usr/lib/python3.8/site-packages/cleo/application.py:271: in find if self.has(name): /usr/lib/python3.8/site-packages/cleo/application.py:232: in has self._command_loader.has(name) and self.add(self._command_loader.get(name)) /usr/lib/python3.8/site-packages/cleo/loaders/factory_command_loader.py:32: in get return self._factories[name]() ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/console/application.py:44: in _load module = import_module("poetry.console.commands." + ".".join(words)) /usr/lib64/python3.8/importlib/__init__.py:127: in import_module return _bootstrap._gcd_import(name[level:], package, level) :1014: in _gcd_import ??? :991: in _find_and_load ??? :975: in _find_and_load_unlocked ??? :671: in _load_unlocked ??? :843: in exec_module ??? :219: in _call_with_frames_removed ??? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ from __future__ import annotations > from poetry_plugin_export.command import ( # type: ignore[import-untyped] ExportCommand as BaseExportCommand, ) E ModuleNotFoundError: No module named 'poetry_plugin_export' ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/console/commands/export.py:3: ModuleNotFoundError ________________ ERROR at setup of test_disable_export_warning _________________ command_tester_factory = ._tester at 0x7f92a867b700> @pytest.fixture def tester(command_tester_factory: CommandTesterFactory) -> CommandTester: > return command_tester_factory("export") tests/console/commands/test_export.py:17: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ tests/console/conftest.py:125: in _tester command_obj = app.find(command) /usr/lib/python3.8/site-packages/cleo/application.py:271: in find if self.has(name): /usr/lib/python3.8/site-packages/cleo/application.py:232: in has self._command_loader.has(name) and self.add(self._command_loader.get(name)) /usr/lib/python3.8/site-packages/cleo/loaders/factory_command_loader.py:32: in get return self._factories[name]() ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/console/application.py:44: in _load module = import_module("poetry.console.commands." + ".".join(words)) /usr/lib64/python3.8/importlib/__init__.py:127: in import_module return _bootstrap._gcd_import(name[level:], package, level) :1014: in _gcd_import ??? :991: in _find_and_load ??? :975: in _find_and_load_unlocked ??? :671: in _load_unlocked ??? :843: in exec_module ??? :219: in _call_with_frames_removed ??? _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ from __future__ import annotations > from poetry_plugin_export.command import ( # type: ignore[import-untyped] ExportCommand as BaseExportCommand, ) E ModuleNotFoundError: No module named 'poetry_plugin_export' ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/console/commands/export.py:3: ModuleNotFoundError =================================== FAILURES =================================== _____________________ test_env_info_displays_complete_info _____________________ tester = def test_env_info_displays_complete_info(tester: CommandTester) -> None: > tester.execute() tests/console/commands/env/test_info.py:36: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/cleo/testers/command_tester.py:88: in execute self._status_code = self._command.run(self._io) /usr/lib/python3.8/site-packages/cleo/commands/base_command.py:117: in run return self.execute(io) or 0 /usr/lib/python3.8/site-packages/cleo/commands/command.py:61: in execute return self.handle() ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/console/commands/env/info.py:46: in handle self._display_complete_info(env) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/console/commands/env/info.py:74: in _display_complete_info base_env = env.parent_env ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:101: in parent_env return GenericEnv(self.base, child_env=self) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/generic_env.py:27: in __init__ super().__init__(path, base=base) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:44: in __init__ output = self.run_python_script(GET_BASE_PREFIX) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:313: in run_python_script return self.run( ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:305: in run return self._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/generic_env.py:99: in _run return super(VirtualEnv, self)._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:338: in _run output = subprocess.check_output( /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, /usr/lib64/python3.8/subprocess.py:493: in run with Popen(*popenargs, **kwargs) as process: /usr/lib64/python3.8/subprocess.py:858: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = args = ['python', '-I', '-W', 'ignore', '-c', 'import sys\n\nif hasattr(sys, "real_prefix"):\n print(sys.real_prefix)\nelif hasattr(sys, "base_prefix"):\n print(sys.base_prefix)\nelse:\n print(sys.prefix)\n'] executable = b'python', preexec_fn = None, close_fds = True, pass_fds = () cwd = None env = {'AR': '/usr/bin/gcc-ar', 'ASMFLAGS': '-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-...cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security', ...} startupinfo = None, creationflags = 0, shell = False, p2cread = -1 p2cwrite = -1, c2pread = 12, c2pwrite = 13, errread = 14, errwrite = 15 restore_signals = True, start_new_session = False def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _posixsubprocess.fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, preexec_fn) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") if child_exec_never_called: err_msg = "" # The error must be from chdir(cwd). err_filename = cwd else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'python' /usr/lib64/python3.8/subprocess.py:1720: FileNotFoundError _____________________________ test_none_activated ______________________________ tester = venvs_in_cache_dirs = ['simple-project-xePwK_nb-py3.6', 'simple-project-xePwK_nb-py3.7'] mocker = env = MockEnv("/tmp/pytest-of-tkloczko/pytest-20/test_none_activated0/.venv") def test_none_activated( tester: CommandTester, venvs_in_cache_dirs: list[str], mocker: MockerFixture, env: MockEnv, ) -> None: mocker.patch("poetry.utils.env.EnvManager.get", return_value=env) > tester.execute() tests/console/commands/env/test_list.py:41: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/cleo/testers/command_tester.py:88: in execute self._status_code = self._command.run(self._io) /usr/lib/python3.8/site-packages/cleo/commands/base_command.py:117: in run return self.execute(io) or 0 /usr/lib/python3.8/site-packages/cleo/commands/command.py:61: in execute return self.handle() ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/console/commands/env/list.py:20: in handle for venv in manager.list(): ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:332: in list env_list = [VirtualEnv(p) for p in sorted(venv_path.glob(f"{venv_name}-py*"))] ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:332: in env_list = [VirtualEnv(p) for p in sorted(venv_path.glob(f"{venv_name}-py*"))] ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:44: in __init__ output = self.run_python_script(GET_BASE_PREFIX) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:313: in run_python_script return self.run( ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:305: in run return self._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:88: in _run return super()._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:338: in _run output = subprocess.check_output( /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, /usr/lib64/python3.8/subprocess.py:493: in run with Popen(*popenargs, **kwargs) as process: /usr/lib64/python3.8/subprocess.py:858: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = args = ['python', '-I', '-W', 'ignore', '-c', 'import sys\n\nif hasattr(sys, "real_prefix"):\n print(sys.real_prefix)\nelif hasattr(sys, "base_prefix"):\n print(sys.base_prefix)\nelse:\n print(sys.prefix)\n'] executable = b'python', preexec_fn = None, close_fds = True, pass_fds = () cwd = None env = {'AR': '/usr/bin/gcc-ar', 'ASMFLAGS': '-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-...cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security', ...} startupinfo = None, creationflags = 0, shell = False, p2cread = -1 p2cwrite = -1, c2pread = 12, c2pwrite = 13, errread = 14, errwrite = 15 restore_signals = True, start_new_session = False def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _posixsubprocess.fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, preexec_fn) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") if child_exec_never_called: err_msg = "" # The error must be from chdir(cwd). err_filename = cwd else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'python' /usr/lib64/python3.8/subprocess.py:1720: FileNotFoundError ________________________________ test_activated ________________________________ tester = venvs_in_cache_dirs = ['simple-project-CGfKT3xZ-py3.6', 'simple-project-CGfKT3xZ-py3.7'] venv_cache = PosixPath('/tmp/pytest-of-tkloczko/pytest-20/test_activated0') venv_activate_37 = None def test_activated( tester: CommandTester, venvs_in_cache_dirs: list[str], venv_cache: Path, venv_activate_37: None, ) -> None: > tester.execute() tests/console/commands/env/test_list.py:52: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/cleo/testers/command_tester.py:88: in execute self._status_code = self._command.run(self._io) /usr/lib/python3.8/site-packages/cleo/commands/base_command.py:117: in run return self.execute(io) or 0 /usr/lib/python3.8/site-packages/cleo/commands/command.py:61: in execute return self.handle() ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/console/commands/env/list.py:18: in handle current_env = manager.get() ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:315: in get return VirtualEnv(venv) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:44: in __init__ output = self.run_python_script(GET_BASE_PREFIX) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:313: in run_python_script return self.run( ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:305: in run return self._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:88: in _run return super()._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:338: in _run output = subprocess.check_output( /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, /usr/lib64/python3.8/subprocess.py:493: in run with Popen(*popenargs, **kwargs) as process: /usr/lib64/python3.8/subprocess.py:858: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = args = ['python', '-I', '-W', 'ignore', '-c', 'import sys\n\nif hasattr(sys, "real_prefix"):\n print(sys.real_prefix)\nelif hasattr(sys, "base_prefix"):\n print(sys.base_prefix)\nelse:\n print(sys.prefix)\n'] executable = b'python', preexec_fn = None, close_fds = True, pass_fds = () cwd = None env = {'AR': '/usr/bin/gcc-ar', 'ASMFLAGS': '-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-...cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security', ...} startupinfo = None, creationflags = 0, shell = False, p2cread = -1 p2cwrite = -1, c2pread = 12, c2pwrite = 13, errread = 14, errwrite = 15 restore_signals = True, start_new_session = False def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _posixsubprocess.fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, preexec_fn) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") if child_exec_never_called: err_msg = "" # The error must be from chdir(cwd). err_filename = cwd else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'python' /usr/lib64/python3.8/subprocess.py:1720: FileNotFoundError _____________________________ test_in_project_venv _____________________________ tester = venvs_in_project_dir = PosixPath('/tmp/pytest-of-tkloczko/pytest-20/test_in_project_venv0/poetry-fixture-simple/.venv') def test_in_project_venv( tester: CommandTester, venvs_in_project_dir: list[str] ) -> None: > tester.execute() tests/console/commands/env/test_list.py:60: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/cleo/testers/command_tester.py:88: in execute self._status_code = self._command.run(self._io) /usr/lib/python3.8/site-packages/cleo/commands/base_command.py:117: in run return self.execute(io) or 0 /usr/lib/python3.8/site-packages/cleo/commands/command.py:61: in execute return self.handle() ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/console/commands/env/list.py:18: in handle current_env = manager.get() ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:299: in get return VirtualEnv(venv) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:44: in __init__ output = self.run_python_script(GET_BASE_PREFIX) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:313: in run_python_script return self.run( ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:305: in run return self._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:88: in _run return super()._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:338: in _run output = subprocess.check_output( /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, /usr/lib64/python3.8/subprocess.py:493: in run with Popen(*popenargs, **kwargs) as process: /usr/lib64/python3.8/subprocess.py:858: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = args = ['python', '-I', '-W', 'ignore', '-c', 'import sys\n\nif hasattr(sys, "real_prefix"):\n print(sys.real_prefix)\nelif hasattr(sys, "base_prefix"):\n print(sys.base_prefix)\nelse:\n print(sys.prefix)\n'] executable = b'python', preexec_fn = None, close_fds = True, pass_fds = () cwd = None env = {'AR': '/usr/bin/gcc-ar', 'ASMFLAGS': '-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-...cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security', ...} startupinfo = None, creationflags = 0, shell = False, p2cread = -1 p2cwrite = -1, c2pread = 12, c2pwrite = 13, errread = 14, errwrite = 15 restore_signals = True, start_new_session = False def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _posixsubprocess.fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, preexec_fn) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") if child_exec_never_called: err_msg = "" # The error must be from chdir(cwd). err_filename = cwd else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'python' /usr/lib64/python3.8/subprocess.py:1720: FileNotFoundError ___________________ test_in_project_venv_no_explicit_config ____________________ tester = venvs_in_project_dir_none = PosixPath('/tmp/pytest-of-tkloczko/pytest-20/test_in_project_venv_no_explic0/poetry-fixture-simple/.venv') def test_in_project_venv_no_explicit_config( tester: CommandTester, venvs_in_project_dir_none: list[str] ) -> None: > tester.execute() tests/console/commands/env/test_list.py:68: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/cleo/testers/command_tester.py:88: in execute self._status_code = self._command.run(self._io) /usr/lib/python3.8/site-packages/cleo/commands/base_command.py:117: in run return self.execute(io) or 0 /usr/lib/python3.8/site-packages/cleo/commands/command.py:61: in execute return self.handle() ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/console/commands/env/list.py:18: in handle current_env = manager.get() ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:299: in get return VirtualEnv(venv) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:44: in __init__ output = self.run_python_script(GET_BASE_PREFIX) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:313: in run_python_script return self.run( ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:305: in run return self._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:88: in _run return super()._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:338: in _run output = subprocess.check_output( /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, /usr/lib64/python3.8/subprocess.py:493: in run with Popen(*popenargs, **kwargs) as process: /usr/lib64/python3.8/subprocess.py:858: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = args = ['python', '-I', '-W', 'ignore', '-c', 'import sys\n\nif hasattr(sys, "real_prefix"):\n print(sys.real_prefix)\nelif hasattr(sys, "base_prefix"):\n print(sys.base_prefix)\nelse:\n print(sys.prefix)\n'] executable = b'python', preexec_fn = None, close_fds = True, pass_fds = () cwd = None env = {'AR': '/usr/bin/gcc-ar', 'ASMFLAGS': '-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-...cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security', ...} startupinfo = None, creationflags = 0, shell = False, p2cread = -1 p2cwrite = -1, c2pread = 12, c2pwrite = 13, errread = 14, errwrite = 15 restore_signals = True, start_new_session = False def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _posixsubprocess.fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, preexec_fn) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") if child_exec_never_called: err_msg = "" # The error must be from chdir(cwd). err_filename = cwd else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'python' /usr/lib64/python3.8/subprocess.py:1720: FileNotFoundError _____________________________ test_remove_by_name ______________________________ tester = venvs_in_cache_dirs = ['simple-project-jKEtJ6Lj-py3.6', 'simple-project-jKEtJ6Lj-py3.7'] venv_name = 'simple-project-jKEtJ6Lj' venv_cache = PosixPath('/tmp/pytest-of-tkloczko/pytest-20/test_remove_by_name0') def test_remove_by_name( tester: CommandTester, venvs_in_cache_dirs: list[str], venv_name: str, venv_cache: Path, ) -> None: expected = "" for name in venvs_in_cache_dirs: > tester.execute(name) tests/console/commands/env/test_remove.py:56: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/cleo/testers/command_tester.py:88: in execute self._status_code = self._command.run(self._io) /usr/lib/python3.8/site-packages/cleo/commands/base_command.py:117: in run return self.execute(io) or 0 /usr/lib/python3.8/site-packages/cleo/commands/command.py:61: in execute return self.handle() ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/console/commands/env/remove.py:42: in handle venv = manager.remove(python) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:365: in remove venvs = self.list() ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:332: in list env_list = [VirtualEnv(p) for p in sorted(venv_path.glob(f"{venv_name}-py*"))] ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:332: in env_list = [VirtualEnv(p) for p in sorted(venv_path.glob(f"{venv_name}-py*"))] ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:44: in __init__ output = self.run_python_script(GET_BASE_PREFIX) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:313: in run_python_script return self.run( ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:305: in run return self._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:88: in _run return super()._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:338: in _run output = subprocess.check_output( /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, /usr/lib64/python3.8/subprocess.py:493: in run with Popen(*popenargs, **kwargs) as process: /usr/lib64/python3.8/subprocess.py:858: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = args = ['python', '-I', '-W', 'ignore', '-c', 'import sys\n\nif hasattr(sys, "real_prefix"):\n print(sys.real_prefix)\nelif hasattr(sys, "base_prefix"):\n print(sys.base_prefix)\nelse:\n print(sys.prefix)\n'] executable = b'python', preexec_fn = None, close_fds = True, pass_fds = () cwd = None env = {'AR': '/usr/bin/gcc-ar', 'ASMFLAGS': '-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-...cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security', ...} startupinfo = None, creationflags = 0, shell = False, p2cread = -1 p2cwrite = -1, c2pread = 12, c2pwrite = 13, errread = 14, errwrite = 15 restore_signals = True, start_new_session = False def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _posixsubprocess.fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, preexec_fn) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") if child_exec_never_called: err_msg = "" # The error must be from chdir(cwd). err_filename = cwd else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'python' /usr/lib64/python3.8/subprocess.py:1720: FileNotFoundError ____________________________ test_remove_all[None] _____________________________ tester = venvs_in_cache_dirs = ['simple-project-6B8gTm_h-py3.6', 'simple-project-6B8gTm_h-py3.7'] venv_name = 'simple-project-6B8gTm_h' venv_cache = PosixPath('/tmp/pytest-of-tkloczko/pytest-20/test_remove_all_None_0') envs_file = None @pytest.mark.parametrize( "envs_file", [None, "empty", "self", "other", "self_and_other"] ) def test_remove_all( tester: CommandTester, venvs_in_cache_dirs: list[str], venv_name: str, venv_cache: Path, envs_file: str | None, ) -> None: envs_file_path = venv_cache / "envs.toml" if envs_file == "empty": envs_file_path.touch() elif envs_file == "self": envs_file_path.write_text(f'[{venv_name}]\nminor = "3.9"\npatch = "3.9.1"\n') elif envs_file == "other": envs_file_path.write_text('[other-abcdefgh]\nminor = "3.9"\npatch = "3.9.1"\n') elif envs_file == "self_and_other": envs_file_path.write_text( f'[{venv_name}]\nminor = "3.9"\npatch = "3.9.1"\n' '[other-abcdefgh]\nminor = "3.9"\npatch = "3.9.1"\n' ) else: # no envs file -> nothing to prepare assert envs_file is None expected = {""} > tester.execute("--all") tests/console/commands/env/test_remove.py:92: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/cleo/testers/command_tester.py:88: in execute self._status_code = self._command.run(self._io) /usr/lib/python3.8/site-packages/cleo/commands/base_command.py:117: in run return self.execute(io) or 0 /usr/lib/python3.8/site-packages/cleo/commands/command.py:61: in execute return self.handle() ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/console/commands/env/remove.py:45: in handle for venv in manager.list(): ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:332: in list env_list = [VirtualEnv(p) for p in sorted(venv_path.glob(f"{venv_name}-py*"))] ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:332: in env_list = [VirtualEnv(p) for p in sorted(venv_path.glob(f"{venv_name}-py*"))] ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:44: in __init__ output = self.run_python_script(GET_BASE_PREFIX) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:313: in run_python_script return self.run( ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:305: in run return self._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:88: in _run return super()._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:338: in _run output = subprocess.check_output( /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, /usr/lib64/python3.8/subprocess.py:493: in run with Popen(*popenargs, **kwargs) as process: /usr/lib64/python3.8/subprocess.py:858: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = args = ['python', '-I', '-W', 'ignore', '-c', 'import sys\n\nif hasattr(sys, "real_prefix"):\n print(sys.real_prefix)\nelif hasattr(sys, "base_prefix"):\n print(sys.base_prefix)\nelse:\n print(sys.prefix)\n'] executable = b'python', preexec_fn = None, close_fds = True, pass_fds = () cwd = None env = {'AR': '/usr/bin/gcc-ar', 'ASMFLAGS': '-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-...cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security', ...} startupinfo = None, creationflags = 0, shell = False, p2cread = -1 p2cwrite = -1, c2pread = 12, c2pwrite = 13, errread = 14, errwrite = 15 restore_signals = True, start_new_session = False def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _posixsubprocess.fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, preexec_fn) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") if child_exec_never_called: err_msg = "" # The error must be from chdir(cwd). err_filename = cwd else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'python' /usr/lib64/python3.8/subprocess.py:1720: FileNotFoundError ____________________________ test_remove_all[empty] ____________________________ tester = venvs_in_cache_dirs = ['simple-project-ahWQ7_wY-py3.6', 'simple-project-ahWQ7_wY-py3.7'] venv_name = 'simple-project-ahWQ7_wY' venv_cache = PosixPath('/tmp/pytest-of-tkloczko/pytest-20/test_remove_all_empty_0') envs_file = 'empty' @pytest.mark.parametrize( "envs_file", [None, "empty", "self", "other", "self_and_other"] ) def test_remove_all( tester: CommandTester, venvs_in_cache_dirs: list[str], venv_name: str, venv_cache: Path, envs_file: str | None, ) -> None: envs_file_path = venv_cache / "envs.toml" if envs_file == "empty": envs_file_path.touch() elif envs_file == "self": envs_file_path.write_text(f'[{venv_name}]\nminor = "3.9"\npatch = "3.9.1"\n') elif envs_file == "other": envs_file_path.write_text('[other-abcdefgh]\nminor = "3.9"\npatch = "3.9.1"\n') elif envs_file == "self_and_other": envs_file_path.write_text( f'[{venv_name}]\nminor = "3.9"\npatch = "3.9.1"\n' '[other-abcdefgh]\nminor = "3.9"\npatch = "3.9.1"\n' ) else: # no envs file -> nothing to prepare assert envs_file is None expected = {""} > tester.execute("--all") tests/console/commands/env/test_remove.py:92: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/cleo/testers/command_tester.py:88: in execute self._status_code = self._command.run(self._io) /usr/lib/python3.8/site-packages/cleo/commands/base_command.py:117: in run return self.execute(io) or 0 /usr/lib/python3.8/site-packages/cleo/commands/command.py:61: in execute return self.handle() ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/console/commands/env/remove.py:45: in handle for venv in manager.list(): ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:332: in list env_list = [VirtualEnv(p) for p in sorted(venv_path.glob(f"{venv_name}-py*"))] ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:332: in env_list = [VirtualEnv(p) for p in sorted(venv_path.glob(f"{venv_name}-py*"))] ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:44: in __init__ output = self.run_python_script(GET_BASE_PREFIX) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:313: in run_python_script return self.run( ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:305: in run return self._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:88: in _run return super()._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:338: in _run output = subprocess.check_output( /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, /usr/lib64/python3.8/subprocess.py:493: in run with Popen(*popenargs, **kwargs) as process: /usr/lib64/python3.8/subprocess.py:858: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = args = ['python', '-I', '-W', 'ignore', '-c', 'import sys\n\nif hasattr(sys, "real_prefix"):\n print(sys.real_prefix)\nelif hasattr(sys, "base_prefix"):\n print(sys.base_prefix)\nelse:\n print(sys.prefix)\n'] executable = b'python', preexec_fn = None, close_fds = True, pass_fds = () cwd = None env = {'AR': '/usr/bin/gcc-ar', 'ASMFLAGS': '-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-...cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security', ...} startupinfo = None, creationflags = 0, shell = False, p2cread = -1 p2cwrite = -1, c2pread = 12, c2pwrite = 13, errread = 14, errwrite = 15 restore_signals = True, start_new_session = False def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _posixsubprocess.fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, preexec_fn) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") if child_exec_never_called: err_msg = "" # The error must be from chdir(cwd). err_filename = cwd else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'python' /usr/lib64/python3.8/subprocess.py:1720: FileNotFoundError ____________________________ test_remove_all[self] _____________________________ tester = venvs_in_cache_dirs = ['simple-project-U9hZ81At-py3.6', 'simple-project-U9hZ81At-py3.7'] venv_name = 'simple-project-U9hZ81At' venv_cache = PosixPath('/tmp/pytest-of-tkloczko/pytest-20/test_remove_all_self_0') envs_file = 'self' @pytest.mark.parametrize( "envs_file", [None, "empty", "self", "other", "self_and_other"] ) def test_remove_all( tester: CommandTester, venvs_in_cache_dirs: list[str], venv_name: str, venv_cache: Path, envs_file: str | None, ) -> None: envs_file_path = venv_cache / "envs.toml" if envs_file == "empty": envs_file_path.touch() elif envs_file == "self": envs_file_path.write_text(f'[{venv_name}]\nminor = "3.9"\npatch = "3.9.1"\n') elif envs_file == "other": envs_file_path.write_text('[other-abcdefgh]\nminor = "3.9"\npatch = "3.9.1"\n') elif envs_file == "self_and_other": envs_file_path.write_text( f'[{venv_name}]\nminor = "3.9"\npatch = "3.9.1"\n' '[other-abcdefgh]\nminor = "3.9"\npatch = "3.9.1"\n' ) else: # no envs file -> nothing to prepare assert envs_file is None expected = {""} > tester.execute("--all") tests/console/commands/env/test_remove.py:92: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/cleo/testers/command_tester.py:88: in execute self._status_code = self._command.run(self._io) /usr/lib/python3.8/site-packages/cleo/commands/base_command.py:117: in run return self.execute(io) or 0 /usr/lib/python3.8/site-packages/cleo/commands/command.py:61: in execute return self.handle() ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/console/commands/env/remove.py:45: in handle for venv in manager.list(): ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:332: in list env_list = [VirtualEnv(p) for p in sorted(venv_path.glob(f"{venv_name}-py*"))] ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:332: in env_list = [VirtualEnv(p) for p in sorted(venv_path.glob(f"{venv_name}-py*"))] ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:44: in __init__ output = self.run_python_script(GET_BASE_PREFIX) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:313: in run_python_script return self.run( ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:305: in run return self._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:88: in _run return super()._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:338: in _run output = subprocess.check_output( /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, /usr/lib64/python3.8/subprocess.py:493: in run with Popen(*popenargs, **kwargs) as process: /usr/lib64/python3.8/subprocess.py:858: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = args = ['python', '-I', '-W', 'ignore', '-c', 'import sys\n\nif hasattr(sys, "real_prefix"):\n print(sys.real_prefix)\nelif hasattr(sys, "base_prefix"):\n print(sys.base_prefix)\nelse:\n print(sys.prefix)\n'] executable = b'python', preexec_fn = None, close_fds = True, pass_fds = () cwd = None env = {'AR': '/usr/bin/gcc-ar', 'ASMFLAGS': '-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-...cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security', ...} startupinfo = None, creationflags = 0, shell = False, p2cread = -1 p2cwrite = -1, c2pread = 12, c2pwrite = 13, errread = 14, errwrite = 15 restore_signals = True, start_new_session = False def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _posixsubprocess.fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, preexec_fn) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") if child_exec_never_called: err_msg = "" # The error must be from chdir(cwd). err_filename = cwd else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'python' /usr/lib64/python3.8/subprocess.py:1720: FileNotFoundError ____________________________ test_remove_all[other] ____________________________ tester = venvs_in_cache_dirs = ['simple-project-neSJ6SV6-py3.6', 'simple-project-neSJ6SV6-py3.7'] venv_name = 'simple-project-neSJ6SV6' venv_cache = PosixPath('/tmp/pytest-of-tkloczko/pytest-20/test_remove_all_other_0') envs_file = 'other' @pytest.mark.parametrize( "envs_file", [None, "empty", "self", "other", "self_and_other"] ) def test_remove_all( tester: CommandTester, venvs_in_cache_dirs: list[str], venv_name: str, venv_cache: Path, envs_file: str | None, ) -> None: envs_file_path = venv_cache / "envs.toml" if envs_file == "empty": envs_file_path.touch() elif envs_file == "self": envs_file_path.write_text(f'[{venv_name}]\nminor = "3.9"\npatch = "3.9.1"\n') elif envs_file == "other": envs_file_path.write_text('[other-abcdefgh]\nminor = "3.9"\npatch = "3.9.1"\n') elif envs_file == "self_and_other": envs_file_path.write_text( f'[{venv_name}]\nminor = "3.9"\npatch = "3.9.1"\n' '[other-abcdefgh]\nminor = "3.9"\npatch = "3.9.1"\n' ) else: # no envs file -> nothing to prepare assert envs_file is None expected = {""} > tester.execute("--all") tests/console/commands/env/test_remove.py:92: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/cleo/testers/command_tester.py:88: in execute self._status_code = self._command.run(self._io) /usr/lib/python3.8/site-packages/cleo/commands/base_command.py:117: in run return self.execute(io) or 0 /usr/lib/python3.8/site-packages/cleo/commands/command.py:61: in execute return self.handle() ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/console/commands/env/remove.py:45: in handle for venv in manager.list(): ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:332: in list env_list = [VirtualEnv(p) for p in sorted(venv_path.glob(f"{venv_name}-py*"))] ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:332: in env_list = [VirtualEnv(p) for p in sorted(venv_path.glob(f"{venv_name}-py*"))] ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:44: in __init__ output = self.run_python_script(GET_BASE_PREFIX) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:313: in run_python_script return self.run( ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:305: in run return self._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:88: in _run return super()._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:338: in _run output = subprocess.check_output( /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, /usr/lib64/python3.8/subprocess.py:493: in run with Popen(*popenargs, **kwargs) as process: /usr/lib64/python3.8/subprocess.py:858: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = args = ['python', '-I', '-W', 'ignore', '-c', 'import sys\n\nif hasattr(sys, "real_prefix"):\n print(sys.real_prefix)\nelif hasattr(sys, "base_prefix"):\n print(sys.base_prefix)\nelse:\n print(sys.prefix)\n'] executable = b'python', preexec_fn = None, close_fds = True, pass_fds = () cwd = None env = {'AR': '/usr/bin/gcc-ar', 'ASMFLAGS': '-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-...cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security', ...} startupinfo = None, creationflags = 0, shell = False, p2cread = -1 p2cwrite = -1, c2pread = 12, c2pwrite = 13, errread = 14, errwrite = 15 restore_signals = True, start_new_session = False def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _posixsubprocess.fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, preexec_fn) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") if child_exec_never_called: err_msg = "" # The error must be from chdir(cwd). err_filename = cwd else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'python' /usr/lib64/python3.8/subprocess.py:1720: FileNotFoundError _______________________ test_remove_all[self_and_other] ________________________ tester = venvs_in_cache_dirs = ['simple-project-2b2bF19q-py3.6', 'simple-project-2b2bF19q-py3.7'] venv_name = 'simple-project-2b2bF19q' venv_cache = PosixPath('/tmp/pytest-of-tkloczko/pytest-20/test_remove_all_self_and_other0') envs_file = 'self_and_other' @pytest.mark.parametrize( "envs_file", [None, "empty", "self", "other", "self_and_other"] ) def test_remove_all( tester: CommandTester, venvs_in_cache_dirs: list[str], venv_name: str, venv_cache: Path, envs_file: str | None, ) -> None: envs_file_path = venv_cache / "envs.toml" if envs_file == "empty": envs_file_path.touch() elif envs_file == "self": envs_file_path.write_text(f'[{venv_name}]\nminor = "3.9"\npatch = "3.9.1"\n') elif envs_file == "other": envs_file_path.write_text('[other-abcdefgh]\nminor = "3.9"\npatch = "3.9.1"\n') elif envs_file == "self_and_other": envs_file_path.write_text( f'[{venv_name}]\nminor = "3.9"\npatch = "3.9.1"\n' '[other-abcdefgh]\nminor = "3.9"\npatch = "3.9.1"\n' ) else: # no envs file -> nothing to prepare assert envs_file is None expected = {""} > tester.execute("--all") tests/console/commands/env/test_remove.py:92: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/cleo/testers/command_tester.py:88: in execute self._status_code = self._command.run(self._io) /usr/lib/python3.8/site-packages/cleo/commands/base_command.py:117: in run return self.execute(io) or 0 /usr/lib/python3.8/site-packages/cleo/commands/command.py:61: in execute return self.handle() ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/console/commands/env/remove.py:45: in handle for venv in manager.list(): ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:332: in list env_list = [VirtualEnv(p) for p in sorted(venv_path.glob(f"{venv_name}-py*"))] ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:332: in env_list = [VirtualEnv(p) for p in sorted(venv_path.glob(f"{venv_name}-py*"))] ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:44: in __init__ output = self.run_python_script(GET_BASE_PREFIX) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:313: in run_python_script return self.run( ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:305: in run return self._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:88: in _run return super()._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:338: in _run output = subprocess.check_output( /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, /usr/lib64/python3.8/subprocess.py:493: in run with Popen(*popenargs, **kwargs) as process: /usr/lib64/python3.8/subprocess.py:858: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = args = ['python', '-I', '-W', 'ignore', '-c', 'import sys\n\nif hasattr(sys, "real_prefix"):\n print(sys.real_prefix)\nelif hasattr(sys, "base_prefix"):\n print(sys.base_prefix)\nelse:\n print(sys.prefix)\n'] executable = b'python', preexec_fn = None, close_fds = True, pass_fds = () cwd = None env = {'AR': '/usr/bin/gcc-ar', 'ASMFLAGS': '-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-...cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security', ...} startupinfo = None, creationflags = 0, shell = False, p2cread = -1 p2cwrite = -1, c2pread = 12, c2pwrite = 13, errread = 14, errwrite = 15 restore_signals = True, start_new_session = False def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _posixsubprocess.fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, preexec_fn) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") if child_exec_never_called: err_msg = "" # The error must be from chdir(cwd). err_filename = cwd else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'python' /usr/lib64/python3.8/subprocess.py:1720: FileNotFoundError _________________________ test_remove_all_and_version __________________________ tester = venvs_in_cache_dirs = ['simple-project-CqlL-wgX-py3.6', 'simple-project-CqlL-wgX-py3.7'] venv_name = 'simple-project-CqlL-wgX' venv_cache = PosixPath('/tmp/pytest-of-tkloczko/pytest-20/test_remove_all_and_version0') def test_remove_all_and_version( tester: CommandTester, venvs_in_cache_dirs: list[str], venv_name: str, venv_cache: Path, ) -> None: expected = {""} > tester.execute(f"--all {venvs_in_cache_dirs[0]}") tests/console/commands/env/test_remove.py:117: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/cleo/testers/command_tester.py:88: in execute self._status_code = self._command.run(self._io) /usr/lib/python3.8/site-packages/cleo/commands/base_command.py:117: in run return self.execute(io) or 0 /usr/lib/python3.8/site-packages/cleo/commands/command.py:61: in execute return self.handle() ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/console/commands/env/remove.py:42: in handle venv = manager.remove(python) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:365: in remove venvs = self.list() ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:332: in list env_list = [VirtualEnv(p) for p in sorted(venv_path.glob(f"{venv_name}-py*"))] ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:332: in env_list = [VirtualEnv(p) for p in sorted(venv_path.glob(f"{venv_name}-py*"))] ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:44: in __init__ output = self.run_python_script(GET_BASE_PREFIX) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:313: in run_python_script return self.run( ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:305: in run return self._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:88: in _run return super()._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:338: in _run output = subprocess.check_output( /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, /usr/lib64/python3.8/subprocess.py:493: in run with Popen(*popenargs, **kwargs) as process: /usr/lib64/python3.8/subprocess.py:858: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = args = ['python', '-I', '-W', 'ignore', '-c', 'import sys\n\nif hasattr(sys, "real_prefix"):\n print(sys.real_prefix)\nelif hasattr(sys, "base_prefix"):\n print(sys.base_prefix)\nelse:\n print(sys.prefix)\n'] executable = b'python', preexec_fn = None, close_fds = True, pass_fds = () cwd = None env = {'AR': '/usr/bin/gcc-ar', 'ASMFLAGS': '-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-...cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security', ...} startupinfo = None, creationflags = 0, shell = False, p2cread = -1 p2cwrite = -1, c2pread = 12, c2pwrite = 13, errread = 14, errwrite = 15 restore_signals = True, start_new_session = False def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _posixsubprocess.fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, preexec_fn) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") if child_exec_never_called: err_msg = "" # The error must be from chdir(cwd). err_filename = cwd else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'python' /usr/lib64/python3.8/subprocess.py:1720: FileNotFoundError _____________________________ test_remove_multiple _____________________________ tester = venvs_in_cache_dirs = ['simple-project-TFb1ACGT-py3.6', 'simple-project-TFb1ACGT-py3.7'] venv_name = 'simple-project-TFb1ACGT' venv_cache = PosixPath('/tmp/pytest-of-tkloczko/pytest-20/test_remove_multiple0') def test_remove_multiple( tester: CommandTester, venvs_in_cache_dirs: list[str], venv_name: str, venv_cache: Path, ) -> None: expected = {""} removed_envs = venvs_in_cache_dirs[0:2] remaining_envs = venvs_in_cache_dirs[2:] > tester.execute(" ".join(removed_envs)) tests/console/commands/env/test_remove.py:133: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ /usr/lib/python3.8/site-packages/cleo/testers/command_tester.py:88: in execute self._status_code = self._command.run(self._io) /usr/lib/python3.8/site-packages/cleo/commands/base_command.py:117: in run return self.execute(io) or 0 /usr/lib/python3.8/site-packages/cleo/commands/command.py:61: in execute return self.handle() ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/console/commands/env/remove.py:42: in handle venv = manager.remove(python) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:365: in remove venvs = self.list() ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:332: in list env_list = [VirtualEnv(p) for p in sorted(venv_path.glob(f"{venv_name}-py*"))] ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:332: in env_list = [VirtualEnv(p) for p in sorted(venv_path.glob(f"{venv_name}-py*"))] ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:44: in __init__ output = self.run_python_script(GET_BASE_PREFIX) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:313: in run_python_script return self.run( ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:305: in run return self._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:88: in _run return super()._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:338: in _run output = subprocess.check_output( /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, /usr/lib64/python3.8/subprocess.py:493: in run with Popen(*popenargs, **kwargs) as process: /usr/lib64/python3.8/subprocess.py:858: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = args = ['python', '-I', '-W', 'ignore', '-c', 'import sys\n\nif hasattr(sys, "real_prefix"):\n print(sys.real_prefix)\nelif hasattr(sys, "base_prefix"):\n print(sys.base_prefix)\nelse:\n print(sys.prefix)\n'] executable = b'python', preexec_fn = None, close_fds = True, pass_fds = () cwd = None env = {'AR': '/usr/bin/gcc-ar', 'ASMFLAGS': '-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-...cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security', ...} startupinfo = None, creationflags = 0, shell = False, p2cread = -1 p2cwrite = -1, c2pread = 12, c2pwrite = 13, errread = 14, errwrite = 15 restore_signals = True, start_new_session = False def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _posixsubprocess.fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, preexec_fn) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") if child_exec_never_called: err_msg = "" # The error must be from chdir(cwd). err_filename = cwd else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'python' /usr/lib64/python3.8/subprocess.py:1720: FileNotFoundError _________________ test_respect_prefer_active_on_init[True-1.1] _________________ prefer_active = True, python = '1.1' config = mocker = tester = source_dir = PosixPath('/tmp/pytest-of-tkloczko/pytest-20/test_respect_prefer_active_on_0') @pytest.mark.parametrize( ["prefer_active", "python"], [ (True, "1.1"), (False, f"{sys.version_info[0]}.{sys.version_info[1]}"), ], ) def test_respect_prefer_active_on_init( prefer_active: bool, python: str, config: Config, mocker: MockerFixture, tester: CommandTester, source_dir: Path, ) -> None: from poetry.utils.env import GET_PYTHON_VERSION_ONELINER orig_check_output = subprocess.check_output def mock_check_output(cmd: str, *_: Any, **__: Any) -> str: if GET_PYTHON_VERSION_ONELINER in cmd: return "1.1.1" result: str = orig_check_output(cmd, *_, **__) return result mocker.patch("subprocess.check_output", side_effect=mock_check_output) config.config["virtualenvs"]["prefer-active-python"] = prefer_active pyproject_file = source_dir / "pyproject.toml" tester.execute( "--author 'Your Name ' --name 'my-package'", interactive=False, ) expected = f"""\ [tool.poetry.dependencies] python = "^{python}" """ > assert expected in pyproject_file.read_text() E assert '[tool.poetry.dependencies]\npython = "^1.1"\n' in '[tool.poetry]\nname = "my-package"\nversion = "0.1.0"\ndescription = ""\nauthors = ["Your Name "]\nr...dencies]\npython = "^3.8"\n\n\n[build-system]\nrequires = ["poetry-core"]\nbuild-backend = "poetry.core.masonry.api"\n' E + where '[tool.poetry]\nname = "my-package"\nversion = "0.1.0"\ndescription = ""\nauthors = ["Your Name "]\nr...dencies]\npython = "^3.8"\n\n\n[build-system]\nrequires = ["poetry-core"]\nbuild-backend = "poetry.core.masonry.api"\n' = () E + where = PosixPath('/tmp/pytest-of-tkloczko/pytest-20/test_respect_prefer_active_on_0/pyproject.toml').read_text /home/tkloczko/rpmbuild/BUILD/poetry-1.8.0/tests/console/commands/test_init.py:1107: AssertionError _________________ test_respect_prefer_active_on_new[True-1.1] __________________ prefer_active = True, python = '1.1' config = mocker = tester = tmp_path = PosixPath('/tmp/pytest-of-tkloczko/pytest-20/test_respect_prefer_active_on_2') @pytest.mark.parametrize( ["prefer_active", "python"], [ (True, "1.1"), (False, f"{sys.version_info[0]}.{sys.version_info[1]}"), ], ) def test_respect_prefer_active_on_new( prefer_active: bool, python: str, config: Config, mocker: MockerFixture, tester: CommandTester, tmp_path: Path, ) -> None: from poetry.utils.env import GET_PYTHON_VERSION_ONELINER orig_check_output = subprocess.check_output def mock_check_output(cmd: str, *_: Any, **__: Any) -> str: if GET_PYTHON_VERSION_ONELINER in cmd: return "1.1.1" output: str = orig_check_output(cmd, *_, **__) return output mocker.patch("subprocess.check_output", side_effect=mock_check_output) config.config["virtualenvs"]["prefer-active-python"] = prefer_active package = "package" path = tmp_path / package options = [str(path)] tester.execute(" ".join(options)) pyproject_file = path / "pyproject.toml" expected = f"""\ [tool.poetry.dependencies] python = "^{python}" """ > assert expected in pyproject_file.read_text() E assert '[tool.poetry.dependencies]\npython = "^1.1"\n' in '[tool.poetry]\nname = "package"\nversion = "0.1.0"\ndescription = ""\nauthors = ["Tomasz Kłoczko ...dencies]\npython = "^3.8"\n\n\n[build-system]\nrequires = ["poetry-core"]\nbuild-backend = "poetry.core.masonry.api"\n' E + where '[tool.poetry]\nname = "package"\nversion = "0.1.0"\ndescription = ""\nauthors = ["Tomasz Kłoczko ...dencies]\npython = "^3.8"\n\n\n[build-system]\nrequires = ["poetry-core"]\nbuild-backend = "poetry.core.masonry.api"\n' = () E + where = PosixPath('/tmp/pytest-of-tkloczko/pytest-20/test_respect_prefer_active_on_2/package/pyproject.toml').read_text tests/console/commands/test_new.py:231: AssertionError ________________________ test_application_with_plugins _________________________ with_add_command_plugin = None def test_application_with_plugins(with_add_command_plugin: None) -> None: app = Application() tester = ApplicationTester(app) tester.execute("") > assert re.search(r"\s+foo\s+Foo Command", tester.io.fetch_output()) is not None E AssertionError: assert None is not None E + where None = ('\\s+foo\\s+Foo Command', '') E + where = re.search E + and '' = >() E + where > = .fetch_output E + where = .io tests/console/test_application.py:50: AssertionError ____________________ test_fallback_on_detect_active_python _____________________ poetry = mocker = def test_fallback_on_detect_active_python( poetry: Poetry, mocker: MockerFixture ) -> None: m = mocker.patch( "subprocess.check_output", side_effect=subprocess.CalledProcessError(1, "some command"), ) env_manager = EnvManager(poetry) active_python = env_manager._detect_active_python() assert active_python is None > assert m.call_count == 1 E AssertionError: assert 0 == 1 E + where 0 = .call_count tests/utils/env/test_env.py:524: AssertionError _________________ test_get_venv_with_venv_folder_present[True] _________________ manager = poetry = in_project_venv_dir = PosixPath('/tmp/pytest-of-tkloczko/pytest-20/test_get_venv_with_venv_folder0/poetry-fixture-simple/.venv') in_project = True @pytest.mark.parametrize("in_project", [True, False, None]) def test_get_venv_with_venv_folder_present( manager: EnvManager, poetry: Poetry, in_project_venv_dir: Path, in_project: bool | None, ) -> None: poetry.config.config["virtualenvs"]["in-project"] = in_project > venv = manager.get() tests/utils/env/test_env_manager.py:565: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:299: in get return VirtualEnv(venv) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:44: in __init__ output = self.run_python_script(GET_BASE_PREFIX) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:313: in run_python_script return self.run( ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:305: in run return self._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:88: in _run return super()._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:338: in _run output = subprocess.check_output( /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, /usr/lib64/python3.8/subprocess.py:493: in run with Popen(*popenargs, **kwargs) as process: /usr/lib64/python3.8/subprocess.py:858: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = args = ['python', '-I', '-W', 'ignore', '-c', 'import sys\n\nif hasattr(sys, "real_prefix"):\n print(sys.real_prefix)\nelif hasattr(sys, "base_prefix"):\n print(sys.base_prefix)\nelse:\n print(sys.prefix)\n'] executable = b'python', preexec_fn = None, close_fds = True, pass_fds = () cwd = None env = {'AR': '/usr/bin/gcc-ar', 'ASMFLAGS': '-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-...cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security', ...} startupinfo = None, creationflags = 0, shell = False, p2cread = -1 p2cwrite = -1, c2pread = 12, c2pwrite = 13, errread = 14, errwrite = 15 restore_signals = True, start_new_session = False def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _posixsubprocess.fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, preexec_fn) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") if child_exec_never_called: err_msg = "" # The error must be from chdir(cwd). err_filename = cwd else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'python' /usr/lib64/python3.8/subprocess.py:1720: FileNotFoundError _________________ test_get_venv_with_venv_folder_present[None] _________________ manager = poetry = in_project_venv_dir = PosixPath('/tmp/pytest-of-tkloczko/pytest-20/test_get_venv_with_venv_folder2/poetry-fixture-simple/.venv') in_project = None @pytest.mark.parametrize("in_project", [True, False, None]) def test_get_venv_with_venv_folder_present( manager: EnvManager, poetry: Poetry, in_project_venv_dir: Path, in_project: bool | None, ) -> None: poetry.config.config["virtualenvs"]["in-project"] = in_project > venv = manager.get() tests/utils/env/test_env_manager.py:565: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:299: in get return VirtualEnv(venv) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:44: in __init__ output = self.run_python_script(GET_BASE_PREFIX) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:313: in run_python_script return self.run( ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:305: in run return self._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:88: in _run return super()._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:338: in _run output = subprocess.check_output( /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, /usr/lib64/python3.8/subprocess.py:493: in run with Popen(*popenargs, **kwargs) as process: /usr/lib64/python3.8/subprocess.py:858: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = args = ['python', '-I', '-W', 'ignore', '-c', 'import sys\n\nif hasattr(sys, "real_prefix"):\n print(sys.real_prefix)\nelif hasattr(sys, "base_prefix"):\n print(sys.base_prefix)\nelse:\n print(sys.prefix)\n'] executable = b'python', preexec_fn = None, close_fds = True, pass_fds = () cwd = None env = {'AR': '/usr/bin/gcc-ar', 'ASMFLAGS': '-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-...cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security', ...} startupinfo = None, creationflags = 0, shell = False, p2cread = -1 p2cwrite = -1, c2pread = 12, c2pwrite = 13, errread = 14, errwrite = 15 restore_signals = True, start_new_session = False def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _posixsubprocess.fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, preexec_fn) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") if child_exec_never_called: err_msg = "" # The error must be from chdir(cwd). err_filename = cwd else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'python' /usr/lib64/python3.8/subprocess.py:1720: FileNotFoundError __________________________________ test_list ___________________________________ tmp_path = PosixPath('/tmp/pytest-of-tkloczko/pytest-20/test_list0') manager = poetry = config = venv_name = 'simple-project-owzeYEdU' def test_list( tmp_path: Path, manager: EnvManager, poetry: Poetry, config: Config, venv_name: str, ) -> None: config.merge({"virtualenvs": {"path": str(tmp_path)}}) (tmp_path / f"{venv_name}-py3.7").mkdir() (tmp_path / f"{venv_name}-py3.6").mkdir() > venvs = manager.list() tests/utils/env/test_env_manager.py:613: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:332: in list env_list = [VirtualEnv(p) for p in sorted(venv_path.glob(f"{venv_name}-py*"))] ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/env_manager.py:332: in env_list = [VirtualEnv(p) for p in sorted(venv_path.glob(f"{venv_name}-py*"))] ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:44: in __init__ output = self.run_python_script(GET_BASE_PREFIX) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:313: in run_python_script return self.run( ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:305: in run return self._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/virtual_env.py:88: in _run return super()._run(cmd, **kwargs) ../../BUILDROOT/python-poetry-1.8.0~no_loopy_deps-2.fc35.x86_64/usr/lib/python3.8/site-packages/poetry/utils/env/base_env.py:338: in _run output = subprocess.check_output( /usr/lib64/python3.8/subprocess.py:415: in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, /usr/lib64/python3.8/subprocess.py:493: in run with Popen(*popenargs, **kwargs) as process: /usr/lib64/python3.8/subprocess.py:858: in __init__ self._execute_child(args, executable, preexec_fn, close_fds, _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self = args = ['python', '-I', '-W', 'ignore', '-c', 'import sys\n\nif hasattr(sys, "real_prefix"):\n print(sys.real_prefix)\nelif hasattr(sys, "base_prefix"):\n print(sys.base_prefix)\nelse:\n print(sys.prefix)\n'] executable = b'python', preexec_fn = None, close_fds = True, pass_fds = () cwd = None env = {'AR': '/usr/bin/gcc-ar', 'ASMFLAGS': '-m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-...cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security', ...} startupinfo = None, creationflags = 0, shell = False, p2cread = -1 p2cwrite = -1, c2pread = 12, c2pwrite = 13, errread = 14, errwrite = 15 restore_signals = True, start_new_session = False def _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session): """Execute program (POSIX version)""" if isinstance(args, (str, bytes)): args = [args] elif isinstance(args, os.PathLike): if shell: raise TypeError('path-like args is not allowed when ' 'shell is true') args = [args] else: args = list(args) if shell: # On Android the default shell is at '/system/bin/sh'. unix_shell = ('/system/bin/sh' if hasattr(sys, 'getandroidapilevel') else '/bin/sh') args = [unix_shell, "-c"] + args if executable: args[0] = executable if executable is None: executable = args[0] sys.audit("subprocess.Popen", executable, args, cwd, env) if (_USE_POSIX_SPAWN and os.path.dirname(executable) and preexec_fn is None and not close_fds and not pass_fds and cwd is None and (p2cread == -1 or p2cread > 2) and (c2pwrite == -1 or c2pwrite > 2) and (errwrite == -1 or errwrite > 2) and not start_new_session): self._posix_spawn(args, executable, env, restore_signals, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) return orig_executable = executable # For transferring possible exec failure from child to parent. # Data format: "exception name:hex errno:description" # Pickle is not used; it is complex and involves memory allocation. errpipe_read, errpipe_write = os.pipe() # errpipe_write must not be in the standard io 0, 1, or 2 fd range. low_fds_to_close = [] while errpipe_write < 3: low_fds_to_close.append(errpipe_write) errpipe_write = os.dup(errpipe_write) for low_fd in low_fds_to_close: os.close(low_fd) try: try: # We must avoid complex work that could involve # malloc or free in the child process to avoid # potential deadlocks, thus we do all this here. # and pass it to fork_exec() if env is not None: env_list = [] for k, v in env.items(): k = os.fsencode(k) if b'=' in k: raise ValueError("illegal environment variable name") env_list.append(k + b'=' + os.fsencode(v)) else: env_list = None # Use execv instead of execve. executable = os.fsencode(executable) if os.path.dirname(executable): executable_list = (executable,) else: # This matches the behavior of os._execvpe(). executable_list = tuple( os.path.join(os.fsencode(dir), executable) for dir in os.get_exec_path(env)) fds_to_keep = set(pass_fds) fds_to_keep.add(errpipe_write) self.pid = _posixsubprocess.fork_exec( args, executable_list, close_fds, tuple(sorted(map(int, fds_to_keep))), cwd, env_list, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, errpipe_read, errpipe_write, restore_signals, start_new_session, preexec_fn) self._child_created = True finally: # be sure the FD is closed no matter what os.close(errpipe_write) self._close_pipe_fds(p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) # Wait for exec to fail or succeed; possibly raising an # exception (limited in size) errpipe_data = bytearray() while True: part = os.read(errpipe_read, 50000) errpipe_data += part if not part or len(errpipe_data) > 50000: break finally: # be sure the FD is closed no matter what os.close(errpipe_read) if errpipe_data: try: pid, sts = os.waitpid(self.pid, 0) if pid == self.pid: self._handle_exitstatus(sts) else: self.returncode = sys.maxsize except ChildProcessError: pass try: exception_name, hex_errno, err_msg = ( errpipe_data.split(b':', 2)) # The encoding here should match the encoding # written in by the subprocess implementations # like _posixsubprocess err_msg = err_msg.decode() except ValueError: exception_name = b'SubprocessError' hex_errno = b'0' err_msg = 'Bad exception data from child: {!r}'.format( bytes(errpipe_data)) child_exception_type = getattr( builtins, exception_name.decode('ascii'), SubprocessError) if issubclass(child_exception_type, OSError) and hex_errno: errno_num = int(hex_errno, 16) child_exec_never_called = (err_msg == "noexec") if child_exec_never_called: err_msg = "" # The error must be from chdir(cwd). err_filename = cwd else: err_filename = orig_executable if errno_num != 0: err_msg = os.strerror(errno_num) > raise child_exception_type(errno_num, err_msg, err_filename) E FileNotFoundError: [Errno 2] No such file or directory: 'python' /usr/lib64/python3.8/subprocess.py:1720: FileNotFoundError =========================== short test summary info ============================ SKIPPED [1] tests/console/commands/test_run.py:87: Poetry only installs CMD script files for console scripts of editable dependencies on Windows SKIPPED [1] tests/installation/test_executor.py:305: https://github.com/python-poetry/poetry/issues/7983 SKIPPED [1] tests/installation/test_installer.py:1796: This is not working at the moment due to limitations in the resolver SKIPPED [1] tests/puzzle/test_solver.py:3737: Poetry no longer has critical package requirements SKIPPED [1] tests/utils/env/test_env.py:527: Windows only SKIPPED [1] tests/utils/env/test_env_manager.py:1250: requires darwin ERROR tests/console/commands/test_export.py::test_export_prints_warning - Mod... ERROR tests/console/commands/test_export.py::test_disable_export_warning - Mo... FAILED tests/console/commands/env/test_info.py::test_env_info_displays_complete_info FAILED tests/console/commands/env/test_list.py::test_none_activated - FileNot... FAILED tests/console/commands/env/test_list.py::test_activated - FileNotFound... FAILED tests/console/commands/env/test_list.py::test_in_project_venv - FileNo... FAILED tests/console/commands/env/test_list.py::test_in_project_venv_no_explicit_config FAILED tests/console/commands/env/test_remove.py::test_remove_by_name - FileN... FAILED tests/console/commands/env/test_remove.py::test_remove_all[None] - Fil... FAILED tests/console/commands/env/test_remove.py::test_remove_all[empty] - Fi... FAILED tests/console/commands/env/test_remove.py::test_remove_all[self] - Fil... FAILED tests/console/commands/env/test_remove.py::test_remove_all[other] - Fi... FAILED tests/console/commands/env/test_remove.py::test_remove_all[self_and_other] FAILED tests/console/commands/env/test_remove.py::test_remove_all_and_version FAILED tests/console/commands/env/test_remove.py::test_remove_multiple - File... FAILED tests/console/commands/test_init.py::test_respect_prefer_active_on_init[True-1.1] FAILED tests/console/commands/test_new.py::test_respect_prefer_active_on_new[True-1.1] FAILED tests/console/test_application.py::test_application_with_plugins - Ass... FAILED tests/utils/env/test_env.py::test_fallback_on_detect_active_python - A... FAILED tests/utils/env/test_env_manager.py::test_get_venv_with_venv_folder_present[True] FAILED tests/utils/env/test_env_manager.py::test_get_venv_with_venv_folder_present[None] FAILED tests/utils/env/test_env_manager.py::test_list - FileNotFoundError: [E... = 20 failed, 1567 passed, 6 skipped, 35 deselected, 2 errors in 135.32s (0:02:15) = ```
dimbleby commented 7 months ago

if this is important to you, you'll probably want to work on it yourself.

a year later, I guess I was not wrong

kloczek commented 7 months ago

a year later, I guess I was not wrong

I'm just a messenger .. only this and nothing more, so sentence "you're the only person who cares about this" from that angle contains incorrect assumption.

dimbleby commented 7 months ago

if anyone else cares about it they they are both not saying so here, and not doing anything about it

anyway: to whomsoever does care about this - if this is important to you, you'll probably want to work on it yourself

kloczek commented 7 months ago

Seems you do not understand my intention. I found that in some exact conditions poetry test suite fails. As I'm working on whole distribution of packages I do not care to much about each package but more about assembly whole distribution as set in consistent form. Part of the test of that consistency tests are results of each package test suite. Why? Because those test suites almost always are not testing only build package but many other components installed in each package build env. We know that at least some of the poetry test units are failing because hardcoded in test suite python interpreter executable name. In other words it is clear test suite issue. On top of that are other units which failing and which recognising for me a cause is hard.

In other words: this ticket is kind of indirect question(s) about those cause like:

May I ask to provide kind of expertise in that context? 🤔

dimbleby commented 7 months ago

it looks as though you do have methodology problems:

I dont know what else you are missing

kloczek commented 7 months ago

OK. I don't know how I've los that poetry-plugin-export dependency 🤔 Will back when will have packaged that module and added to the build env. Thank you 👍