@@ -70,74 +70,6 @@ def test_main_base_path(self):
7070 mock .call ("TOKEN" , False , False , "SRC" )
7171 ]
7272
73- def test_main_parallel_finished (self ):
74- argv = ["src/entrypoint.py" , "--github-token" , "TOKEN" , "--parallel-finished" ]
75- with patch_sys_argv (argv ), mock .patch (
76- "entrypoint.post_webhook"
77- ) as m_post_webhook :
78- entrypoint .main ()
79- assert m_post_webhook .call_args_list == [mock .call ("TOKEN" )]
80-
81- def test_try_main (self ):
82- with mock .patch (
83- "entrypoint.main" , side_effect = Exception
84- ) as m_main , pytest .raises (SystemExit ) as ex_info :
85- entrypoint .try_main ()
86- assert m_main .call_args_list == [mock .call ()]
87- assert ex_info .value .args == (entrypoint .ExitCode .FAILURE ,)
88-
89- def test_run_coveralls_github_token (self ):
90- """Simple case when Coveralls.wear() returns some results."""
91- url = "https://coveralls.io/jobs/1234"
92- with patch_coveralls_wear () as m_wear , patch_log () as m_log :
93- m_wear .return_value = {
94- "message" : "Job ##12.34" ,
95- "url" : url ,
96- }
97- entrypoint .run_coveralls (repo_token = "TOKEN" )
98- assert m_wear .call_args_list == [mock .call ()]
99- assert m_log .method_calls == [
100- mock .call .info ("Trying submitting coverage with service_name: github..." ),
101- mock .call .debug (
102- "Patching os.environ with: "
103- "{'COVERALLS_REPO_TOKEN': 'TOKEN', 'COVERALLS_PARALLEL': ''}"
104- ),
105- mock .call .debug (m_wear .return_value ),
106- mock .call .info (url ),
107- ]
108-
109- def test_run_coveralls_wear_error_once (self ):
110- """On Coveralls.wear() error we should try another `service_name`."""
111- url = "https://coveralls.io/jobs/1234"
112- side_effect = (
113- CoverallsException ("Error" ),
114- {"message" : "Job ##12.34" , "url" : url },
115- )
116- with patch_coveralls_wear () as m_wear , patch_log () as m_log :
117- m_wear .side_effect = side_effect
118- entrypoint .run_coveralls (repo_token = "TOKEN" )
119- assert m_wear .call_args_list == [mock .call (), mock .call ()]
120- assert m_log .method_calls == [
121- mock .call .info ("Trying submitting coverage with service_name: github..." ),
122- mock .call .debug (
123- "Patching os.environ with: "
124- "{'COVERALLS_REPO_TOKEN': 'TOKEN', 'COVERALLS_PARALLEL': ''}"
125- ),
126- mock .call .warning (
127- "Failed submitting coverage with service_name: github" ,
128- exc_info = side_effect [0 ],
129- ),
130- mock .call .info (
131- "Trying submitting coverage with service_name: github-actions..."
132- ),
133- mock .call .debug (
134- "Patching os.environ with: "
135- "{'COVERALLS_REPO_TOKEN': 'TOKEN', 'COVERALLS_PARALLEL': ''}"
136- ),
137- mock .call .debug (side_effect [1 ]),
138- mock .call .info (url ),
139- ]
140-
14173 def test_run_coveralls_wear_error_twice (self ):
14274 """Exits with error code if Coveralls.wear() fails twice."""
14375 side_effect = (
0 commit comments