"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/unit/test_loader.py" between
salt-2019.2.0.tar.gz and salt-2019.2.1.tar.gz

About: SaltStack is a systems management software for data center automation, cloud orchestration, server provisioning, configuration management and more. Community version.

test_loader.py  (salt-2019.2.0):test_loader.py  (salt-2019.2.1)
skipping to change at line 301 skipping to change at line 301
copy.deepcopy(self.opts), copy.deepcopy(self.opts),
tag='module') tag='module')
def tearDown(self): def tearDown(self):
del self.loader del self.loader
def test_single_item_no_dot(self): def test_single_item_no_dot(self):
''' '''
Checks that a KeyError is raised when the function key does not contain a '.' Checks that a KeyError is raised when the function key does not contain a '.'
''' '''
key = 'testing_no_dot'
expected = "The key '{0}' should contain a '.'".format(key)
with self.assertRaises(KeyError) as err: with self.assertRaises(KeyError) as err:
inspect.isfunction(self.loader['testing_no_dot']) inspect.isfunction(self.loader['testing_no_dot'])
if six.PY2: result = err.exception.args[0]
self.assertEqual(err.exception[0], assert result == expected, result
'The key \'%s\' should contain a \'.\'')
else:
self.assertEqual(
six.text_type(err.exception),
six.text_type(("The key '%s' should contain a '.'", 'testing_no_
dot'))
)
module_template = ''' module_template = '''
__load__ = ['test', 'test_alias'] __load__ = ['test', 'test_alias']
__func_alias__ = dict(test_alias='working_alias') __func_alias__ = dict(test_alias='working_alias')
from salt.utils.decorators import depends from salt.utils.decorators import depends
def test(): def test():
return {count} return {count}
def test_alias(): def test_alias():
skipping to change at line 970 skipping to change at line 966
def _verify_globals(self, mod_dict): def _verify_globals(self, mod_dict):
''' '''
Verify that the globals listed in the doc string (from the test) are in these modules Verify that the globals listed in the doc string (from the test) are in these modules
''' '''
# find the globals # find the globals
global_vars = [] global_vars = []
for val in six.itervalues(mod_dict): for val in six.itervalues(mod_dict):
# only find salty globals # only find salty globals
if val.__module__.startswith('salt.loaded'): if val.__module__.startswith('salt.loaded'):
if hasattr(val, '__globals__'): if hasattr(val, '__globals__'):
if '__wrapped__' in val.__globals__: if hasattr(val, '__wrapped__') or '__wrapped__' in val.__glo bals__:
global_vars.append(sys.modules[val.__module__].__dict__) global_vars.append(sys.modules[val.__module__].__dict__)
else: else:
global_vars.append(val.__globals__) global_vars.append(val.__globals__)
# if we couldn't find any, then we have no modules -- so something is br oken # if we couldn't find any, then we have no modules -- so something is br oken
self.assertNotEqual(global_vars, [], msg='No modules were loaded.') self.assertNotEqual(global_vars, [], msg='No modules were loaded.')
# get the names of the globals you should have # get the names of the globals you should have
func_name = inspect.stack()[1][3] func_name = inspect.stack()[1][3]
names = next(six.itervalues(salt.utils.yaml.safe_load(getattr(self, func _name).__doc__))) names = next(six.itervalues(salt.utils.yaml.safe_load(getattr(self, func _name).__doc__)))
 End of changes. 3 change blocks. 
10 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)