File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -65,7 +65,13 @@ def _fetch_existing_tests(self) -> typing.List[str]:
6565
6666 response .raise_for_status ()
6767
68- return typing .cast (typing .List [str ], response .json ()["test_names" ])
68+ result = typing .cast (typing .List [str ], response .json ()["test_names" ])
69+ if len (result ) == 0 :
70+ raise RuntimeError (
71+ f"No existing tests found for '{ self .full_repository_name } ' repository on branch '{ self .branch_name } '" ,
72+ )
73+
74+ return result
6975
7076 def detect_from_report (self , report : _pytest .reports .TestReport ) -> bool :
7177 if report .when != "call" :
Original file line number Diff line number Diff line change @@ -72,6 +72,24 @@ def test_load_flaky_detection_error(monkeypatch: pytest.MonkeyPatch) -> None:
7272 assert "500 Server Error" in client .flaky_detector_error_message
7373
7474
75+ @responses .activate
76+ def test_load_flaky_detection_error_without_existing_tests (
77+ monkeypatch : pytest .MonkeyPatch ,
78+ ) -> None :
79+ _set_test_environment (monkeypatch )
80+
81+ _make_quarantine_mock ()
82+ _make_test_names_mock ([])
83+
84+ client = _make_test_client ()
85+ assert client .flaky_detector is None
86+ assert client .flaky_detector_error_message is not None
87+ assert (
88+ "No existing tests found for 'Mergifyio/pytest-mergify' repository on branch 'main'"
89+ in client .flaky_detector_error_message
90+ )
91+
92+
7593@responses .activate
7694def test_flaky_detection (
7795 monkeypatch : pytest .MonkeyPatch ,
You can’t perform that action at this time.
0 commit comments