Skip test when git symlinks are not configured

This commit is contained in:
Daniel A Wozniak 2018-03-22 18:02:24 -07:00 committed by Daniel A. Wozniak
parent 4e7466a21c
commit 628b87d5c4
No known key found for this signature in database
GPG key ID: 166B9D2C06C82D61

View file

@ -19,6 +19,7 @@
# Import Python Libs
from __future__ import absolute_import
import os
import subprocess
# Import Salt Testing Libs
from tests.support.unit import TestCase, skipIf
@ -33,7 +34,22 @@ from tests.support.mock import (
from salt.modules.inspectlib.collector import Inspector
HAS_SYMLINKS = None
def no_symlinks():
global HAS_SYMLINKS
if HAS_SYMLINKS is not None:
return not HAS_SYMLINKS
output = subprocess.check_output('git config --get core.symlinks', shell=True)
HAS_SYMLINKS = False
if output.strip() == 'true':
HAS_SYMLINKS = True
return not HAS_SYMLINKS
@skipIf(NO_MOCK, NO_MOCK_REASON)
@skipIf(no_symlinks(), "Git missing 'core.symlinks=true' config")
class InspectorCollectorTestCase(TestCase):
'''
Test inspectlib:collector:Inspector