-
Notifications
You must be signed in to change notification settings - Fork 39
Adding bootstrap --test-mode #865
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
Adding bootstrap --test-mode #865
Conversation
197a919 to
539fe7c
Compare
4b69da3 to
6b2e255
Compare
905415a to
72ba5d2
Compare
6bd4206 to
103d280
Compare
c3b9057 to
2fb2f20
Compare
1897d2d to
5685b4d
Compare
Add test mode that continues processing after build failures instead of failing fast. Useful for testing build configurations across many packages. When enabled: - Catches any exception during bootstrap - Logs the error with full traceback - Records the failed package name - Continues to the next package - Exits non-zero at completion if any failures Closes python-wheel-build#713 Co-Authored-By: Claude <[email protected]> Signed-off-by: Lalatendu Mohanty <[email protected]>
5685b4d to
9726e2a
Compare
a01c677 to
0c2fe3f
Compare
Store failure details (package, version, exception info) and write test-mode-failures.json to work directory for post-analysis. Co-Authored-By: Claude <[email protected]> Signed-off-by: Lalatendu Mohanty <[email protected]>
1d40126 to
182adca
Compare
Added type-safe failure categorization for --test-mode. Hook and dependency extraction failures are now logged as warnings and allow processing to continue, while resolution and bootstrap failures remain fatal to the package. Co-Authored-By: Claude <[email protected]> Signed-off-by: Lalatendu Mohanty <[email protected]>
182adca to
9f960b1
Compare
dhellmann
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a few suggestions for cleanup, but I think this is ready to merge.
|
|
||
|
|
||
| @pytest.fixture | ||
| def mock_context() -> typing.Generator[context.WorkContext, None, None]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's already a fixture for making a temporary context. It's configured with some pytest magic so that if you name an argument to a test method tmp_context you get a context in a temporary directory that is also managed by pytest. https://github.com/python-wheel-build/fromager/blob/main/tests/conftest.py#L24
We can clean that up in a follow-up, though, so you can keep moving forward with this.
| except Exception as err: | ||
| if not self.test_mode: | ||
| raise | ||
| # Get version from cache if available |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We wouldn't need this logic if we move the resolution step out of _bootstrap_impl into this function where we can see whether it resolved in the first place. Let's do that in another PR.
| # we're given. | ||
| self.why.append((req_type, req, resolved_version)) | ||
| # Track dependency chain for error messages - context manager ensures cleanup | ||
| with self._track_why(req_type, req, resolved_version): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we move the resolution logic up into bootstrap then this context manager can also move there because we will have the resolved version.
| wheel_filename = None | ||
| sdist_filename = self._build_sdist( | ||
| req, resolved_version, sdist_root_dir, build_env | ||
| def _handle_test_mode_failure( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we add a force_prebuilt flag to _bootstrap_impl then we wouldn't need this function and we could avoid some duplication of the logic for handling pre-built wheels. Let's consider that in a follow-up PR.
--test-mode enables resilient bootstrap processing that continues building packages even when individual builds fail, instead of stopping at the first error.
When a package fails to build from source, it attempts to download a pre-built wheel as a fallback, and if both fail, records the failure and continues processing remaining packages.
At the end, it generates JSON reports containing all failure details. The files go to work_dir/ like other outputs.
Closes #713