-
Notifications
You must be signed in to change notification settings - Fork 9
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 mypy to parametric tests #3405
base: main
Are you sure you want to change the base?
Conversation
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.
Could do the fix only for utils/parametric and tests/parametric
@@ -102,6 +102,12 @@ allow_no_jira_ticket_for_bugs = [ | |||
"tests/parametric/test_config_consistency.py::Test_Config_TraceLogDirectory", | |||
] | |||
|
|||
[tool.mypy] | |||
files = ["utils/parametric", "tests/parametric"] |
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.
To perform a proper migration to this tools, could you revert any change that are not in those two folders ?
@@ -257,13 +261,14 @@ def _build_apm_test_server_image(self) -> str: | |||
check=False, | |||
) | |||
|
|||
failure_text: str = None | |||
failure_text: Optional[str] = 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.
This line can be removed, as the variable is used only in the if
block
@@ -205,7 +205,7 @@ def library(self): | |||
def weblog_variant(self): | |||
return f"parametric-{self.library.library}" | |||
|
|||
def _build_apm_test_server_image(self) -> str: | |||
def _build_apm_test_server_image(self) -> Optional[str]: |
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 I'm not wrong, this function always return None
if p.returncode != 0: | ||
log_file.seek(0) | ||
failure_text = "".join(log_file.readlines()) | ||
pytest.exit(f"Failed to build the container: {failure_text}", 1) | ||
|
||
logger.debug("Build tested container finished") | ||
return 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.
Does mypy requires to explicitly return None
?
@@ -77,8 +77,8 @@ class V06StatsAggr(TypedDict): | |||
TopLevelHits: int | |||
Duration: int | |||
Errors: int | |||
OkSummary: BaseDDSketch | |||
ErrorSummary: BaseDDSketch | |||
OkSummary: Optional[BaseDDSketch] |
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.
Is it needed ?
Motivation
Update the ./format.sh script to run static analysis checks on parametric tests (via mypy).
Changes
Updated mypy and fixed all errors. (as of now a lot of fixes are # type: ignore)
Workflow
codeowners
file quickly.🚀 Once your PR is reviewed, you can merge it!
🛟 #apm-shared-testing 🛟
Reviewer checklist
[<language>]
, double-check that only<language>
is impacted by the changebuild-XXX-image
label is present