diff --git a/setup.cfg b/setup.cfg index 2fc0675..614fc9a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = pytest-unflakable -version = 0.1.2 +version = 0.1.3 author = Unflakable author_email = support@unflakable.com maintainer = Unflakable diff --git a/src/pytest_unflakable/_api.py b/src/pytest_unflakable/_api.py index 3dfd222..7204f14 100644 --- a/src/pytest_unflakable/_api.py +++ b/src/pytest_unflakable/_api.py @@ -70,18 +70,11 @@ class CreateTestSuiteRunRequest(TypedDict): test_runs: List[TestRunRecord] -class TestSuiteRunSummary(TypedDict): +class TestSuiteRunPendingSummary(TypedDict): run_id: str suite_id: str branch: NotRequired[Optional[str]] commit: NotRequired[Optional[str]] - start_time: str - end_time: str - num_tests: int - num_pass: int - num_fail: int - num_flake: int - num_quarantined: int def create_test_suite_run( @@ -91,7 +84,7 @@ def create_test_suite_run( base_url: Optional[str], insecure_disable_tls_validation: bool, logger: logging.Logger, -) -> TestSuiteRunSummary: +) -> TestSuiteRunPendingSummary: logger.debug(f'creating test suite run {pprint.pformat(request)}') run_response = requests.post( @@ -109,7 +102,7 @@ def create_test_suite_run( ) run_response.raise_for_status() - summary: TestSuiteRunSummary = run_response.json() + summary: TestSuiteRunPendingSummary = run_response.json() logger.debug(f'received response: {pprint.pformat(summary)}') return summary diff --git a/tests/common.py b/tests/common.py index 9e98101..302c907 100644 --- a/tests/common.py +++ b/tests/common.py @@ -229,29 +229,13 @@ def mock_run( def mock_create_test_suite_run_response( request: requests.Request, context: requests_mock.response._Context, -) -> _api.TestSuiteRunSummary: +) -> _api.TestSuiteRunPendingSummary: request_body: _api.CreateTestSuiteRunRequest = request.json() return { 'run_id': MOCK_RUN_ID, 'suite_id': MOCK_SUITE_ID, 'branch': request_body.get('branch'), 'commit': request_body.get('commit'), - 'start_time': request_body['start_time'], - 'end_time': request_body['end_time'], - 'num_tests': len(request_body['test_runs']), - 'num_pass': len( - [run for run in request_body['test_runs'] if - all([attempt['result'] == 'pass' for attempt in run['attempts']])]), - 'num_fail': len( - [run for run in request_body['test_runs'] if - all([attempt['result'] == 'fail' for attempt in run['attempts']])]), - 'num_flake': len( - [run for run in request_body['test_runs'] if - any([attempt['result'] == 'pass' for attempt in run['attempts']]) and any( - [attempt['result'] == 'fail' for attempt in run['attempts']])]), - 'num_quarantined': len( - [run for run in request_body['test_runs'] if - all([attempt['result'] == 'quarantined' for attempt in run['attempts']])]), } @@ -524,20 +508,6 @@ def run_test_case( create_test_suite_run_request.json() ) - assert_regex(TIMESTAMP_REGEX, create_test_suite_run_body['start_time']) - assert_regex(TIMESTAMP_REGEX, create_test_suite_run_body['end_time']) - - actual_test_runs = { - (test_run_record['filename'], tuple(test_run_record['name'])): [ - attempt['result'] for attempt in test_run_record['attempts'] - ] - for test_run_record in create_test_suite_run_body['test_runs'] - } - assert actual_test_runs == expected_uploaded_test_runs - - # Make sure there aren't any duplicate test keys. - assert len(create_test_suite_run_body['test_runs']) == len(actual_test_runs) - if expected_commit is not None: assert create_test_suite_run_body['commit'] == expected_commit else: diff --git a/tests/test_unflakable.py b/tests/test_unflakable.py index 3ea9643..a30e9f2 100644 --- a/tests/test_unflakable.py +++ b/tests/test_unflakable.py @@ -1216,8 +1216,8 @@ def test_pass(): expected_commit='CLI_COMMIT', expect_xdist=xdist, extra_args=[ - '--branch', 'CLI_BRANCH', '--commit', 'CLI_COMMIT' - ] + (XDIST_ARGS if xdist else []), + '--branch', 'CLI_BRANCH', '--commit', 'CLI_COMMIT' + ] + (XDIST_ARGS if xdist else []), )