33
33
from mockito import verify , patch , spy2 , mock , ANY , when
34
34
35
35
import opengrok_tools .mirror
36
+ from conftest import posix_only , system_binary
36
37
from opengrok_tools .scm import Repository
37
38
from opengrok_tools .scm .git import GitRepository
38
39
from opengrok_tools .scm .repository import RepositoryException
@@ -94,7 +95,7 @@ def test_invalid_project_config_hooknames():
94
95
assert not check_project_configuration (config , hookdir = tmpdir )
95
96
96
97
97
- @pytest . mark . skipif ( not os . name . startswith ( "posix" ), reason = "requires posix" )
98
+ @posix_only
98
99
def test_invalid_project_config_nonexec_hook ():
99
100
with tempfile .TemporaryDirectory () as tmpdir :
100
101
with open (os .path .join (tmpdir , "foo.sh" ), 'w+' ) as tmpfile :
@@ -103,7 +104,7 @@ def test_invalid_project_config_nonexec_hook():
103
104
assert not check_project_configuration (config , hookdir = tmpdir )
104
105
105
106
106
- @pytest . mark . skipif ( not os . name . startswith ( "posix" ), reason = "requires posix" )
107
+ @posix_only
107
108
def test_valid_project_config_hook ():
108
109
with tempfile .TemporaryDirectory () as tmpdir :
109
110
with open (os .path .join (tmpdir , "foo.sh" ), 'w+' ) as tmpfile :
@@ -359,6 +360,7 @@ def test_mirroring_custom_repository_command(expected_command, config):
359
360
assert expected_command == Repository ._repository_command (config , lambda : DEFAULT_COMMAND )
360
361
361
362
363
+ @system_binary ('touch' )
362
364
def test_mirroring_custom_incoming_invoke_command (touch_binary ):
363
365
checking_file = 'incoming.txt'
364
366
with tempfile .TemporaryDirectory () as repository_root :
@@ -369,6 +371,7 @@ def test_mirroring_custom_incoming_invoke_command(touch_binary):
369
371
assert checking_file in os .listdir (repository_root )
370
372
371
373
374
+ @system_binary ('echo' )
372
375
def test_mirroring_custom_incoming_changes (echo_binary ):
373
376
with tempfile .TemporaryDirectory () as repository_root :
374
377
repository = GitRepository (mock (), repository_root , 'test-1' , {
@@ -377,6 +380,7 @@ def test_mirroring_custom_incoming_changes(echo_binary):
377
380
assert repository .incoming () is True
378
381
379
382
383
+ @system_binary ('true' )
380
384
def test_mirroring_custom_incoming_no_changes (true_binary ):
381
385
with tempfile .TemporaryDirectory () as repository_root :
382
386
repository = GitRepository (mock (), repository_root , 'test-1' , {
@@ -385,6 +389,7 @@ def test_mirroring_custom_incoming_no_changes(true_binary):
385
389
assert repository .incoming () is False
386
390
387
391
392
+ @system_binary ('false' )
388
393
def test_mirroring_custom_incoming_error (false_binary ):
389
394
with pytest .raises (RepositoryException ):
390
395
with tempfile .TemporaryDirectory () as repository_root :
@@ -403,6 +408,7 @@ def test_mirroring_incoming_invoke_original_command():
403
408
verify (repository ).incoming_check ()
404
409
405
410
411
+ @system_binary ('touch' )
406
412
def test_mirroring_custom_sync_invoke_command (touch_binary ):
407
413
checking_file = 'sync.txt'
408
414
with tempfile .TemporaryDirectory () as repository_root :
@@ -413,6 +419,7 @@ def test_mirroring_custom_sync_invoke_command(touch_binary):
413
419
assert checking_file in os .listdir (repository_root )
414
420
415
421
422
+ @system_binary ('true' )
416
423
def test_mirroring_custom_sync_success (true_binary ):
417
424
with tempfile .TemporaryDirectory () as repository_root :
418
425
repository = GitRepository (mock (), repository_root , 'test-1' , {
@@ -421,6 +428,7 @@ def test_mirroring_custom_sync_success(true_binary):
421
428
assert 0 == repository .sync ()
422
429
423
430
431
+ @system_binary ('false' )
424
432
def test_mirroring_custom_sync_error (false_binary ):
425
433
with tempfile .TemporaryDirectory () as repository_root :
426
434
repository = GitRepository (mock (), repository_root , 'test-1' , {
0 commit comments