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

Add plumbing for legacy repository search and refactor repository fixtures #9132

Merged
merged 6 commits into from
Mar 17, 2024

Conversation

abn
Copy link
Member

@abn abn commented Mar 8, 2024

Add support for simple search in legacy repositories.

Relates-to: #2446

Remove unwanted stubbing of LegacyRepository.packages

This change removes a stubbing change added in 46ae4f5. This change was incorrect, as the base class already sets package list to an empty list.

The test case was also incorrect as it forced addition to internal package list.

This change introduces httpretty based mocking for tests using mocked legacy or pypi repositories. This also fixes various issues with tests incorrectly relying on remote versions for metadata and distributions instead of expected mocked versions. Additionally, we also auto enables PyPI repository mocking to ensure no external requests are made without explicit handling. Further, a new generate.py script has now been added to help regenerate existing repository json and distribution fixtures; or add/remove release versions to the fixtures.

These changes also lead to the fixing of an incorrect handling of sdist inspection.

@abn abn requested a review from a team March 8, 2024 17:31
@abn abn force-pushed the issue/2446 branch 2 times, most recently from 65ffc40 to 1a6a879 Compare March 8, 2024 21:53
@abn abn marked this pull request as draft March 8, 2024 22:05
@abn
Copy link
Member Author

abn commented Mar 9, 2024

Windows failures are likely due to path parsing and fixture look up. Will fix that later.

Issue was due to response for .metadata files being bytes.

@abn abn force-pushed the issue/2446 branch 2 times, most recently from 164b093 to 8853969 Compare March 12, 2024 22:01
@abn abn changed the title Support simple search for legacy repository Add plumbing for legacy repository search and refactor repository fixtures Mar 12, 2024
@abn abn marked this pull request as ready for review March 12, 2024 22:19
@abn abn force-pushed the issue/2446 branch 3 times, most recently from 8d778ba to f8a3eb7 Compare March 13, 2024 15:24
Secrus
Secrus previously requested changes Mar 14, 2024
src/poetry/repositories/legacy_repository.py Outdated Show resolved Hide resolved
tests/repositories/fixtures/pypi.org/generate.py Outdated Show resolved Hide resolved
tests/repositories/fixtures/pypi.org/generate.py Outdated Show resolved Hide resolved
tests/repositories/fixtures/pypi.org/generate.py Outdated Show resolved Hide resolved
tests/repositories/fixtures/pypi.org/generate.py Outdated Show resolved Hide resolved
tests/repositories/fixtures/pypi.org/generate.py Outdated Show resolved Hide resolved
tests/repositories/fixtures/pypi.org/generate.py Outdated Show resolved Hide resolved
tests/repositories/fixtures/pypi.org/generate.py Outdated Show resolved Hide resolved
abn added 6 commits March 17, 2024 21:07
This change removes a stubbing change added in 46ae4f5. This change
was incorrect, as the base class already sets package list to an
empty list.

The test case was also incorrect as it forced addition to internal
package list.
This change introduces httpretty based mocking for tests using
mocked legacy or pypi repositories. This also fixes various issues with
tests incorrectly relying on remote versions for metadata and
distributions instead of expected mocked versions.

Additionally, we also auto enables PyPI repository mocking to ensure no
external requests are made without explicit handling.

Further, a new `generate.py` script has now been added to help
regenerate existing repository json and distribution fixtures; or
add/remove release versions to the fixtures.
@abn abn merged commit 1b0caf5 into python-poetry:main Mar 17, 2024
20 checks passed
@abn abn deleted the issue/2446 branch March 17, 2024 21:51
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants