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