@@ -148,49 +148,51 @@ end
148
148
149
149
# test local submission process (but only if we are in a git repo)
150
150
151
- LibGit2. with (LibGit2. GitRepoExt (pwd ())) do repo
152
-
153
- # default values
154
- codecov_url = extract_codecov_url ( () -> Coverage. Codecov. submit_local (fcs; dry_run = true ) )
155
- @test occursin (" codecov.io" , codecov_url)
156
- @test occursin (" commit" , codecov_url)
157
- @test occursin (" branch" , codecov_url)
158
- @test ! occursin (" service" , codecov_url)
159
-
160
- # env var url override
161
- withenv ( " CODECOV_URL" => " https://enterprise-codecov-1.com" ) do
151
+ _dotgit = joinpath (dirname (@__DIR__ ), " .git" )
162
152
153
+ if isdir (_dotgit) || isfile (_dotgit)
154
+ LibGit2. with (LibGit2. GitRepoExt (pwd ())) do repo
155
+ # default values
163
156
codecov_url = extract_codecov_url ( () -> Coverage. Codecov. submit_local (fcs; dry_run = true ) )
164
- @test occursin (" enterprise-codecov-1.com" , codecov_url)
165
- @test occursin (" commit" , codecov_url)
166
- @test occursin (" branch" , codecov_url)
167
- @test ! occursin (" service" , codecov_url)
168
-
169
- # function argument url override
170
- codecov_url = extract_codecov_url ( () -> Coverage. Codecov. submit_local (fcs; dry_run = true , codecov_url = " https://enterprise-codecov-2.com" ) )
171
- @test occursin (" enterprise-codecov-2.com" , codecov_url)
157
+ @test occursin (" codecov.io" , codecov_url)
172
158
@test occursin (" commit" , codecov_url)
173
159
@test occursin (" branch" , codecov_url)
174
160
@test ! occursin (" service" , codecov_url)
175
161
176
- # env var token
177
- withenv ( " CODECOV_TOKEN " => " token_name_1 " ) do
162
+ # env var url override
163
+ withenv ( " CODECOV_URL " => " https://enterprise-codecov-1.com " ) do
178
164
179
165
codecov_url = extract_codecov_url ( () -> Coverage. Codecov. submit_local (fcs; dry_run = true ) )
180
166
@test occursin (" enterprise-codecov-1.com" , codecov_url)
181
- @test occursin (" token=token_name_1" , codecov_url)
167
+ @test occursin (" commit" , codecov_url)
168
+ @test occursin (" branch" , codecov_url)
182
169
@test ! occursin (" service" , codecov_url)
183
170
184
- # function argument token url override
185
- codecov_url = extract_codecov_url ( () -> Coverage. Codecov. submit_local (fcs; dry_run = true , token= " token_name_2" ) )
186
- @test occursin (" enterprise-codecov-1.com" , codecov_url)
187
- @test occursin (" token=token_name_2" , codecov_url)
171
+ # function argument url override
172
+ codecov_url = extract_codecov_url ( () -> Coverage. Codecov. submit_local (fcs; dry_run = true , codecov_url = " https://enterprise-codecov-2.com" ) )
173
+ @test occursin (" enterprise-codecov-2.com" , codecov_url)
174
+ @test occursin (" commit" , codecov_url)
175
+ @test occursin (" branch" , codecov_url)
188
176
@test ! occursin (" service" , codecov_url)
177
+
178
+ # env var token
179
+ withenv ( " CODECOV_TOKEN" => " token_name_1" ) do
180
+
181
+ codecov_url = extract_codecov_url ( () -> Coverage. Codecov. submit_local (fcs; dry_run = true ) )
182
+ @test occursin (" enterprise-codecov-1.com" , codecov_url)
183
+ @test occursin (" token=token_name_1" , codecov_url)
184
+ @test ! occursin (" service" , codecov_url)
185
+
186
+ # function argument token url override
187
+ codecov_url = extract_codecov_url ( () -> Coverage. Codecov. submit_local (fcs; dry_run = true , token= " token_name_2" ) )
188
+ @test occursin (" enterprise-codecov-1.com" , codecov_url)
189
+ @test occursin (" token=token_name_2" , codecov_url)
190
+ @test ! occursin (" service" , codecov_url)
191
+ end
189
192
end
190
193
end
191
194
end
192
195
193
-
194
196
# test faulty non-CI submission
195
197
196
198
@test_throws ErrorException extract_codecov_url ( () -> Coverage. Codecov. submit (fcs; dry_run = true ) )
0 commit comments