-
Notifications
You must be signed in to change notification settings - Fork 6
Run plugin suite_finished handler before upload #82
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
Open
andmat900
wants to merge
4
commits into
eiffel-community:main
Choose a base branch
from
andmat900:20260330_fix_plugin_suite_finished_timing
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ef46fce
Run plugin suite_finished handler before upload
andmat900 69320f4
Change plugin handler log level to debug
andmat900 ade9634
Add comment explaining inner try/finally nesting
andmat900 70437f8
Refactor: extract method to reduce nesting, fix pylint
andmat900 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -245,30 +245,37 @@ def execute(self): # pylint:disable=too-many-branches,disable=too-many-statemen | |
| description = None | ||
| executed = False | ||
| test_framework_exit_codes = [] | ||
| outcome = None | ||
| try: | ||
| with Workspace(self.log_area) as workspace: | ||
| self.logger.info("Start IUT monitoring.") | ||
| self.iut_monitoring.start_monitoring() | ||
| self.logger.info("Starting test executor.") | ||
| result, test_framework_exit_codes = self.run_tests(workspace) | ||
| executed = True | ||
| self.logger.info("Stop IUT monitoring.") | ||
| self.iut_monitoring.stop_monitoring() | ||
| except Exception as exception: # pylint:disable=broad-except | ||
| result = False | ||
| executed = False | ||
| description = str(exception) | ||
| raise | ||
| try: | ||
| self.logger.info("Start IUT monitoring.") | ||
| self.iut_monitoring.start_monitoring() | ||
| self.logger.info("Starting test executor.") | ||
| result, test_framework_exit_codes = self.run_tests(workspace) | ||
| executed = True | ||
| self.logger.info("Stop IUT monitoring.") | ||
| self.iut_monitoring.stop_monitoring() | ||
| except Exception as exception: # pylint:disable=broad-except | ||
| result = False | ||
| executed = False | ||
| description = str(exception) | ||
| raise | ||
| finally: | ||
| if self.iut_monitoring.monitoring: | ||
| self.logger.info("Stop IUT monitoring.") | ||
| self.iut_monitoring.stop_monitoring() | ||
| self.logger.info("Figure out test outcome.") | ||
| outcome = self.outcome(result, executed, description, test_framework_exit_codes) | ||
| pprint(outcome) | ||
| self.logger.info("Call on_test_suite_finished plugin handlers.") | ||
|
||
| self._test_suite_finished(self.config.get("name"), outcome) | ||
| finally: | ||
| if self.iut_monitoring.monitoring: | ||
| self.logger.info("Stop IUT monitoring.") | ||
| self.iut_monitoring.stop_monitoring() | ||
| self.logger.info("Figure out test outcome.") | ||
| outcome = self.outcome(result, executed, description, test_framework_exit_codes) | ||
| pprint(outcome) | ||
|
|
||
| if outcome is None: | ||
| self.logger.info("Figure out test outcome.") | ||
| outcome = self.outcome(result, executed, description, test_framework_exit_codes) | ||
| pprint(outcome) | ||
| self.logger.info("Send test suite finished event.") | ||
| self._test_suite_finished(self.config.get("name"), outcome) | ||
| test_suite_finished = self.etos.events.send_test_suite_finished( | ||
| test_suite_started, | ||
| links={"CONTEXT": self.etos.config.get("context")}, | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why do we need another level of nesting?
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.
The inner
try/finallyis needed so thaton_test_suite_finishedand outcome computation run inside thewith Workspaceblock, beforeWorkspace.__exit__triggers artifact upload.Without the inner
try/finally, if tests raise an exception, thewithblock would exit immediately (uploading artifacts), and we'd never call the plugin handlers in time. The innerfinallyguarantees the plugin handlers run even on exception, but still before the workspace context manager cleans up and uploads.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.
Then I would rather we create a method. I dont like the sight-line with three levels of nesting
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.
Done.