Skip to content
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

Add use_presto parameter to test_stats_by_project #121

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Changelog

## 3.4.5 - 2022-05-11
## 3.4.6 - 2022-05-11
- Add `use_presto` parameter to the `test_stats_by_project` operation.

## 3.4.5 - 2022-05-11
- Add `project_identifier` field to `Version` objects.

## 3.4.4 - 2022-03-31
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "evergreen.py"
version = "3.4.5"
version = "3.4.6"
description = "Python client for the Evergreen API"
authors = [
"Dev Prod DAG <[email protected]>",
Expand Down
4 changes: 4 additions & 0 deletions src/evergreen/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ def test_stats_by_project(
distros: Optional[List[str]] = None,
group_by: Optional[str] = None,
sort: Optional[str] = None,
use_presto: Optional[bool] = None,
) -> List[TestStats]:
"""
Get a patch by patch id.
Expand All @@ -580,6 +581,7 @@ def test_stats_by_project(
:param distros: Only include specified distros.
:param group_by: How to group results (test_task_variant, test_task, or test)
:param sort: How to sort results (earliest or latest).
:param use_presto: Use the presto data backend.
:return: Patch queried for.
"""
params: Dict[str, Any] = {
Expand All @@ -602,6 +604,8 @@ def test_stats_by_project(
params["group_by"] = group_by
if sort is not None:
params["sort"] = sort
if use_presto is not None:
params["use_presto"] = use_presto
url = self._create_url(f"/projects/{project_id}/test_stats")
test_stats_list = self._paginate(url, params)
return [TestStats(test_stat, self) for test_stat in test_stats_list] # type: ignore[arg-type]
Expand Down
4 changes: 3 additions & 1 deletion tests/evergreen/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,21 +343,23 @@ def test_test_stats_by_project(self, mocked_api):
url=expected_url, params=expected_params, timeout=None, data=None, method="GET"
)

def test_test_stats_by_project_with_requester(self, mocked_api):
def test_test_stats_by_project_with_requester_and_presto(self, mocked_api):
after_date = "2019-01-01"
before_date = "2019-02-01"
expected_url = mocked_api._create_url("/projects/project_id/test_stats")
expected_params = {
"after_date": after_date,
"before_date": before_date,
"requesters": "patch",
"use_presto": True,
}

mocked_api.test_stats_by_project(
"project_id",
from_iso_format(after_date),
from_iso_format(before_date),
requesters=Requester.PATCH_REQUEST,
use_presto=True,
)

mocked_api.session.request.assert_called_with(
Expand Down