Variables now can be saved in calculate.ini files using 'save' tag. fixed #41

Added string represintation for Hash values. fixed #40
master
Иванов Денис 3 years ago
parent 649f1b1b61
commit 7f1c023a99

@ -1010,7 +1010,6 @@ class CalculateExtension(Extension):
переменной datavars.'''
lineno = next(self.stream).lineno
# Целового файла больше не будет.
target_file = nodes.Const('', lineno=lineno)
if self.stream.skip_if('dot'):

@ -265,6 +265,9 @@ class Hash:
def __contains__(self, key: str) -> bool:
return key in self._values
def __str__(self):
return str(self.get_hash())
class HashType(VariableType):
'''Класс, соответствующий типу переменных хэшей.'''

@ -46,6 +46,7 @@ def main():
dbpkg=args.dbpkg,
**group_packages)
template_processor.process_template_directories()
datavars.save_variables()
if __name__ == "__main__":

@ -3049,6 +3049,7 @@ AttributeError: module 'os' has no attribute 'suspicious_attribute'
'/etc/append_join_file_testfiles/logo.png')
parameters_object = ParametersContainer({'package': test_package_name,
'append': 'join',
'source': source_path,
'format': 'raw'})
@ -3059,6 +3060,7 @@ AttributeError: module 'os' has no attribute 'suspicious_attribute'
template_text='',
chroot_path=CHROOT_PATH,
config_archive_path=CONFIG_ARCHIVE_PATH)
with pytest.raises(TemplateExecutorError):
template_executor._append_join_file(template_wrapper)

@ -1181,11 +1181,11 @@ value = another_value
assert datavars.os.ns.var_1 == 'value_1'
assert datavars.os.ns.var_2 == 2
assert 'main' not in datavars.root
assert 'other' not in datavars.root
assert datavars.main.strange_variable == 'weird_value'
assert datavars.main.plain_variable is True
assert 'main' in datavars.root
assert datavars.other.strange_variable == 'weird_value'
assert datavars.other.plain_variable is True
assert 'other' in datavars.root
def test_if_a_Datavars_object_is_created_with_path_to_the_variables_with_some_Dependencies_and_then_used_to_get_access_to_the_some_variables_from__the_datavars_object_dynamically_loads_variables_and_retruns_necessary_variables(self):
datavars = Datavars(

@ -1,6 +1,6 @@
from calculate.variables.datavars import Namespace, Variable, StringType,\
IntegerType, BooleanType
Variable('strange_variable', source='weird_value', type=StringType)
Variable('old_variable', source='ancient_value', type=StringType)
Variable('plain_variable', source=True, type=BooleanType)
Variable('bool_variable', source=True, type=BooleanType)

@ -0,0 +1,6 @@
from calculate.variables.datavars import Namespace, Variable, StringType,\
IntegerType, BooleanType
Variable('strange_variable', source='weird_value', type=StringType)
Variable('plain_variable', source=True, type=BooleanType)
Loading…
Cancel
Save