Skip to content

Conversation

@LalatenduMohanty
Copy link
Member

Contains following commits

  • refactor(bootstrapper): move resolution and tracking to bootstrap()
  • refactor(tests): use existing tmp_context fixture in test-mode tests

Followup clean ups suggested by @dhellmann during review of #865 . There is one more cleanup but it will be larger refactor, so planning to send another PR for that.

@LalatenduMohanty LalatenduMohanty requested a review from a team as a code owner December 19, 2025 14:52
@LalatenduMohanty LalatenduMohanty changed the title Test mode cleanup 1 Test mode post merge cleanups Dec 19, 2025
@mergify mergify bot added the ci label Dec 19, 2025
Replace custom mock_context fixture with the shared tmp_context fixture
from conftest.py, using a real WorkContext instead of a mock.

Closes python-wheel-build#892

Co-Authored-By: Claude <claude@anthropic.com>

Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
@LalatenduMohanty LalatenduMohanty force-pushed the test-mode-cleanup-1 branch 3 times, most recently from 1c5640d to 1dafd38 Compare December 19, 2025 18:25
else:
version = None
self._record_test_mode_failure(req, version, err, "bootstrap")
logger.info(f"bootstrapping {req} as {req_type} dependency of {self.why[-1:]}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The resolver logic needs to be inside the try/except, since it is still a common source of failures.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good suggestion. Will fix it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it in 400544a

req_type
)

# Avoid cyclic dependencies and redundant processing.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this logic could move to bootstrap too? Then this internal function becomes the "actually do the bootstrap" function and the outer one is managing the setup and error handling.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dhellmann Do you mean the code for cyclic dependencies and redundant processing logic should move from _bootstrap_impl to bootstrap() ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed this in a separate commit in bbad8fa

Move resolve_version() and _track_why context manager from _bootstrap_impl
to bootstrap() for cleaner exception handling and direct access to
resolved_version without cache lookup.

Co-Authored-By: Claude <claude@anthropic.com>

Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
…strap()

Cleaner separation: bootstrap() handles setup/validation/error-handling,
_bootstrap_impl() performs only the actual build work.

Co-Authored-By: Claude <claude@anthropic.com>

Signed-off-by: Lalatendu Mohanty <lmohanty@redhat.com>
Copy link
Member

@dhellmann dhellmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add an e2e test for something where bootstrapping fails, too.

@mergify mergify bot merged commit c9097d6 into python-wheel-build:main Dec 19, 2025
31 checks passed
@LalatenduMohanty
Copy link
Member Author

LalatenduMohanty commented Dec 19, 2025

We should add an e2e test for something where bootstrapping fails, too.

@dhellmann I have created #895 to track the e2e test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants