-
Notifications
You must be signed in to change notification settings - Fork 30
[uss_qualifier/reports] Typing fixes #1385
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -357,12 +357,13 @@ def queries(self) -> list[fetch.Query]: | |||||||
| for case in self.cases: | ||||||||
| for step in case.steps: | ||||||||
| if step.has_field_with_value("queries"): | ||||||||
| assert step.queries | ||||||||
|
Comment on lines
359
to
+360
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we have to repeat ourselves here any way for the benefit of basedpyright, it seems like
Suggested change
I think this will probably apply most places we currently use |
||||||||
| queries.extend(step.queries) | ||||||||
|
|
||||||||
| if self.has_field_with_value("cleanup") and self.cleanup.has_field_with_value( | ||||||||
| if self.has_field_with_value("cleanup") and self.cleanup.has_field_with_value( # pyright: ignore[reportOptionalMemberAccess] | ||||||||
| "queries" | ||||||||
| ): | ||||||||
| queries.extend(self.cleanup.queries) | ||||||||
| queries.extend(self.cleanup.queries) # pyright: ignore[reportOptionalMemberAccess,reportArgumentType] | ||||||||
|
|
||||||||
| return queries | ||||||||
|
|
||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -31,8 +31,6 @@ | |||||||
| from monitoring.uss_qualifier.reports.sequence_view.summary_types import ( | ||||||||
| ActionNode, | ||||||||
| ActionNodeType, | ||||||||
| EpochType, | ||||||||
| EventType, | ||||||||
| Indexer, | ||||||||
| OverviewRow, | ||||||||
| SkippedAction, | ||||||||
|
|
@@ -51,6 +49,7 @@ | |||||||
|
|
||||||||
| def _skipped_action_of(report: SkippedActionReport) -> ActionNode: | ||||||||
| if report.declaration.get_action_type() == ActionType.TestSuite: | ||||||||
| assert report.declaration.test_suite | ||||||||
|
Comment on lines
51
to
+52
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think these follow the oneof pattern so I think we want to inspect the fields directly rather than switch on the type property accessor (same comment for similar assertions below)
Suggested change
|
||||||||
| if ( | ||||||||
| "suite_type" in report.declaration.test_suite | ||||||||
| and report.declaration.test_suite.suite_type | ||||||||
|
|
@@ -76,6 +75,7 @@ def _skipped_action_of(report: SkippedActionReport) -> ActionNode: | |||||||
| ) | ||||||||
| name = "All actions in test suite" | ||||||||
| elif report.declaration.get_action_type() == ActionType.TestScenario: | ||||||||
| assert report.declaration.test_scenario | ||||||||
| docs = get_documentation_by_name(report.declaration.test_scenario.scenario_type) | ||||||||
| return ActionNode( | ||||||||
| name=docs.name, | ||||||||
|
|
@@ -84,6 +84,7 @@ def _skipped_action_of(report: SkippedActionReport) -> ActionNode: | |||||||
| skipped_action=SkippedAction(reason=report.reason), | ||||||||
| ) | ||||||||
| elif report.declaration.get_action_type() == ActionType.ActionGenerator: | ||||||||
| assert report.declaration.action_generator | ||||||||
| generator_type = action_generator_type_from_name( | ||||||||
| report.declaration.action_generator.generator_type | ||||||||
| ) | ||||||||
|
|
@@ -123,20 +124,23 @@ def compute_action_node(report: TestSuiteActionReport, indexer: Indexer) -> Acti | |||||||
| is_action_generator, | ||||||||
| ) = report.get_applicable_report() | ||||||||
| if is_test_scenario: | ||||||||
| assert report.test_scenario | ||||||||
| return ActionNode( | ||||||||
| name=report.test_scenario.name, | ||||||||
| node_type=ActionNodeType.Scenario, | ||||||||
| children=[], | ||||||||
| scenario=compute_tested_scenario(report.test_scenario, indexer), | ||||||||
| ) | ||||||||
| elif is_test_suite: | ||||||||
| assert report.test_suite | ||||||||
| children = [compute_action_node(a, indexer) for a in report.test_suite.actions] | ||||||||
| return ActionNode( | ||||||||
| name=report.test_suite.name, | ||||||||
| node_type=ActionNodeType.Suite, | ||||||||
| children=children, | ||||||||
| ) | ||||||||
| elif is_action_generator: | ||||||||
| assert report.action_generator | ||||||||
| generator_type = action_generator_type_from_name( | ||||||||
| report.action_generator.generator_type | ||||||||
| ) | ||||||||
|
|
@@ -148,6 +152,7 @@ def compute_action_node(report: TestSuiteActionReport, indexer: Indexer) -> Acti | |||||||
| ], | ||||||||
| ) | ||||||||
| else: | ||||||||
| assert report.skipped_action | ||||||||
| return _skipped_action_of(report.skipped_action) | ||||||||
|
|
||||||||
|
|
||||||||
|
|
@@ -177,9 +182,13 @@ def _align_overview_rows(rows: list[OverviewRow]) -> None: | |||||||
| row.filled = True | ||||||||
| to_fill -= 1 | ||||||||
| elif len(row.suite_cells) < max_suite_cols: | ||||||||
| if row.suite_cells[-1].first_row and all( | ||||||||
| c.node_type == ActionNodeType.Scenario | ||||||||
| for c in row.suite_cells[-1].node.children | ||||||||
| if ( | ||||||||
| row.suite_cells[-1].first_row | ||||||||
| and row.suite_cells[-1].node is not None | ||||||||
| and all( | ||||||||
| c.node_type == ActionNodeType.Scenario | ||||||||
| for c in row.suite_cells[-1].node.children | ||||||||
| ) | ||||||||
| ): | ||||||||
| row.suite_cells[-1].colspan += max_suite_cols - len(row.suite_cells) | ||||||||
| row.filled = True | ||||||||
|
|
@@ -212,6 +221,7 @@ def _align_overview_rows(rows: list[OverviewRow]) -> None: | |||||||
|
|
||||||||
| def _enumerate_all_participants(node: ActionNode) -> list[ParticipantID]: | ||||||||
| if node.node_type == ActionNodeType.Scenario: | ||||||||
| assert node.scenario | ||||||||
| return list(node.scenario.participants) | ||||||||
| else: | ||||||||
| result = set() | ||||||||
|
|
@@ -225,6 +235,7 @@ def _generate_scenario_pages( | |||||||
| node: ActionNode, config: SequenceViewConfiguration, output_path: str | ||||||||
| ) -> None: | ||||||||
| if node.node_type == ActionNodeType.Scenario: | ||||||||
| assert node.scenario | ||||||||
| all_participants = list(node.scenario.participants) | ||||||||
| all_participants.sort() | ||||||||
| if UNATTRIBUTED_PARTICIPANT in all_participants: | ||||||||
|
|
@@ -241,8 +252,6 @@ def _generate_scenario_pages( | |||||||
| test_scenario=node.scenario, | ||||||||
| all_participants=all_participants, | ||||||||
| kml_file=kml_file if config.render_kml else None, | ||||||||
| EpochType=EpochType, | ||||||||
| EventType=EventType, | ||||||||
| UNATTRIBUTED_PARTICIPANT=UNATTRIBUTED_PARTICIPANT, | ||||||||
| len=len, | ||||||||
| str=str, | ||||||||
|
|
@@ -308,6 +317,7 @@ def generate_sequence_view( | |||||||
| ) -> None: | ||||||||
| node = compute_action_node(report.report, Indexer()) | ||||||||
|
|
||||||||
| assert report.configuration.v1 and report.configuration.v1.test_run | ||||||||
| resources_config = make_resources_config(report.configuration.v1.test_run) | ||||||||
|
|
||||||||
| os.makedirs(output_path, exist_ok=True) | ||||||||
|
|
||||||||
Uh oh!
There was an error while loading. Please reload this page.