mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Skip ExtendTestCase if templates directory is missing
The release tarball does not contain the `templates` directory. Therefore `ExtendTestCase` will fail: ``` ====================================================================== ERROR: test_run (unit.utils.test_extend.ExtendTestCase) [CPU:0.0%|MEM:53.9%] ---------------------------------------------------------------------- Traceback (most recent call last): File "tests/unit/utils/test_extend.py", line 40, in test_run out = salt.utils.extend.run('test', 'test', 'this description', integration.CODE_DIR, False) File "salt/utils/extend.py", line 242, in run MODULE_OPTIONS = _fetch_templates(os.path.join(salt_dir, 'templates')) File "salt/utils/extend.py", line 76, in _fetch_templates for item in os.listdir(src): FileNotFoundError: [Errno 2] No such file or directory: ' templates' ``` Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
This commit is contained in:
parent
0473683ace
commit
e74f78fca6
1 changed files with 3 additions and 1 deletions
|
@ -14,7 +14,7 @@ import shutil
|
|||
from datetime import date
|
||||
|
||||
# Import Salt Testing libs
|
||||
from tests.support.unit import TestCase
|
||||
from tests.support.unit import TestCase, skipIf
|
||||
from tests.support.mock import MagicMock, patch
|
||||
|
||||
# Import salt libs
|
||||
|
@ -35,6 +35,8 @@ class ExtendTestCase(TestCase):
|
|||
shutil.rmtree(self.out, True)
|
||||
os.chdir(self.starting_dir)
|
||||
|
||||
@skipIf(not os.path.exists(os.path.join(integration.CODE_DIR, 'templates')),
|
||||
"Test template directory 'templates/' missing.")
|
||||
def test_run(self):
|
||||
with patch('sys.exit', MagicMock):
|
||||
out = salt.utils.extend.run('test', 'test', 'this description', integration.CODE_DIR, False)
|
||||
|
|
Loading…
Add table
Reference in a new issue