mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Skip test_check_virtualname if source directory is not found
Running the unittest with autopkgtest against the installed version of salt fails (log from salt 2019.2.3): ``` ====================================================================== ERROR: test_check_virtualname (unit.test_virtualname.VirtualNameTestCase) [CPU:0.0%|MEM:60.8%] ---------------------------------------------------------------------- Traceback (most recent call last): File "/tmp/autopkgtest.O28A17/autopkgtest_tmp/tests/unit/test_virtualname.py", line 89, in test_check_virtualname for entry in os.listdir(os.path.join(CODE_DIR, 'salt/')): FileNotFoundError: [Errno 2] No such file or directory: '/tmp/autopkgtest.O28A17/autopkgtest_tmp/salt/' ---------------------------------------------------------------------- ``` Therefore skip `test_check_virtualname` if the source directory `salt` is not found. Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
This commit is contained in:
parent
1e36ea55a2
commit
1e44218f5f
1 changed files with 5 additions and 1 deletions
|
@ -15,7 +15,7 @@ import salt.ext.six as six
|
|||
|
||||
# Import Salt Testing libs
|
||||
from tests.support.runtests import RUNTIME_VARS
|
||||
from tests.support.unit import TestCase
|
||||
from tests.support.unit import TestCase, skipIf
|
||||
|
||||
try:
|
||||
import importlib.util
|
||||
|
@ -84,6 +84,10 @@ class VirtualNameTestCase(TestCase):
|
|||
)
|
||||
return ret
|
||||
|
||||
@skipIf(
|
||||
not os.path.isdir(os.path.join(RUNTIME_VARS.CODE_DIR, "salt")),
|
||||
"Failed to find salt directory in '{}'.".format(RUNTIME_VARS.CODE_DIR),
|
||||
)
|
||||
def test_check_virtualname(self):
|
||||
"""
|
||||
Test that the virtualname is in __name__ of the module
|
||||
|
|
Loading…
Add table
Reference in a new issue