mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
8cdb9ea54f
This makes the 2.x usage invalid syntax and forces the use of print as a function. This adds the import to the files which I've updated in the last couple of days but forgot to add it.
55 lines
1.7 KiB
Python
55 lines
1.7 KiB
Python
# -*- coding: utf-8 -*-
|
|
'''
|
|
:codeauthor: :email:`Pedro Algarvio (pedro@algarvio.me)`
|
|
|
|
|
|
integration.loader.ext_modules
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
Test Salt's loader regarding external overrides
|
|
'''
|
|
|
|
# Import Python libs
|
|
from __future__ import absolute_import, print_function, unicode_literals
|
|
import os
|
|
import time
|
|
|
|
# Import Salt Testing libs
|
|
from tests.support.case import ModuleCase
|
|
from tests.support.paths import TMP
|
|
|
|
|
|
class LoaderOverridesTest(ModuleCase):
|
|
|
|
def test_overridden_internal(self):
|
|
# To avoid a race condition on Windows, we need to make sure the
|
|
# `override_test.py` file is present in the _modules directory before
|
|
# trying to list all functions. This test may execute before the
|
|
# minion has finished syncing down the files it needs.
|
|
module = os.path.join(TMP, 'rootdir', 'cache', 'files',
|
|
'base', '_modules', 'override_test.py')
|
|
tries = 0
|
|
while not os.path.exists(module):
|
|
tries += 1
|
|
if tries > 60:
|
|
break
|
|
time.sleep(1)
|
|
|
|
funcs = self.run_function('sys.list_functions')
|
|
|
|
# We placed a test module under _modules.
|
|
# The previous functions should also still exist.
|
|
self.assertIn('test.ping', funcs)
|
|
|
|
# A non existing function should, of course, not exist
|
|
self.assertNotIn('brain.left_hemisphere', funcs)
|
|
|
|
# There should be a new function for the test module, recho
|
|
self.assertIn('test.recho', funcs)
|
|
|
|
text = 'foo bar baz quo qux'
|
|
self.assertEqual(
|
|
self.run_function('test.echo', arg=[text])[::-1],
|
|
self.run_function('test.recho', arg=[text]),
|
|
)
|