Skip to content

upgrade extremely useful (and easy to miss) warning to an error

Cirrus CI / Tests / FreeBSD / PYTHON:python3.11 failed Dec 13, 2023 in 2m 29s

Task Summary

Instruction install_and_test failed in 01:29

Details

✅ 00:03 clone
✅ 00:25 install_prereqs
✅ 00:28 install_poetry
❌ 01:29 install_and_test

                    raise ValueError(f"Extra [{extra}] is not specified.")
    
            self._io.write_line("<info>Updating dependencies</>")
            solver = Solver(
                self._package,
                self._pool,
                self._installed_repository.packages,
                locked_repository.packages,
                self._io,
            )
    
            with solver.provider.use_source_root(
                source_root=self._env.path.joinpath("src")
            ):
                ops = solver.solve(use_latest=self._whitelist).calculate_operations()
        else:
            self._io.write_line("<info>Installing dependencies from lock file</>")
    
            locked_repository = self._locker.locked_repository()
    
            if not self._locker.is_fresh():
>               raise ValueError(
                    "poetry.lock is not consistent with pyproject.toml. "
                    "Run `poetry lock [--no-update]` to fix it."
                )
E               ValueError: poetry.lock is not consistent with pyproject.toml. Run `poetry lock [--no-update]` to fix it.

src/poetry/installation/installer.py:248: ValueError

During handling of the above exception, another exception occurred:

installer = <poetry.installation.installer.Installer object at 0x8093d4b90>
locker = <tests.installation.test_installer.Locker object at 0x80519b450>

    def test_not_fresh_lock(installer: Installer, locker: Locker) -> None:
        locker.locked().fresh(False)
>       with pytest.raises(
            ValueError,
            match=re.escape(
                "poetry.lock is not consistent with pyproject.toml. You may"
                " be getting improper dependencies. Run `poetry lock [--no-update]` to fix"
                " it."
            ),
        ):
E       AssertionError: Regex pattern did not match.
E        Regex: 'poetry\\.lock\\ is\\ not\\ consistent\\ with\\ pyproject\\.toml\\.\\ You\\ may\\ be\\ getting\\ improper\\ dependencies\\.\\ Run\\ `poetry\\ lock\\ \\[\\-\\-no\\-update\\]`\\ to\\ fix\\ it\\.'
E        Input: 'poetry.lock is not consistent with pyproject.toml. Run `poetry lock [--no-update]` to fix it.'

tests/installation/test_installer.py:220: AssertionError
-------------- generated xml file: /tmp/cirrus-ci-build/junit.xml --------------
=========================== short test summary info ============================
FAILED tests/installation/test_installer.py::test_not_fresh_lock - AssertionError: Regex pattern did not match.
 Regex: 'poetry\\.lock\\ is\\ not\\ consistent\\ with\\ pyproject\\.toml\\.\\ You\\ may\\ be\\ getting\\ improper\\ dependencies\\.\\ Run\\ `poetry\\ lock\\ \\[\\-\\-no\\-update\\]`\\ to\\ fix\\ it\\.'
 Input: 'poetry.lock is not consistent with pyproject.toml. Run `poetry lock [--no-update]` to fix it.'
============ 1 failed, 1452 passed, 10 skipped in 75.19s (0:01:15) =============
������������������������������������������������������������������������������������������������������������������

Annotations

Check failure on line 228 in tests/installation/test_installer.py

See this annotation in the file changed.

@cirrus-ci cirrus-ci / Tests / FreeBSD / PYTHON:python3.11

tests/installation/test_installer.py#L228

tests.installation.test_installer.test_not_fresh_lock
Raw output
installer = <poetry.installation.installer.Installer object at 0x8093d4b90>
locker = <tests.installation.test_installer.Locker object at 0x80519b450>

    def test_not_fresh_lock(installer: Installer, locker: Locker) -> None:
        locker.locked().fresh(False)
        with pytest.raises(
            ValueError,
            match=re.escape(
                "poetry.lock is not consistent with pyproject.toml. You may"
                " be getting improper dependencies. Run `poetry lock [--no-update]` to fix"
                " it."
            ),
        ):
>           installer.run()

tests/installation/test_installer.py:228: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/poetry/installation/installer.py:104: in run
    return self._do_install()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <poetry.installation.installer.Installer object at 0x8093d4b90>

    def _do_install(self) -> int:
        from poetry.puzzle.solver import Solver
    
        locked_repository = Repository("poetry-locked")
        if self._update:
            if not self._lock and self._locker.is_locked():
                locked_repository = self._locker.locked_repository()
    
                # If no packages have been whitelisted (The ones we want to update),
                # we whitelist every package in the lock file.
                if not self._whitelist:
                    for pkg in locked_repository.packages:
                        self._whitelist.append(pkg.name)
    
            # Checking extras
            for extra in self._extras:
                if extra not in self._package.extras:
                    raise ValueError(f"Extra [{extra}] is not specified.")
    
            self._io.write_line("<info>Updating dependencies</>")
            solver = Solver(
                self._package,
                self._pool,
                self._installed_repository.packages,
                locked_repository.packages,
                self._io,
            )
    
            with solver.provider.use_source_root(
                source_root=self._env.path.joinpath("src")
            ):
                ops = solver.solve(use_latest=self._whitelist).calculate_operations()
        else:
            self._io.write_line("<info>Installing dependencies from lock file</>")
    
            locked_repository = self._locker.locked_repository()
    
            if not self._locker.is_fresh():
>               raise ValueError(
                    "poetry.lock is not consistent with pyproject.toml. "
                    "Run `poetry lock [--no-update]` to fix it."
                )
E               ValueError: poetry.lock is not consistent with pyproject.toml. Run `poetry lock [--no-update]` to fix it.

src/poetry/installation/installer.py:248: ValueError

During handling of the above exception, another exception occurred:

installer = <poetry.installation.installer.Installer object at 0x8093d4b90>
locker = <tests.installation.test_installer.Locker object at 0x80519b450>

    def test_not_fresh_lock(installer: Installer, locker: Locker) -> None:
        locker.locked().fresh(False)
>       with pytest.raises(
            ValueError,
            match=re.escape(
                "poetry.lock is not consistent with pyproject.toml. You may"
                " be getting improper dependencies. Run `poetry lock [--no-update]` to fix"
                " it."
            ),
        ):
E       AssertionError: Regex pattern did not match.
E        Regex: 'poetry\\.lock\\ is\\ not\\ consistent\\ with\\ pyproject\\.toml\\.\\ You\\ may\\ be\\ getting\\ improper\\ dependencies\\.\\ Run\\ `poetry\\ lock\\ \\[\\-\\-no\\-update\\]`\\ to\\ fix\\ it\\.'
E        Input: 'poetry.lock is not consistent with pyproject.toml. Run `poetry lock [--no-update]` to fix it.'

tests/installation/test_installer.py:220: AssertionError