Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_add_git_constraint_with_extras is flaky #9652

Closed
hrnciar opened this issue Aug 26, 2024 · 3 comments
Closed

test_add_git_constraint_with_extras is flaky #9652

hrnciar opened this issue Aug 26, 2024 · 3 comments
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Milestone

Comments

@hrnciar
Copy link
Contributor

hrnciar commented Aug 26, 2024

Description

When building poetry on Fedora rawhide we are experiencing a flakiness of test_add_git_constraint_with_extras.

Downstream report: https://bugzilla.redhat.com/show_bug.cgi?id=2301097

Workarounds

Building poetry multiple times usually gets the test pass.

Poetry Installation Method

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

Operating System

Fedora rawhide

Poetry Version

1.8.3

Poetry Configuration

~~~~
❯ poetry config --list
cache-dir = "/home/thrnciar/.cache/pypoetry"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs"  # /home/thrnciar/.cache/pypoetry/virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
~~~~

Python Sysconfig

No response

Example pyproject.toml

No response

Poetry Runtime Logs

~~~~
=================================== FAILURES ===================================
___________________ test_add_git_constraint_with_extras[foo] ___________________
[gw0] linux -- Python 3.13.0 /usr/bin/python3

app = <tests.helpers.PoetryTestApplication object at 0x7f8a1a540c00>
repo = <tests.helpers.TestRepository object at 0x7f8a1ace0c50>
tester = <cleo.testers.command_tester.CommandTester object at 0x7f8a0870da20>
tmp_venv = VirtualEnv("/tmp/pytest-of-mockbuild/pytest-0/popen-gw0/test_add_git_constraint_with_e0/venv")
extra_name = 'foo'

    @pytest.mark.parametrize("extra_name", ["foo", "FOO"])
    def test_add_git_constraint_with_extras(
        app: PoetryTestApplication,
        repo: TestRepository,
        tester: CommandTester,
        tmp_venv: VirtualEnv,
        extra_name: str,
    ) -> None:
        assert isinstance(tester.command, InstallerCommand)
        tester.command.set_env(tmp_venv)
    
        repo.add_package(get_package("pendulum", "1.4.4"))
        repo.add_package(get_package("cleo", "0.6.5"))
        repo.add_package(get_package("tomlkit", "0.5.5"))
    
        tester.execute(f"git+https://github.com/demo/demo.git[{extra_name},bar]")
    
        expected = """\
    
    Updating dependencies
    Resolving dependencies...
    
    Package operations: 4 installs, 0 updates, 0 removals
    
      - Installing cleo (0.6.5)
      - Installing pendulum (1.4.4)
      - Installing tomlkit (0.5.5)
      - Installing demo (0.1.2 9cf87a2)
    
    Writing lock file
    """
    
>       assert tester.io.fetch_output().strip() == expected.strip()
E       AssertionError: assert 'Updating dep...ing lock file' == 'Updating dep...ing lock file'
E         
E         Skipping 137 identical leading characters in diff, use -v to show
E         Skipping 47 identical trailing characters in diff, use -v to show
E         + nstalling tomlkit (0.5.5)
E         - nstalling pendulum (1.4.4)
E         +   - Installing pendulum (1.4.4)
E         ? +++++
E         -   - Installing tomlkit (0.5.5)
E             - Ins

tests/console/commands/test_add.py:414: AssertionError
___________________ test_add_git_constraint_with_extras[FOO] ___________________
[gw0] linux -- Python 3.13.0 /usr/bin/python3

app = <tests.helpers.PoetryTestApplication object at 0x7f8a1adc3ce0>
repo = <tests.helpers.TestRepository object at 0x7f8a087381d0>
tester = <cleo.testers.command_tester.CommandTester object at 0x7f8a19ca6cf0>
tmp_venv = VirtualEnv("/tmp/pytest-of-mockbuild/pytest-0/popen-gw0/test_add_git_constraint_with_e1/venv")
extra_name = 'FOO'

    @pytest.mark.parametrize("extra_name", ["foo", "FOO"])
    def test_add_git_constraint_with_extras(
        app: PoetryTestApplication,
        repo: TestRepository,
        tester: CommandTester,
        tmp_venv: VirtualEnv,
        extra_name: str,
    ) -> None:
        assert isinstance(tester.command, InstallerCommand)
        tester.command.set_env(tmp_venv)
    
        repo.add_package(get_package("pendulum", "1.4.4"))
        repo.add_package(get_package("cleo", "0.6.5"))
        repo.add_package(get_package("tomlkit", "0.5.5"))
    
        tester.execute(f"git+https://github.com/demo/demo.git[{extra_name},bar]")
    
        expected = """\
    
    Updating dependencies
    Resolving dependencies...
    
    Package operations: 4 installs, 0 updates, 0 removals
    
      - Installing cleo (0.6.5)
      - Installing pendulum (1.4.4)
      - Installing tomlkit (0.5.5)
      - Installing demo (0.1.2 9cf87a2)
    
    Writing lock file
    """
    
