Skip to content
This repository was archived by the owner on Sep 1, 2024. It is now read-only.

Commit a31066e

Browse files
committed
Replace TestSuiteRunSummary with TestSuiteRunPendingSummary
1 parent 6d8b413 commit a31066e

File tree

4 files changed

+7
-44
lines changed

4 files changed

+7
-44
lines changed

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = pytest-unflakable
3-
version = 0.1.2
3+
version = 0.1.3
44
author = Unflakable
55
author_email = support@unflakable.com
66
maintainer = Unflakable

src/pytest_unflakable/_api.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,11 @@ class CreateTestSuiteRunRequest(TypedDict):
7070
test_runs: List[TestRunRecord]
7171

7272

73-
class TestSuiteRunSummary(TypedDict):
73+
class TestSuiteRunPendingSummary(TypedDict):
7474
run_id: str
7575
suite_id: str
7676
branch: NotRequired[Optional[str]]
7777
commit: NotRequired[Optional[str]]
78-
start_time: str
79-
end_time: str
80-
num_tests: int
81-
num_pass: int
82-
num_fail: int
83-
num_flake: int
84-
num_quarantined: int
8578

8679

8780
def create_test_suite_run(
@@ -91,7 +84,7 @@ def create_test_suite_run(
9184
base_url: Optional[str],
9285
insecure_disable_tls_validation: bool,
9386
logger: logging.Logger,
94-
) -> TestSuiteRunSummary:
87+
) -> TestSuiteRunPendingSummary:
9588
logger.debug(f'creating test suite run {pprint.pformat(request)}')
9689

9790
run_response = requests.post(
@@ -109,7 +102,7 @@ def create_test_suite_run(
109102
)
110103
run_response.raise_for_status()
111104

112-
summary: TestSuiteRunSummary = run_response.json()
105+
summary: TestSuiteRunPendingSummary = run_response.json()
113106
logger.debug(f'received response: {pprint.pformat(summary)}')
114107

115108
return summary

tests/common.py

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -229,29 +229,13 @@ def mock_run(
229229
def mock_create_test_suite_run_response(
230230
request: requests.Request,
231231
context: requests_mock.response._Context,
232-
) -> _api.TestSuiteRunSummary:
232+
) -> _api.TestSuiteRunPendingSummary:
233233
request_body: _api.CreateTestSuiteRunRequest = request.json()
234234
return {
235235
'run_id': MOCK_RUN_ID,
236236
'suite_id': MOCK_SUITE_ID,
237237
'branch': request_body.get('branch'),
238238
'commit': request_body.get('commit'),
239-
'start_time': request_body['start_time'],
240-
'end_time': request_body['end_time'],
241-
'num_tests': len(request_body['test_runs']),
242-
'num_pass': len(
243-
[run for run in request_body['test_runs'] if
244-
all([attempt['result'] == 'pass' for attempt in run['attempts']])]),
245-
'num_fail': len(
246-
[run for run in request_body['test_runs'] if
247-
all([attempt['result'] == 'fail' for attempt in run['attempts']])]),
248-
'num_flake': len(
249-
[run for run in request_body['test_runs'] if
250-
any([attempt['result'] == 'pass' for attempt in run['attempts']]) and any(
251-
[attempt['result'] == 'fail' for attempt in run['attempts']])]),
252-
'num_quarantined': len(
253-
[run for run in request_body['test_runs'] if
254-
all([attempt['result'] == 'quarantined' for attempt in run['attempts']])]),
255239
}
256240

257241

@@ -524,20 +508,6 @@ def run_test_case(
524508
create_test_suite_run_request.json()
525509
)
526510

527-
assert_regex(TIMESTAMP_REGEX, create_test_suite_run_body['start_time'])
528-
assert_regex(TIMESTAMP_REGEX, create_test_suite_run_body['end_time'])
529-
530-
actual_test_runs = {
531-
(test_run_record['filename'], tuple(test_run_record['name'])): [
532-
attempt['result'] for attempt in test_run_record['attempts']
533-
]
534-
for test_run_record in create_test_suite_run_body['test_runs']
535-
}
536-
assert actual_test_runs == expected_uploaded_test_runs
537-
538-
# Make sure there aren't any duplicate test keys.
539-
assert len(create_test_suite_run_body['test_runs']) == len(actual_test_runs)
540-
541511
if expected_commit is not None:
542512
assert create_test_suite_run_body['commit'] == expected_commit
543513
else:

tests/test_unflakable.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,8 +1216,8 @@ def test_pass():
12161216
expected_commit='CLI_COMMIT',
12171217
expect_xdist=xdist,
12181218
extra_args=[
1219-
'--branch', 'CLI_BRANCH', '--commit', 'CLI_COMMIT'
1220-
] + (XDIST_ARGS if xdist else []),
1219+
'--branch', 'CLI_BRANCH', '--commit', 'CLI_COMMIT'
1220+
] + (XDIST_ARGS if xdist else []),
12211221
)
12221222

12231223

0 commit comments

Comments
 (0)