feat: Add default-group-optionality configuration option #10623
Task Summary
Instruction pytest failed in 02:04
Details
✅ 00:03 clone
✅ 01:15 bootstrap_poetry
✅ 00:40 setup_environment
❌ 02:04 pytest
virtualenvs.create = false
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs" # /tmp/pytest-of-root/pytest-0/popen-gw0/test_list_displays_set_get_loc0/.cache/pypoetry/virtualenvs
virtualenvs.prompt = "{project_name}-py{python_version}"
virtualenvs.use-poetry-python = false
FAILED tests/console/commands/test_config.py::test_unset_setting - assert 'cache-dir = ...hon = false\n' == 'cache-dir = ...hon = false\n'
cache-dir = "/tmp/pytest-of-root/pytest-0/popen-gw0/test_unset_setting0/.cache/pypoetry"
data-dir = "/tmp/pytest-of-root/pytest-0/popen-gw0/test_unset_setting0/.local/share/pypoetry"
+ default-group-optionality = false
installer.max-workers = null
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = true
keyring.enabled = true
python.installation-dir = "{data-dir}/python" # /tmp/pytest-of-root/pytest-0/popen-gw0/test_unset_setting0/.local/share/pypoetry/python
requests.max-retries = 0
solver.lazy-wheel = true
system-git-client = false
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs" # /tmp/pytest-of-root/pytest-0/popen-gw0/test_unset_setting0/.cache/pypoetry/virtualenvs
virtualenvs.prompt = "{project_name}-py{python_version}"
virtualenvs.use-poetry-python = false
FAILED tests/console/commands/test_config.py::test_list_must_not_display_sources_from_pyproject_toml - assert 'cache-dir = ...hon = false\n' == 'cache-dir = ...hon = false\n'
cache-dir = "/tmp/pytest-of-root/pytest-0/popen-gw1/test_list_must_not_display_sou0/.cache/pypoetry"
data-dir = "/tmp/pytest-of-root/pytest-0/popen-gw1/test_list_must_not_display_sou0/.local/share/pypoetry"
+ default-group-optionality = false
installer.max-workers = null
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = true
keyring.enabled = true
python.installation-dir = "{data-dir}/python" # /tmp/pytest-of-root/pytest-0/popen-gw1/test_list_must_not_display_sou0/.local/share/pypoetry/python
repositories.foo.url = "https://foo.bar/simple/"
requests.max-retries = 0
solver.lazy-wheel = true
system-git-client = false
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs" # /tmp/pytest-of-root/pytest-0/popen-gw1/test_list_must_not_display_sou0/.cache/pypoetry/virtualenvs
virtualenvs.prompt = "{project_name}-py{python_version}"
virtualenvs.use-poetry-python = false
============ 6 failed, 2790 passed, 10 skipped in 121.81s (0:02:01) ============Annotations
Check failure on line 134 in tests/console/commands/test_default_group_optionality.py
cirrus-ci / Tests / FreeBSD (Python 3.11) / pytest
tests/console/commands/test_default_group_optionality.py#L134
tests.console.commands.test_default_group_optionality.test_with_default_group_optionality_and_with_option
Raw output
install_tester = <cleo.testers.command_tester.CommandTester object at 0x307f105306d0>
mocker = <pytest_mock.plugin.MockerFixture object at 0x307f1219f910>
def test_with_default_group_optionality_and_with_option(
install_tester: CommandTester, mocker: MockerFixture
) -> None:
"""
With default-group-optionality enabled, --with can explicitly include groups.
"""
# Enable the configuration
install_tester.command.poetry.config.merge({"default-group-optionality": True})
mocker.patch.object(install_tester.command.installer, "run", return_value=0)
mocker.patch(
"poetry.masonry.builders.editable.EditableBuilder",
side_effect=Exception("Should not be called"),
)
status_code = install_tester.execute("--no-root --with test,dev")
assert status_code == 0
# Should install main, test, and dev groups
installer_groups = set(install_tester.command.installer._groups or [])
> assert installer_groups == {MAIN_GROUP, "test", "dev"}
E AssertionError: assert {'dev', 'test'} == {'dev', 'main', 'test'}
E
E Extra items in the right set:
E 'main'
E
E Full diff:
E {
E 'dev',
E - 'main',
E 'test',
E }
/tmp/cirrus-ci-build/tests/console/commands/test_default_group_optionality.py:134: AssertionError
Check failure on line 111 in tests/console/commands/test_default_group_optionality.py
cirrus-ci / Tests / FreeBSD (Python 3.11) / pytest
tests/console/commands/test_default_group_optionality.py#L111
tests.console.commands.test_default_group_optionality.test_with_default_group_optionality_enabled
Raw output
config_tester = <cleo.testers.command_tester.CommandTester object at 0x307f1053f790>
install_tester = <cleo.testers.command_tester.CommandTester object at 0x307f12233390>
mocker = <pytest_mock.plugin.MockerFixture object at 0x307f10582f50>
def test_with_default_group_optionality_enabled(
config_tester: CommandTester,
install_tester: CommandTester,
mocker: MockerFixture,
) -> None:
"""
With default-group-optionality enabled, only main group is installed by default.
"""
# Enable the configuration
config_tester.execute("--local default-group-optionality true")
assert config_tester.status_code == 0
# Reload config
install_tester.command.poetry.config.merge({"default-group-optionality": True})
mocker.patch.object(install_tester.command.installer, "run", return_value=0)
mocker.patch(
"poetry.masonry.builders.editable.EditableBuilder",
side_effect=Exception("Should not be called"),
)
status_code = install_tester.execute("--no-root")
assert status_code == 0
# With default-group-optionality, only main group should be installed
installer_groups = set(install_tester.command.installer._groups or [])
> assert installer_groups == {MAIN_GROUP}
E AssertionError: assert set() == {'main'}
E
E Extra items in the right set:
E 'main'
E
E Full diff:
E + set()
E - {
E - 'main',
E - }
/tmp/cirrus-ci-build/tests/console/commands/test_default_group_optionality.py:111: AssertionError
Check failure on line 216 in tests/console/commands/test_config.py
cirrus-ci / Tests / FreeBSD (Python 3.11) / pytest
tests/console/commands/test_config.py#L216
tests.console.commands.test_config.test_unset_repo_setting
Raw output
tester = <cleo.testers.command_tester.CommandTester object at 0x3bae3e147110>
config = <tests.conftest.Config object at 0x3bae3e016050>
config_cache_dir = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw0/test_unset_repo_setting0/.cache/pypoetry')
config_data_dir = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw0/test_unset_repo_setting0/.local/share/pypoetry')
def test_unset_repo_setting(
tester: CommandTester, config: Config, config_cache_dir: Path, config_data_dir: Path
) -> None:
tester.execute("repositories.foo.url https://bar.com/simple/")
tester.execute("repositories.foo.url --unset ")
tester.execute("--list")
cache_dir = json.dumps(str(config_cache_dir))
data_dir = json.dumps(str(config_data_dir))
venv_path = json.dumps(os.path.join("{cache-dir}", "virtualenvs"))
expected = f"""cache-dir = {cache_dir}
data-dir = {data_dir}
installer.max-workers = null
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = true
keyring.enabled = true
python.installation-dir = {json.dumps(str(Path("{data-dir}/python")))} # {config_data_dir / "python"}
requests.max-retries = 0
solver.lazy-wheel = true
system-git-client = false
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = {venv_path} # {config_cache_dir / "virtualenvs"}
virtualenvs.prompt = "{{project_name}}-py{{python_version}}"
virtualenvs.use-poetry-python = false
"""
assert config.set_config_source.call_count == 0 # type: ignore[attr-defined]
> assert tester.io.fetch_output() == expected
E assert 'cache-dir = ...hon = false\n' == 'cache-dir = ...hon = false\n'
E
E cache-dir = "/tmp/pytest-of-root/pytest-0/popen-gw0/test_unset_repo_setting0/.cache/pypoetry"
E data-dir = "/tmp/pytest-of-root/pytest-0/popen-gw0/test_unset_repo_setting0/.local/share/pypoetry"
E + default-group-optionality = false
E installer.max-workers = null
E installer.no-binary = null
E installer.only-binary = null
E installer.parallel = true
E installer.re-resolve = true
E keyring.enabled = true
E python.installation-dir = "{data-dir}/python" # /tmp/pytest-of-root/pytest-0/popen-gw0/test_unset_repo_setting0/.local/share/pypoetry/python
E requests.max-retries = 0
E solver.lazy-wheel = true
E system-git-client = false
E virtualenvs.create = true
E virtualenvs.in-project = null
E virtualenvs.options.always-copy = false
E virtualenvs.options.no-pip = false
E virtualenvs.options.system-site-packages = false
E virtualenvs.path = "{cache-dir}/virtualenvs" # /tmp/pytest-of-root/pytest-0/popen-gw0/test_unset_repo_setting0/.cache/pypoetry/virtualenvs
E virtualenvs.prompt = "{project_name}-py{python_version}"
E virtualenvs.use-poetry-python = false
/tmp/cirrus-ci-build/tests/console/commands/test_config.py:216: AssertionError
Check failure on line 352 in tests/console/commands/test_config.py
cirrus-ci / Tests / FreeBSD (Python 3.11) / pytest
tests/console/commands/test_config.py#L352
tests.console.commands.test_config.test_list_displays_set_get_local_setting
Raw output
tester = <cleo.testers.command_tester.CommandTester object at 0x3bae39a2c6d0>
config = <tests.conftest.Config object at 0x3bae3ba5eb10>
config_cache_dir = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw0/test_list_displays_set_get_loc0/.cache/pypoetry')
config_data_dir = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw0/test_list_displays_set_get_loc0/.local/share/pypoetry')
def test_list_displays_set_get_local_setting(
tester: CommandTester,
config: Config,
config_cache_dir: Path,
config_data_dir: Path,
) -> None:
tester.execute("virtualenvs.create false --local")
tester.execute("--list")
cache_dir = json.dumps(str(config_cache_dir))
data_dir = json.dumps(str(config_data_dir))
venv_path = json.dumps(os.path.join("{cache-dir}", "virtualenvs"))
expected = f"""cache-dir = {cache_dir}
data-dir = {data_dir}
installer.max-workers = null
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = true
keyring.enabled = true
python.installation-dir = {json.dumps(str(Path("{data-dir}/python")))} # {config_data_dir / "python"}
requests.max-retries = 0
solver.lazy-wheel = true
system-git-client = false
virtualenvs.create = false
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = {venv_path} # {config_cache_dir / "virtualenvs"}
virtualenvs.prompt = "{{project_name}}-py{{python_version}}"
virtualenvs.use-poetry-python = false
"""
assert config.set_config_source.call_count == 1 # type: ignore[attr-defined]
> assert tester.io.fetch_output() == expected
E assert 'cache-dir = ...hon = false\n' == 'cache-dir = ...hon = false\n'
E
E cache-dir = "/tmp/pytest-of-root/pytest-0/popen-gw0/test_list_displays_set_get_loc0/.cache/pypoetry"
E data-dir = "/tmp/pytest-of-root/pytest-0/popen-gw0/test_list_displays_set_get_loc0/.local/share/pypoetry"
E + default-group-optionality = false
E installer.max-workers = null
E installer.no-binary = null
E installer.only-binary = null
E installer.parallel = true
E installer.re-resolve = true
E keyring.enabled = true
E python.installation-dir = "{data-dir}/python" # /tmp/pytest-of-root/pytest-0/popen-gw0/test_list_displays_set_get_loc0/.local/share/pypoetry/python
E requests.max-retries = 0
E solver.lazy-wheel = true
E system-git-client = false
E virtualenvs.create = false
E virtualenvs.in-project = null
E virtualenvs.options.always-copy = false
E virtualenvs.options.no-pip = false
E virtualenvs.options.system-site-packages = false
E virtualenvs.path = "{cache-dir}/virtualenvs" # /tmp/pytest-of-root/pytest-0/popen-gw0/test_list_displays_set_get_loc0/.cache/pypoetry/virtualenvs
E virtualenvs.prompt = "{project_name}-py{python_version}"
E virtualenvs.use-poetry-python = false
/tmp/cirrus-ci-build/tests/console/commands/test_config.py:352: AssertionError
Check failure on line 182 in tests/console/commands/test_config.py
cirrus-ci / Tests / FreeBSD (Python 3.11) / pytest
tests/console/commands/test_config.py#L182
tests.console.commands.test_config.test_unset_setting
Raw output
tester = <cleo.testers.command_tester.CommandTester object at 0x3bae38be0150>
config = <tests.conftest.Config object at 0x3bae38c58490>
config_cache_dir = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw0/test_unset_setting0/.cache/pypoetry')
config_data_dir = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw0/test_unset_setting0/.local/share/pypoetry')
def test_unset_setting(
tester: CommandTester, config: Config, config_cache_dir: Path, config_data_dir: Path
) -> None:
tester.execute("virtualenvs.path /some/path")
tester.execute("virtualenvs.path --unset")
tester.execute("--list")
cache_dir = json.dumps(str(config_cache_dir))
data_dir = json.dumps(str(config_data_dir))
venv_path = json.dumps(os.path.join("{cache-dir}", "virtualenvs"))
expected = f"""cache-dir = {cache_dir}
data-dir = {data_dir}
installer.max-workers = null
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = true
keyring.enabled = true
python.installation-dir = {json.dumps(str(Path("{data-dir}/python")))} # {config_data_dir / "python"}
requests.max-retries = 0
solver.lazy-wheel = true
system-git-client = false
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = {venv_path} # {config_cache_dir / "virtualenvs"}
virtualenvs.prompt = "{{project_name}}-py{{python_version}}"
virtualenvs.use-poetry-python = false
"""
assert config.set_config_source.call_count == 0 # type: ignore[attr-defined]
> assert tester.io.fetch_output() == expected
E assert 'cache-dir = ...hon = false\n' == 'cache-dir = ...hon = false\n'
E
E cache-dir = "/tmp/pytest-of-root/pytest-0/popen-gw0/test_unset_setting0/.cache/pypoetry"
E data-dir = "/tmp/pytest-of-root/pytest-0/popen-gw0/test_unset_setting0/.local/share/pypoetry"
E + default-group-optionality = false
E installer.max-workers = null
E installer.no-binary = null
E installer.only-binary = null
E installer.parallel = true
E installer.re-resolve = true
E keyring.enabled = true
E python.installation-dir = "{data-dir}/python" # /tmp/pytest-of-root/pytest-0/popen-gw0/test_unset_setting0/.local/share/pypoetry/python
E requests.max-retries = 0
E solver.lazy-wheel = true
E system-git-client = false
E virtualenvs.create = true
E virtualenvs.in-project = null
E virtualenvs.options.always-copy = false
E virtualenvs.options.no-pip = false
E virtualenvs.options.system-site-packages = false
E virtualenvs.path = "{cache-dir}/virtualenvs" # /tmp/pytest-of-root/pytest-0/popen-gw0/test_unset_setting0/.cache/pypoetry/virtualenvs
E virtualenvs.prompt = "{project_name}-py{python_version}"
E virtualenvs.use-poetry-python = false
/tmp/cirrus-ci-build/tests/console/commands/test_config.py:182: AssertionError
Check failure on line 395 in tests/console/commands/test_config.py
cirrus-ci / Tests / FreeBSD (Python 3.11) / pytest
tests/console/commands/test_config.py#L395
tests.console.commands.test_config.test_list_must_not_display_sources_from_pyproject_toml
Raw output
project_factory = <function project_factory.<locals>._factory at 0x307f125bd300>
fixture_dir = <function fixture_dir.<locals>._fixture_dir at 0x307f0e56c680>
command_tester_factory = <function command_tester_factory.<locals>._tester at 0x307f12616840>
config_cache_dir = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw1/test_list_must_not_display_sou0/.cache/pypoetry')
config_data_dir = PosixPath('/tmp/pytest-of-root/pytest-0/popen-gw1/test_list_must_not_display_sou0/.local/share/pypoetry')
def test_list_must_not_display_sources_from_pyproject_toml(
project_factory: ProjectFactory,
fixture_dir: FixtureDirGetter,
command_tester_factory: CommandTesterFactory,
config_cache_dir: Path,
config_data_dir: Path,
) -> None:
source = fixture_dir("with_primary_source_implicit")
pyproject_content = (source / "pyproject.toml").read_text(encoding="utf-8")
poetry = project_factory("foo", pyproject_content=pyproject_content)
tester = command_tester_factory("config", poetry=poetry)
tester.execute("--list")
cache_dir = json.dumps(str(config_cache_dir))
data_dir = json.dumps(str(config_data_dir))
venv_path = json.dumps(os.path.join("{cache-dir}", "virtualenvs"))
expected = f"""cache-dir = {cache_dir}
data-dir = {data_dir}
installer.max-workers = null
installer.no-binary = null
installer.only-binary = null
installer.parallel = true
installer.re-resolve = true
keyring.enabled = true
python.installation-dir = {json.dumps(str(Path("{data-dir}/python")))} # {config_data_dir / "python"}
repositories.foo.url = "https://foo.bar/simple/"
requests.max-retries = 0
solver.lazy-wheel = true
system-git-client = false
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = {venv_path} # {config_cache_dir / "virtualenvs"}
virtualenvs.prompt = "{{project_name}}-py{{python_version}}"
virtualenvs.use-poetry-python = false
"""
> assert tester.io.fetch_output() == expected
E assert 'cache-dir = ...hon = false\n' == 'cache-dir = ...hon = false\n'
E
E cache-dir = "/tmp/pytest-of-root/pytest-0/popen-gw1/test_list_must_not_display_sou0/.cache/pypoetry"
E data-dir = "/tmp/pytest-of-root/pytest-0/popen-gw1/test_list_must_not_display_sou0/.local/share/pypoetry"
E + default-group-optionality = false
E installer.max-workers = null
E installer.no-binary = null
E installer.only-binary = null
E installer.parallel = true
E installer.re-resolve = true
E keyring.enabled = true
E python.installation-dir = "{data-dir}/python" # /tmp/pytest-of-root/pytest-0/popen-gw1/test_list_must_not_display_sou0/.local/share/pypoetry/python
E repositories.foo.url = "https://foo.bar/simple/"
E requests.max-retries = 0
E solver.lazy-wheel = true
E system-git-client = false
E virtualenvs.create = true
E virtualenvs.in-project = null
E virtualenvs.options.always-copy = false
E virtualenvs.options.no-pip = false
E virtualenvs.options.system-site-packages = false
E virtualenvs.path = "{cache-dir}/virtualenvs" # /tmp/pytest-of-root/pytest-0/popen-gw1/test_list_must_not_display_sou0/.cache/pypoetry/virtualenvs
E virtualenvs.prompt = "{project_name}-py{python_version}"
E virtualenvs.use-poetry-python = false
/tmp/cirrus-ci-build/tests/console/commands/test_config.py:395: AssertionError