>       assert tester.io.fetch_output().strip() == expected.strip()
E       AssertionError: assert 'Updating dep...ing lock file' == 'Updating dep...ing lock file'
E         
E         Skipping 137 identical leading characters in diff, use -v to show
E         Skipping 47 identical trailing characters in diff, use -v to show
E         + nstalling tomlkit (0.5.5)
E         - nstalling pendulum (1.4.4)
E         +   - Installing pendulum (1.4.4)
E         ? +++++
E         -   - Installing tomlkit (0.5.5)
E             - Ins

tests/console/commands/test_add.py:414: AssertionError
=============================== warnings summary ===============================
tests/console/commands/test_publish.py: 6 warnings
tests/inspection/test_lazy_wheel.py: 101 warnings
tests/console/commands/test_search.py: 1 warning
tests/installation/test_chef.py: 4 warnings
tests/installation/test_chooser.py: 27 warnings
tests/installation/test_executor.py: 28 warnings
tests/publishing/test_uploader.py: 23 warnings
tests/repositories/test_legacy_repository.py: 13 warnings
tests/utils/test_authenticator.py: 73 warnings
tests/utils/test_helpers.py: 5 warnings
  /usr/lib/python3.13/site-packages/httpretty/core.py:1077: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).
    now = datetime.utcnow()

tests/utils/test_authenticator.py::test_authenticator_falls_back_to_keyring_url
  /builddir/build/BUILD/poetry-1.8.3-build/poetry-1.8.3/tests/utils/test_authenticator.py:197: DeprecationWarning: Empty usernames are deprecated. See #668
    dummy_keyring.set_password(

tests/utils/test_authenticator.py::test_authenticator_falls_back_to_keyring_netloc
  /builddir/build/BUILD/poetry-1.8.3-build/poetry-1.8.3/tests/utils/test_authenticator.py:223: DeprecationWarning: Empty usernames are deprecated. See #668
    dummy_keyring.set_password("foo.bar", None, SimpleCredential("foo", "bar"))

tests/utils/test_authenticator.py::test_authenticator_falls_back_to_keyring_url_matched_by_path
  /builddir/build/BUILD/poetry-1.8.3-build/poetry-1.8.3/tests/utils/test_authenticator.py:486: DeprecationWarning: Empty usernames are deprecated. See #668
    dummy_keyring.set_password(

tests/utils/test_authenticator.py::test_authenticator_falls_back_to_keyring_url_matched_by_path
  /builddir/build/BUILD/poetry-1.8.3-build/poetry-1.8.3/tests/utils/test_authenticator.py:489: DeprecationWarning: Empty usernames are deprecated. See #668
    dummy_keyring.set_password(

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED tests/console/commands/test_add.py::test_add_git_constraint_with_extras[foo]
FAILED tests/console/commands/test_add.py::test_add_git_constraint_with_extras[FOO]
=========== 2 failed, 1609 passed, 6 skipped, 285 warnings in 48.09s ===========
~~~~
@hrnciar hrnciar added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Aug 26, 2024
@Secrus
Copy link
Member

Secrus commented Aug 26, 2024

It looks like something in Python 3.13 is different, cause we have similar errors in #9523

@dimbleby
Copy link
Contributor

cf #9523

Seems like something has changed at python 3.13, but in poetry's own pipeline only macos seems affected.

I'm in no position - and not terribly interested - to reproduce, but if you figure out what is going on then probably that would be a useful contribution.

@Secrus Secrus added this to the Poetry 2.0 milestone Oct 6, 2024
@Secrus
Copy link
Member

Secrus commented Oct 18, 2024

Resolved in #9523

@Secrus Secrus closed this as completed Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

5 participants
@dimbleby @hrnciar @Secrus and others