1
1
"""Tests of the VCS module."""
2
2
3
3
import logging
4
+ import shutil
4
5
import subprocess
5
6
from pathlib import Path
6
7
@@ -176,6 +177,7 @@ def test_hg_is_not_usable(tmp_path: Path) -> None:
176
177
assert not scm .Mercurial .is_usable ()
177
178
178
179
180
+ @pytest .mark .skipif (not shutil .which ("hg" ), reason = "Mercurial is not available." )
179
181
def test_hg_is_usable (hg_repo : Path ) -> None :
180
182
"""Should return false if it is not a mercurial repo."""
181
183
with inside_dir (hg_repo ):
@@ -185,8 +187,20 @@ def test_hg_is_usable(hg_repo: Path) -> None:
185
187
@pytest .mark .parametrize (
186
188
["repo" , "scm_command" , "scm_class" ],
187
189
[
188
- param ("git_repo" , "git" , scm .Git , id = "git" ),
189
- param ("hg_repo" , "hg" , scm .Mercurial , id = "hg" ),
190
+ param (
191
+ "git_repo" ,
192
+ "git" ,
193
+ scm .Git ,
194
+ id = "git" ,
195
+ marks = pytest .mark .skipif (not shutil .which ("git" ), reason = "Git is not available." ),
196
+ ),
197
+ param (
198
+ "hg_repo" ,
199
+ "hg" ,
200
+ scm .Mercurial ,
201
+ id = "hg" ,
202
+ marks = pytest .mark .skipif (not shutil .which ("hg" ), reason = "Mercurial is not available." ),
203
+ ),
190
204
],
191
205
)
192
206
def test_commit_and_tag_from_below_scm_root (repo : str , scm_command : str , scm_class : scm .SourceCodeManager , request ):
@@ -226,8 +240,20 @@ def test_commit_and_tag_from_below_scm_root(repo: str, scm_command: str, scm_cla
226
240
@pytest .mark .parametrize (
227
241
["repo" , "scm_command" , "scm_class" ],
228
242
[
229
- param ("git_repo" , "git" , scm .Git , id = "git" ),
230
- param ("hg_repo" , "hg" , scm .Mercurial , id = "hg" ),
243
+ param (
244
+ "git_repo" ,
245
+ "git" ,
246
+ scm .Git ,
247
+ id = "git" ,
248
+ marks = pytest .mark .skipif (not shutil .which ("git" ), reason = "Git is not available." ),
249
+ ),
250
+ param (
251
+ "hg_repo" ,
252
+ "hg" ,
253
+ scm .Mercurial ,
254
+ id = "hg" ,
255
+ marks = pytest .mark .skipif (not shutil .which ("hg" ), reason = "Mercurial is not available." ),
256
+ ),
231
257
],
232
258
)
233
259
@pytest .mark .parametrize (
0 commit comments