diff --git a/calculate/templates/format/backgrounds_format.py b/calculate/templates/format/backgrounds_format.py index d87be22..f0d2d8a 100644 --- a/calculate/templates/format/backgrounds_format.py +++ b/calculate/templates/format/backgrounds_format.py @@ -19,9 +19,11 @@ class BackgroundsFormat(Format): def __init__(self, template_text: str, template_path: str, - parameters: ParametersContainer, - datavars: Union[Datavars, NamespaceNode, Variables], - chroot_path: str = "/"): + parameters: ParametersContainer = ParametersContainer(), + datavars: Union[Datavars, + NamespaceNode, + Variables] = NamespaceNode(""), + **kwargs): self._lines: List[str] = [line for line in template_text.strip().split('\n') if line] self._datavars: Union[Datavars, NamespaceNode, Variables] = datavars @@ -55,7 +57,6 @@ class BackgroundsFormat(Format): if not self._check_source(self._source, target_path, self._mirror): return self.changed_files - print(f"FAKE_CHROOT: {self._fake_chroot}") self._magician = ImageMagick( chroot=chroot_path if not self._fake_chroot else "/") source_resolution = self._magician.get_image_resolution(self._source) @@ -276,7 +277,6 @@ class BackgroundsFormat(Format): """Метод для получения md5-суммы текущего действия шаблона, рассчитываемой из последовательности байтов изображения и списка разрешений, в которые данный файл должен быть конвертирован.""" - print("RESOLUTIONS:", resolutions) with open(source, "rb") as source_file: md5_object = hashlib.md5(source_file.read()) for width, height in resolutions: diff --git a/calculate/templates/format/bind_format.py b/calculate/templates/format/bind_format.py index 64dcac4..6bda7c6 100644 --- a/calculate/templates/format/bind_format.py +++ b/calculate/templates/format/bind_format.py @@ -4,7 +4,6 @@ # не весь файл -- выдаем ошибку. # from .base_format import Format -from ..template_engine import ParametersContainer from collections import OrderedDict from pyparsing import originalTextFor, OneOrMore, Word, alphanums, Literal,\ ZeroOrMore, Forward, Optional, Group, restOfLine,\ @@ -26,7 +25,7 @@ class BINDFormat(Format): join_before=False, add_header=False, already_changed=False, - parameters=ParametersContainer()): + **kwargs): processing_methods = [] super().__init__(processing_methods) diff --git a/calculate/templates/format/compiz_format.py b/calculate/templates/format/compiz_format.py index abe982a..c63518e 100644 --- a/calculate/templates/format/compiz_format.py +++ b/calculate/templates/format/compiz_format.py @@ -1,7 +1,6 @@ # vim: fileencoding=utf-8 # from .base_format import Format -from ..template_engine import ParametersContainer from collections import OrderedDict from pyparsing import originalTextFor, Literal, Word, printables, OneOrMore,\ alphanums, ParseException, restOfLine, Group, Optional,\ @@ -27,7 +26,7 @@ class CompizFormat(Format): join_before=False, add_header=False, already_changed=False, - parameters=ParametersContainer()): + **kwargs): processing_methods = [self._parse_comment_line, self._parse_section_line, self._parse_parameter_line, diff --git a/calculate/templates/format/contents_format.py b/calculate/templates/format/contents_format.py index b4a9627..3527ea6 100644 --- a/calculate/templates/format/contents_format.py +++ b/calculate/templates/format/contents_format.py @@ -5,11 +5,7 @@ from .base_format import Format, FormatError from calculate.utils.files import join_paths from pyparsing import Literal, Regex, SkipTo, LineEnd, lineno, LineStart from calculate.utils.package import PackageAtomParser, Package, PackageNotFound -from ..template_engine import ParametersContainer, Variables -from ...variables.datavars import NamespaceNode -from ...variables.loader import Datavars from fnmatch import fnmatch -from typing import Union from glob import iglob @@ -29,8 +25,7 @@ class ContentsFormat(Format): def __init__(self, template_text: str, template_path: str, - parameters: ParametersContainer, - datavars: Union[Datavars, NamespaceNode, Variables]): + **kwargs): self._command_methods = {ADD: self._add_command, REMOVE: self._remove_command, MOVE: self._move_command} diff --git a/calculate/templates/format/dovecot_format.py b/calculate/templates/format/dovecot_format.py index 7464389..8ae6b4b 100644 --- a/calculate/templates/format/dovecot_format.py +++ b/calculate/templates/format/dovecot_format.py @@ -4,7 +4,6 @@ # документа. # from .base_format import Format -from ..template_engine import ParametersContainer from collections import OrderedDict from pyparsing import originalTextFor, Literal, Word, printables, alphanums,\ ParseException, Regex, Group, Optional, alphas, lineEnd,\ @@ -30,7 +29,7 @@ class DovecotFormat(Format): join_before: bool = False, add_header: bool = False, already_changed: bool = False, - parameters: ParametersContainer = ParametersContainer()): + **kwargs): processing_methods = [self._parse_comment_line, self._parse_section_start_line, self._parse_include_line, diff --git a/calculate/templates/format/json_format.py b/calculate/templates/format/json_format.py index 6858cbd..d572394 100644 --- a/calculate/templates/format/json_format.py +++ b/calculate/templates/format/json_format.py @@ -1,7 +1,6 @@ # vim: fileencoding=utf-8 # from .base_format import Format -from ..template_engine import ParametersContainer from collections import OrderedDict import json @@ -16,9 +15,7 @@ class JSONFormat(Format): template_path: str, ignore_comments: bool = False, join_before: bool = False, - add_header: bool = False, - already_changed: bool = False, - parameters: ParametersContainer = ParametersContainer()): + **kwargs): processing_methods: list = [] super().__init__(processing_methods) self._ignore_comments: bool = ignore_comments diff --git a/calculate/templates/format/kde_format.py b/calculate/templates/format/kde_format.py index a3513e0..2b3eda8 100644 --- a/calculate/templates/format/kde_format.py +++ b/calculate/templates/format/kde_format.py @@ -27,7 +27,7 @@ class KDEFormat(Format): join_before=False, add_header=False, already_changed=False, - parameters=ParametersContainer()): + **kwargs): processing_methods = [self._parse_comment_line, self._parse_section_line, self._parse_parameter_line, diff --git a/calculate/templates/format/kernel_format.py b/calculate/templates/format/kernel_format.py index 300be95..b1987ea 100644 --- a/calculate/templates/format/kernel_format.py +++ b/calculate/templates/format/kernel_format.py @@ -27,7 +27,7 @@ class KernelFormat(Format): join_before=False, add_header=False, already_changed=False, - parameters=ParametersContainer()): + **kwargs): processing_methods = [self._parse_comment_line, self._parse_parameter_line, self._parse_to_delete_line] diff --git a/calculate/templates/format/ldap_format.py b/calculate/templates/format/ldap_format.py index 5e7b737..b7b10c5 100644 --- a/calculate/templates/format/ldap_format.py +++ b/calculate/templates/format/ldap_format.py @@ -1,7 +1,6 @@ # vim: fileencoding=utf-8 # from .base_format import Format -from ..template_engine import ParametersContainer from collections import OrderedDict from pyparsing import originalTextFor, Literal, Word, printables, OneOrMore,\ alphanums, ParseException, restOfLine, nums,\ @@ -27,7 +26,7 @@ class LDAPFormat(Format): join_before=False, add_header=False, already_changed=False, - parameters=ParametersContainer()): + **kwargs): processing_methods = [self._parse_comment_line, self._parse_type_line, self._parse_access_line, diff --git a/calculate/templates/format/openrc_format.py b/calculate/templates/format/openrc_format.py index 4a3b899..9b014f2 100644 --- a/calculate/templates/format/openrc_format.py +++ b/calculate/templates/format/openrc_format.py @@ -1,7 +1,6 @@ # vim: fileencoding=utf-8 # from .base_format import Format -from ..template_engine import ParametersContainer from collections import OrderedDict from pyparsing import Word, Literal, printables, originalTextFor, OneOrMore,\ ParseException, restOfLine, Group, Optional, Regex @@ -26,7 +25,7 @@ class OpenRCFormat(Format): join_before=False, add_header=False, already_changed=False, - parameters=ParametersContainer()): + **kwargs): processing_methods = [self._parse_comment_line, self._parse_parameter_line, self._parse_to_delete_line] diff --git a/calculate/templates/format/patch_format.py b/calculate/templates/format/patch_format.py index 882048d..c75cc3a 100644 --- a/calculate/templates/format/patch_format.py +++ b/calculate/templates/format/patch_format.py @@ -3,10 +3,6 @@ from .base_format import Format from calculate.utils.files import Process from calculate.templates.format.base_format import FormatError -from ..template_engine import ParametersContainer, Variables -from ...variables.datavars import NamespaceNode -from ...variables.loader import Datavars -from typing import Union from os import path @@ -16,8 +12,7 @@ class PatchFormat(Format): def __init__(self, patch_text: str, template_path: str, - parameters: ParametersContainer, - datavars: Union[Datavars, NamespaceNode, Variables]): + **kwargs): self._patch_text = patch_text self._cwd_path = '/' self._last_level = 0 @@ -28,7 +23,8 @@ class PatchFormat(Format): # Предупреждения. self._warnings: list = [] - def execute_format(self, target_path, chroot_path='/'): + def execute_format(self, target_path: str, + chroot_path: str = '/') -> dict: '''Метод для запуска работы формата.''' self._cwd_path = target_path if not path.isdir(self._cwd_path): diff --git a/calculate/templates/format/postfix_format.py b/calculate/templates/format/postfix_format.py index dffa683..b4782f5 100644 --- a/calculate/templates/format/postfix_format.py +++ b/calculate/templates/format/postfix_format.py @@ -1,7 +1,6 @@ # vim: fileencoding=utf-8 # from .base_format import Format -from ..template_engine import ParametersContainer from collections import OrderedDict from pyparsing import Word, Literal, alphanums, originalTextFor, OneOrMore,\ ParseException, Group, Optional, printables, Regex @@ -26,7 +25,7 @@ class PostfixFormat(Format): join_before=False, add_header=False, already_changed=False, - parameters=ParametersContainer()): + **kwargs): processing_methods = [self._parse_comment_line, self._parse_parameter_line, self._parse_to_delete_line] diff --git a/calculate/templates/format/procmail_format.py b/calculate/templates/format/procmail_format.py index 4c0bf50..2ee20b7 100644 --- a/calculate/templates/format/procmail_format.py +++ b/calculate/templates/format/procmail_format.py @@ -1,7 +1,6 @@ # vim: fileencoding=utf-8 # from .base_format import Format -from ..template_engine import ParametersContainer from collections import OrderedDict from pyparsing import Word, Literal, alphanums, printables, originalTextFor,\ OneOrMore, ParseException, restOfLine, Group, Optional,\ @@ -27,7 +26,7 @@ class ProcmailFormat(Format): join_before=False, add_header=False, already_changed=False, - parameters=ParametersContainer()): + **kwargs): processing_methods = [self._parse_comment_line, self._parse_parameter_line, self._parse_to_delete_line] diff --git a/calculate/templates/format/proftpd_format.py b/calculate/templates/format/proftpd_format.py index 4275e3d..acbf0a5 100644 --- a/calculate/templates/format/proftpd_format.py +++ b/calculate/templates/format/proftpd_format.py @@ -1,7 +1,6 @@ # vim: fileencoding=utf-8 # from .base_format import Format, FormatError -from ..template_engine import ParametersContainer from jinja2 import Environment, PackageLoader from collections import OrderedDict from pyparsing import originalTextFor, Literal, Word, printables, Regex,\ @@ -34,7 +33,7 @@ class ProFTPDFormat(Format): join_before=False, add_header=False, already_changed=False, - parameters=ParametersContainer()): + **kwargs): processing_methods = [self._parse_comment_line, self._parse_section_start_line, self._parse_section_end_line, diff --git a/calculate/templates/format/raw_format.py b/calculate/templates/format/raw_format.py index 0ddab1f..4ec4fe0 100644 --- a/calculate/templates/format/raw_format.py +++ b/calculate/templates/format/raw_format.py @@ -16,7 +16,8 @@ class RawFormat(Format): join_before=False, add_header=False, already_changed=False, - parameters=ParametersContainer()): + parameters=ParametersContainer(), + **kwargs): self.comment_symbol = parameters.comment or "" self._before = join_before @@ -36,7 +37,7 @@ class RawFormat(Format): sep = "" if self._before: if (template._document_text - and not template._document_text.endswith("\n")): + and not template._document_text.endswith("\n")): sep = "\n" self._document_text = '{0}{1}{2}'.format( template._document_text, sep, diff --git a/calculate/templates/format/regex_format.py b/calculate/templates/format/regex_format.py index 5edbfbc..8f08cee 100644 --- a/calculate/templates/format/regex_format.py +++ b/calculate/templates/format/regex_format.py @@ -23,7 +23,8 @@ class RegexFormat(Format): join_before=False, add_header=False, already_changed=False, - parameters=ParametersContainer()): + parameters=ParametersContainer(), + **kwargs): processing_methods = OrderedDict() super().__init__(processing_methods) diff --git a/calculate/templates/format/samba_format.py b/calculate/templates/format/samba_format.py index 58706de..a3fc7ca 100644 --- a/calculate/templates/format/samba_format.py +++ b/calculate/templates/format/samba_format.py @@ -26,7 +26,8 @@ class SambaFormat(Format): join_before=False, add_header=False, already_changed=False, - parameters=ParametersContainer()): + parameters=ParametersContainer(), + **kwargs): processing_methods = [self._parse_comment_line, self._parse_section_line, self._parse_parameter_line, diff --git a/calculate/templates/format/world_format.py b/calculate/templates/format/world_format.py new file mode 100644 index 0000000..b5eda94 --- /dev/null +++ b/calculate/templates/format/world_format.py @@ -0,0 +1,161 @@ +# vim: fileencoding=utf-8 +# +from .base_format import Format +from calculate.utils.package import ( + PackageAtomParser, + PackageNotFound, + PackageAtomError + ) + +from collections import OrderedDict +from typing import List +import os + + +class WorldFormat(Format): + FORMAT = 'world' + EXECUTABLE = False + + _initialized = False + + comment_symbol = '#' + + def __init__(self, document_text: str, + template_path: str, + ignore_comments: bool = False, + add_header: bool = False, + already_changed: bool = False, + chroot_path="/", + **kwargs): + processing_methods = [] + self._atom_parser = PackageAtomParser(chroot_path=chroot_path) + + super().__init__(processing_methods) + self._template_name = os.path.basename(template_path) + self._action_symbols = ["!!", "!"] + self.warnings = [] + + if add_header and not ignore_comments: + self.header, document_text = self._get_header_and_document_text( + document_text, + template_path, + already_changed=already_changed) + else: + self.header = '' + + document_text = document_text.strip() + if document_text == '': + self._document_dictionary = OrderedDict() + else: + document_lines = self._get_list_of_logic_lines(document_text) + self._document_dictionary = self._lines_to_dictionary( + document_lines) + + def _lines_to_dictionary(self, document_lines: List[str]) -> OrderedDict: + output = OrderedDict() + for line in document_lines: + action = None + for action_symbol in self._action_symbols: + if line.startswith(action_symbol): + action = action_symbol + line = line[len(action_symbol):] + break + + name_only = line.split(':')[0] + if "/" not in name_only: + line = f"{self._template_name}/{line}" + + atom_dict = self._atom_parser.parse_atom_name(line) + atom_dict['package_atom'] = ( + f'{atom_dict["category"]}/{atom_dict["name"]}') + if action == "!!": + action = "!" + print("WITH EXISTANCE CHECK") + try: + self._atom_parser._check_package_existance(atom_dict) + print("PACKAGE WAS FOUND") + except (PackageNotFound, PackageAtomError): + print("PACKAGE WAS NOT FOUND") + self.warnings.append(f"package '{line}' not found") + + levels = [atom_dict["category"], atom_dict["name"]] + level = output + for next_level in levels: + if next_level not in level: + level[next_level] = OrderedDict() + level = level[next_level] + level[atom_dict["slot"]] = action + return output + + def join_template(self, template): + self._document_dictionary = self._change_categories( + template._document_dictionary, + self._document_dictionary) + + def _change_categories(self, template: OrderedDict, + original: OrderedDict) -> OrderedDict: + for category, names in template.items(): + if category in original: + original_names = original[category] + else: + original_names = OrderedDict() + changed_names = self._change_names(names, original_names) + + if not changed_names: + original.pop(category) + else: + original[category] = changed_names + + return original + + def _change_names(self, template_names: OrderedDict, + original_names: OrderedDict) -> OrderedDict: + for name, slots in template_names.items(): + if name in original_names: + original_slots = original_names[name] + else: + original_slots = OrderedDict() + changed_slots = self._change_slots(slots, original_slots) + + if not changed_slots: + original_names.pop(name) + else: + original_names[name] = changed_slots + + return original_names + + def _change_slots(self, template_slots: OrderedDict, + original_slots: OrderedDict) -> OrderedDict: + for slot, action in template_slots.items(): + if slot == "*": + if action == "!": + original_slots.clear() + continue + else: + if action == "!" and slot in original_slots: + original_slots.pop(slot) + continue + if action is None and slot not in original_slots: + original_slots[slot] = None + continue + + return original_slots + + def _get_document_text(self) -> str: + lines = [] + categories = sorted(self._document_dictionary.keys()) + for category in categories: + names_dict = self._document_dictionary[category] + names = sorted(names_dict.keys()) + for name in names: + slots = sorted(names_dict[name].keys()) + for slot in slots: + slot = '' if slot is None else f":{slot}" + lines.append(f"{category}/{name}{slot}") + + lines.append('') + return "\n".join(lines) + + @property + def document_text(self) -> str: + return "{}{}".format(self.header, self._get_document_text()) diff --git a/calculate/templates/format/xml_gconf_format.py b/calculate/templates/format/xml_gconf_format.py index 71c3b01..f40e280 100644 --- a/calculate/templates/format/xml_gconf_format.py +++ b/calculate/templates/format/xml_gconf_format.py @@ -3,14 +3,12 @@ from pyparsing import originalTextFor, Literal, Word, printables, OneOrMore,\ Optional from .base_format import Format, FormatError -from ..template_engine import ParametersContainer from collections import OrderedDict try: from lxml.etree import Element, SubElement, ElementTree, tostring except ImportError: from xml.etree.ElementTree import Element, SubElement, ElementTree, \ tostring -from pprint import pprint class XMLGConfFormat(Format): @@ -32,7 +30,7 @@ class XMLGConfFormat(Format): join_before=False, add_header=False, already_changed=False, - parameters=ParametersContainer()): + **kwargs): processing_methods = OrderedDict({'gconf': self._gconf, 'entry': self._entry, 'dir': self._dir, diff --git a/calculate/templates/format/xml_xfce_format.py b/calculate/templates/format/xml_xfce_format.py index ab43f7d..bef0ed8 100644 --- a/calculate/templates/format/xml_xfce_format.py +++ b/calculate/templates/format/xml_xfce_format.py @@ -1,7 +1,6 @@ # vim: fileencoding=utf-8 # from .base_format import Format -from ..template_engine import ParametersContainer from pyparsing import originalTextFor, Literal, Word, printables, OneOrMore,\ Optional from collections import OrderedDict @@ -31,7 +30,7 @@ class XMLXfceFormat(Format): join_before=False, add_header=False, already_changed=False, - parameters=ParametersContainer()): + **kwargs): processing_methods = OrderedDict({'channel': self._channel, 'property': self._property, 'value': self._value, diff --git a/calculate/templates/template_processor.py b/calculate/templates/template_processor.py index 5705055..86d47fd 100644 --- a/calculate/templates/template_processor.py +++ b/calculate/templates/template_processor.py @@ -1042,7 +1042,8 @@ class TemplateExecutor: parsed_template = template_format( template_object.template_text, template_object.template_path, - ignore_comments=True) + ignore_comments=True, + chroot_path=self.chroot_path) # Действия для шаблонов не являющихся исполнительными. output_paths = [output_path] @@ -1095,10 +1096,10 @@ class TemplateExecutor: self._chmod_file(save_path, chmod) elif template_object.format_class.EXECUTABLE: parsed_template = template_format( - template_object.template_text, - template_object.template_path, - template_object.parameters, - self.datavars_module) + template_object.template_text, + template_object.template_path, + parameters=template_object.parameters, + datavars=self.datavars_module) changed_files = parsed_template.execute_format( template_object.target_path, chroot_path=self.chroot_path) diff --git a/calculate/utils/calculateini.py b/calculate/utils/calculateini.py index d01abb8..54a9933 100644 --- a/calculate/utils/calculateini.py +++ b/calculate/utils/calculateini.py @@ -13,9 +13,8 @@ class CalculateIniParser: def __init__(self): self.operations = {"=": self.Define.assign, - "+=": self.Define.append, - "-=": self.Define.remove} - + "+=": self.Define.append, + "-=": self.Define.remove} lbrack = Literal("[") rbrack = Literal("]") diff --git a/calculate/utils/package.py b/calculate/utils/package.py index 89c4261..16cb436 100644 --- a/calculate/utils/package.py +++ b/calculate/utils/package.py @@ -587,17 +587,15 @@ class PackageAtomParser: '''Метод для разбора значения package, после разбора инициирует проверку полученных значений. Возвращает объект PackageAtomName.''' self.package_atom = package_atom - print(f'value: {package_atom}') if isinstance(package_atom, str): atom_dictionary = self.parse_atom_name(package_atom) atom_dictionary['package_atom'] = package_atom - print(f'atom_dict: {atom_dictionary}') elif isinstance(package_atom, dict): atom_dictionary = package_atom if 'package_atom' not in atom_dictionary: atom_dictionary['package_atom'] = ( - f'{atom_dictionary["category"]}{atom_dictionary["name"]}') + f'{atom_dictionary["category"]}/{atom_dictionary["name"]}') atom_dictionary = self._check_package_existance(atom_dictionary) atom_name_object = PackageAtomName(atom_dictionary) @@ -1093,7 +1091,6 @@ class Package(metaclass=PackageCreator): file_path = self.remove_chroot_path(file_path) file_path = self.remove_cfg_prefix(file_path) removed = OrderedDict() - print(f"REMOVE {file_path} FROM PACKAGE {self.package_name}") if file_path not in self.contents_dictionary: return diff --git a/pytest.ini b/pytest.ini index 9fe0046..cabf2b5 100644 --- a/pytest.ini +++ b/pytest.ini @@ -23,6 +23,8 @@ markers = samba: marker for running tests for samba format. xml_xfce: marker for running tests for xml xfce format. xml_gconf: marker for running tests for xml gconf format. + world: marker for running tests for world format. + formats: marker for running tests for all formats. files_utils: marker for running tests for calculate.utils.files module. package_utils: marker for running tests for calculate.utils.contents module. diff --git a/tests/templates/format/test_backgrounds.py b/tests/templates/format/test_backgrounds.py index 27e2219..121b061 100644 --- a/tests/templates/format/test_backgrounds.py +++ b/tests/templates/format/test_backgrounds.py @@ -17,12 +17,14 @@ TMP_BACKUP_DIR = 'tests/templates/format/testfiles/backgrounds/tmp.backup' TMP_DIR = 'tests/templates/format/testfiles/backgrounds/tmp' +@pytest.mark.formats @pytest.mark.backgrounds def test_make_tmp_dir(): if not os.path.exists(TMP_DIR): shutil.copytree(TMP_BACKUP_DIR, TMP_DIR) +@pytest.mark.formats @pytest.mark.backgrounds @pytest.mark.parametrize('case', [ { @@ -127,7 +129,8 @@ def test_resize_and_convert_of_different_formats(case): 'stretch': case["stretch"]}) backgrounds_object = BackgroundsFormat(case["template_text"], "path/to/template", - parameters, datavars) + parameters=parameters, + datavars=datavars) changed_files = backgrounds_object.execute_format(target_path) images_format, resolutions = case["result"] @@ -152,6 +155,7 @@ def test_resize_and_convert_of_different_formats(case): # assert False +@pytest.mark.formats @pytest.mark.backgrounds @pytest.mark.parametrize('case', [ { @@ -183,7 +187,8 @@ def test_scretch_parameter(case): 'stretch': case["stretch"]}) backgrounds_object = BackgroundsFormat(case["template_text"], "path/to/template", - parameters, datavars) + parameters=parameters, + datavars=datavars) changed_files = backgrounds_object.execute_format(target_path) for resolution, result in case["result"].items(): @@ -197,6 +202,7 @@ def test_scretch_parameter(case): int(height)) +# @pytest.mark.formats # @pytest.mark.backgrounds # def test_to_create(): # target_path = os.path.join(TMP_BACKUP_DIR, "result_13-") @@ -210,6 +216,7 @@ def test_scretch_parameter(case): # backgrounds_object.execute_format(target_path) +@pytest.mark.formats @pytest.mark.backgrounds def test_if_template_has_been_already_used__it_will_not_be_reused(): target_path = os.path.join(TMP_DIR, "result_10-") @@ -219,12 +226,14 @@ def test_if_template_has_been_already_used__it_will_not_be_reused(): 'stretch': False}) backgrounds_object = BackgroundsFormat("1650x1050\n1024x768", "path/to/template", - parameters, datavars) + parameters=parameters, + datavars=datavars) changed_files = backgrounds_object.execute_format(target_path) assert not changed_files @pytest.mark.backgrounds_slow +@pytest.mark.formats @pytest.mark.backgrounds def test_if_template_is_using_in_directory_but_other_template_has_been_already_used_for_the_same_image_name__latest_template_will_remove_old_images_and_md5sum_file_and_create_new_ones(): target_path = os.path.join(TMP_DIR, "result_11-") @@ -234,7 +243,8 @@ def test_if_template_is_using_in_directory_but_other_template_has_been_already_u 'stretch': False}) backgrounds_object = BackgroundsFormat("1440x1080\n1280x960", "path/to/template", - parameters, datavars) + parameters=parameters, + datavars=datavars) changed_files = backgrounds_object.execute_format(target_path) assert not os.path.exists(f"{target_path}1650x1050.png") assert os.path.exists(f"{target_path}1440x1080.png") @@ -249,6 +259,7 @@ def test_if_template_is_using_in_directory_but_other_template_has_been_already_u @pytest.mark.backgrounds_slow +@pytest.mark.formats @pytest.mark.backgrounds def test_if_template_is_using_in_directory_which_contains_md5sum_file_without_any_images__the_template_will_remove_md5sum_file_and_create_new_one_and_images(): target_path = os.path.join(TMP_DIR, "result_12-") @@ -258,7 +269,8 @@ def test_if_template_is_using_in_directory_which_contains_md5sum_file_without_an 'stretch': False}) backgrounds_object = BackgroundsFormat("1440x1080\n1280x960", "path/to/template", - parameters, datavars) + parameters=parameters, + datavars=datavars) changed_files = backgrounds_object.execute_format(target_path) assert os.path.exists(f"{target_path}1440x1080.png") assert os.path.exists(f"{target_path}1280x960.png") @@ -269,6 +281,7 @@ def test_if_template_is_using_in_directory_which_contains_md5sum_file_without_an @pytest.mark.backgrounds_slow +@pytest.mark.formats @pytest.mark.backgrounds def test_if_template_is_using_in_directory_which_contains_some_image_files_without_md5sum_file__the_template_will_remove_all_images_and_create_new_ones_and_new_md5sum_file(): target_path = os.path.join(TMP_DIR, "result_13-") @@ -278,7 +291,8 @@ def test_if_template_is_using_in_directory_which_contains_some_image_files_witho 'stretch': False}) backgrounds_object = BackgroundsFormat("1440x1080\n1280x960", "path/to/template", - parameters, datavars) + parameters=parameters, + datavars=datavars) changed_files = backgrounds_object.execute_format(target_path) assert not os.path.exists(f"{target_path}1650x1050.png") assert os.path.exists(f"{target_path}1440x1080.png") @@ -292,6 +306,7 @@ def test_if_template_is_using_in_directory_which_contains_some_image_files_witho f"{target_path}1280x960.png": "N"} +@pytest.mark.formats @pytest.mark.backgrounds def test_if_template_s_name_parameter_is_the_empty_line_and_its_text_contents_two_or_more_resolution_values__the_output_files_name_will_contains_its_resolutions_only(): target_path = os.path.join(TMP_DIR, "result_14-") @@ -302,7 +317,8 @@ def test_if_template_s_name_parameter_is_the_empty_line_and_its_text_contents_tw 'name': ''}) backgrounds_object = BackgroundsFormat("100x100\n60x60", "path/to/template", - parameters, datavars) + parameters=parameters, + datavars=datavars) backgrounds_object.execute_format(target_path) assert os.path.exists(os.path.join(TMP_DIR, "100x100.jpeg")) @@ -310,6 +326,7 @@ def test_if_template_s_name_parameter_is_the_empty_line_and_its_text_contents_tw assert os.path.exists(os.path.join(TMP_DIR, "md5sum")) +@pytest.mark.formats @pytest.mark.backgrounds def test_if_template_s_name_parameter_is_the_empty_line_and_its_text_contents_one_resolution_value__the_format_will_raise_FormatError_exception(): target_path = os.path.join(TMP_DIR, "result_15-") @@ -320,11 +337,13 @@ def test_if_template_s_name_parameter_is_the_empty_line_and_its_text_contents_on 'name': ''}) backgrounds_object = BackgroundsFormat("100x100", "path/to/template", - parameters, datavars) + parameters=parameters, + datavars=datavars) with pytest.raises(FormatError): backgrounds_object.execute_format(target_path) +@pytest.mark.formats @pytest.mark.backgrounds def test_remove_tmp(): if os.path.exists(TMP_DIR): diff --git a/tests/templates/format/test_base.py b/tests/templates/format/test_base.py index 944183a..7ed972a 100644 --- a/tests/templates/format/test_base.py +++ b/tests/templates/format/test_base.py @@ -2,6 +2,7 @@ import pytest from calculate.templates.format.base_format import Format +@pytest.mark.formats @pytest.mark.base class TestJoinMethod: def test_if_inputs_are_dictionaries_with_string_keys_without_any_action_marks__the_dictionaties_just_merged(self, StringDictionaries): diff --git a/tests/templates/format/test_bind.py b/tests/templates/format/test_bind.py index db5b0ce..bd7dde9 100644 --- a/tests/templates/format/test_bind.py +++ b/tests/templates/format/test_bind.py @@ -3,6 +3,7 @@ from collections import OrderedDict from calculate.templates.format.bind_format import BINDFormat +@pytest.mark.formats @pytest.mark.bind class TestParsingMethods: def test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary(self): diff --git a/tests/templates/format/test_compiz.py b/tests/templates/format/test_compiz.py index 000a1a0..ba8aa80 100644 --- a/tests/templates/format/test_compiz.py +++ b/tests/templates/format/test_compiz.py @@ -4,6 +4,7 @@ from calculate.templates.format.compiz_format import CompizFormat from pprint import pprint +@pytest.mark.formats @pytest.mark.compiz class TestParsingMethods: def test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary(self): diff --git a/tests/templates/format/test_contents.py b/tests/templates/format/test_contents.py index 0524e88..9fa153b 100644 --- a/tests/templates/format/test_contents.py +++ b/tests/templates/format/test_contents.py @@ -12,6 +12,7 @@ TESTFILES_PATH = os.path.join(os.getcwd(), 'tests/templates/format/testfiles/contents') +@pytest.mark.formats @pytest.mark.contents class TestExecutingFormat: def test_copy_testfiles(self): @@ -56,9 +57,7 @@ sym /etc/dir_3/link_0 -> ../dir_1/file_0 {2} int(os.lstat(join_paths(chroot_path, '/etc/dir_3/link_0')).st_mtime)) - contents_format = ContentsFormat(template_text, '/path/to/template', - ParametersContainer(), - NamespaceNode()) + contents_format = ContentsFormat(template_text, '/path/to/template') contents_format.execute_format('target/path', chroot_path=chroot_path) test_package = Package(test_package_name, @@ -105,9 +104,7 @@ dir /etc/dir_1 dir /etc/dir_3 ''' - contents_format = ContentsFormat(template_text, '/path/to/template', - ParametersContainer(), - NamespaceNode()) + contents_format = ContentsFormat(template_text, '/path/to/template') contents_format.execute_format('target/path', chroot_path=chroot_path) test_package = Package(test_package_name, @@ -183,9 +180,7 @@ dir /etc/dir_5 sym /etc/dir_5/link_0 -> ../dir_1/file_0 1601991426 ''' - contents_format = ContentsFormat(template_text, '/path/to/template', - ParametersContainer(), - NamespaceNode()) + contents_format = ContentsFormat(template_text, '/path/to/template') contents_format.execute_format('target/path', chroot_path=chroot_path) test_package = Package(test_package_name, diff --git a/tests/templates/format/test_dovecot.py b/tests/templates/format/test_dovecot.py index 1042a5f..e5abaa8 100644 --- a/tests/templates/format/test_dovecot.py +++ b/tests/templates/format/test_dovecot.py @@ -3,6 +3,7 @@ from collections import OrderedDict from calculate.templates.format.dovecot_format import DovecotFormat +@pytest.mark.formats @pytest.mark.dovecot class TestParsingMethods: def test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary(self): diff --git a/tests/templates/format/test_json.py b/tests/templates/format/test_json.py index 801b092..d997b86 100644 --- a/tests/templates/format/test_json.py +++ b/tests/templates/format/test_json.py @@ -3,6 +3,7 @@ from collections import OrderedDict from calculate.templates.format.json_format import JSONFormat +@pytest.mark.formats @pytest.mark.json class TestParsingMethods: def test_if_input_document_contains_just_few_parameters_and_parameter_blocks__the_initialised_object_contains_correct_dictionary(self): diff --git a/tests/templates/format/test_kde.py b/tests/templates/format/test_kde.py index 9acd2a5..ef324ce 100644 --- a/tests/templates/format/test_kde.py +++ b/tests/templates/format/test_kde.py @@ -3,6 +3,7 @@ from collections import OrderedDict from calculate.templates.format.kde_format import KDEFormat +@pytest.mark.formats @pytest.mark.kde class TestParsingMethods: def test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary(self): diff --git a/tests/templates/format/test_kernel.py b/tests/templates/format/test_kernel.py index e30f925..525bbdd 100644 --- a/tests/templates/format/test_kernel.py +++ b/tests/templates/format/test_kernel.py @@ -3,6 +3,7 @@ from collections import OrderedDict from calculate.templates.format.kernel_format import KernelFormat +@pytest.mark.formats @pytest.mark.kernel class TestParsingMethods: def test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary(self): diff --git a/tests/templates/format/test_ldap.py b/tests/templates/format/test_ldap.py index af8af03..40518b3 100644 --- a/tests/templates/format/test_ldap.py +++ b/tests/templates/format/test_ldap.py @@ -3,6 +3,7 @@ from collections import OrderedDict from calculate.templates.format.ldap_format import LDAPFormat +@pytest.mark.formats @pytest.mark.ldap class TestParsingMethods: def test_if_logiclines_method_takes_text_with_lines_that_starts_whit_space_symbols__it_returns_joined_lines(self): diff --git a/tests/templates/format/test_openrc.py b/tests/templates/format/test_openrc.py index af35793..b3f0023 100644 --- a/tests/templates/format/test_openrc.py +++ b/tests/templates/format/test_openrc.py @@ -3,6 +3,7 @@ from collections import OrderedDict from calculate.templates.format.openrc_format import OpenRCFormat +@pytest.mark.formats @pytest.mark.openrc class TestParsingMethods: def test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary(self): diff --git a/tests/templates/format/test_patch.py b/tests/templates/format/test_patch.py index 6711c8a..7228d1d 100644 --- a/tests/templates/format/test_patch.py +++ b/tests/templates/format/test_patch.py @@ -1,9 +1,6 @@ import pytest import shutil from calculate.templates.format.patch_format import PatchFormat -from calculate.templates.template_engine import ParametersContainer -from calculate.variables.datavars import NamespaceNode -from calculate.utils.files import Process from os import path import os import re @@ -17,6 +14,7 @@ TEST_ROOT_PATH = os.path.join(os.getcwd(), 'tests/templates/format/testfiles/patch/root') +@pytest.mark.formats @pytest.mark.patch class TestExecuteMethods: def test_create_testfiles(self): @@ -33,9 +31,7 @@ class TestExecuteMethods: with open(path.join(cwd_path, 'diff_1.patch')) as patch_file: patch_text = patch_file.read() - diff_patch = PatchFormat(patch_text, '/template/path', - ParametersContainer(), - NamespaceNode("")) + diff_patch = PatchFormat(patch_text, '/template/path') output = diff_patch.execute_format(target_path=cwd_path) if output: for changed_file, change_type in diff_patch.changed_files.items(): @@ -66,9 +62,7 @@ class TestExecuteMethods: with open(path.join(patch_path)) as patch_file: patch_text = patch_file.read() - diff_patch = PatchFormat(patch_text, '/template/path', - ParametersContainer(), - NamespaceNode("")) + diff_patch = PatchFormat(patch_text, '/template/path') diff_patch.execute_format(target_path=cwd_path) for changed_file, change_type in diff_patch.changed_files.items(): diff --git a/tests/templates/format/test_postfix.py b/tests/templates/format/test_postfix.py index a5ad018..1a01e86 100644 --- a/tests/templates/format/test_postfix.py +++ b/tests/templates/format/test_postfix.py @@ -3,6 +3,7 @@ from collections import OrderedDict from calculate.templates.format.postfix_format import PostfixFormat +@pytest.mark.formats @pytest.mark.postfix class TestParsingMethods: def test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary(self): diff --git a/tests/templates/format/test_procmail.py b/tests/templates/format/test_procmail.py index ac4b876..7bea33f 100644 --- a/tests/templates/format/test_procmail.py +++ b/tests/templates/format/test_procmail.py @@ -3,6 +3,7 @@ from collections import OrderedDict from calculate.templates.format.procmail_format import ProcmailFormat +@pytest.mark.formats @pytest.mark.procmail class TestParsingMethods: def test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary(self): diff --git a/tests/templates/format/test_proftpd.py b/tests/templates/format/test_proftpd.py index 9bc8b98..e8cc9b1 100644 --- a/tests/templates/format/test_proftpd.py +++ b/tests/templates/format/test_proftpd.py @@ -4,6 +4,7 @@ from calculate.templates.format.proftpd_format import ProFTPDFormat from pprint import pprint +@pytest.mark.formats @pytest.mark.proftpd class TestParsingMethods: def test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary(self): diff --git a/tests/templates/format/test_raw.py b/tests/templates/format/test_raw.py index 2676318..a123c43 100644 --- a/tests/templates/format/test_raw.py +++ b/tests/templates/format/test_raw.py @@ -3,6 +3,7 @@ from calculate.templates.format.raw_format import RawFormat from calculate.templates.template_engine import ParametersContainer +@pytest.mark.formats @pytest.mark.raw class TestParsingMethods: def test_first(self): diff --git a/tests/templates/format/test_regex.py b/tests/templates/format/test_regex.py index cc4cc17..b94ae8a 100644 --- a/tests/templates/format/test_regex.py +++ b/tests/templates/format/test_regex.py @@ -3,6 +3,7 @@ from calculate.templates.format.regex_format import RegexFormat from calculate.templates.template_engine import ParametersContainer +@pytest.mark.formats @pytest.mark.regex class TestParsingMethods: def test_if_input_patch_document_contains_only_regular_expressions_without_any_regex_flags__it_correctly_patches_input_document(self): diff --git a/tests/templates/format/test_samba.py b/tests/templates/format/test_samba.py index 51d88b6..9f906dd 100644 --- a/tests/templates/format/test_samba.py +++ b/tests/templates/format/test_samba.py @@ -3,6 +3,7 @@ from collections import OrderedDict from calculate.templates.format.samba_format import SambaFormat +@pytest.mark.formats @pytest.mark.samba class TestParsingMethods: def test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary(self): diff --git a/tests/templates/format/test_world.py b/tests/templates/format/test_world.py new file mode 100644 index 0000000..87b0d9f --- /dev/null +++ b/tests/templates/format/test_world.py @@ -0,0 +1,199 @@ +import pytest +from collections import OrderedDict +from calculate.templates.format.world_format import WorldFormat +import os + + +CHROOT_PATH = os.path.join(os.getcwd(), + "tests/templates/format/testfiles/world") + + +@pytest.mark.formats +@pytest.mark.world +def test_parsing_document(): + original_text = """www-client/chromium:unstable +dev-python/pip +dev-util/cmake +clementine +""" + + original_object = WorldFormat(original_text, + "/path/to/template/media-sound", + chroot_path=CHROOT_PATH) + result_dict = OrderedDict({"www-client": + OrderedDict({"chromium": + OrderedDict({"unstable": None})}), + "dev-python": + OrderedDict({"pip": + OrderedDict({None: None})}), + "dev-util": + OrderedDict({"cmake": + OrderedDict({None: None})}), + "media-sound": + OrderedDict({"clementine": + OrderedDict({None: None})})}) + assert original_object._document_dictionary == result_dict + + +@pytest.mark.formats +@pytest.mark.world +def test_parsing_template(): + template_text = """www-client/chromium:stable +!!www-client/chromium:unstable +!www-client/chromium +dev-util/cmake +alsa-utils +""" + + template_object = WorldFormat(template_text, + "/path/to/template/media-sound", + chroot_path=CHROOT_PATH) + result_dict = OrderedDict({"www-client": + OrderedDict({"chromium": + OrderedDict({"stable": None, + "unstable": '!', + None: '!'})}), + "dev-util": + OrderedDict({"cmake": + OrderedDict({None: None})}), + "media-sound": + OrderedDict({"alsa-utils": + OrderedDict({None: None})})}) + assert template_object._document_dictionary == result_dict + + +@pytest.mark.formats +@pytest.mark.world +def test_parsing_template_with_warning(): + template_text = """www-client/chromium:stable +!!www-client/chromium:not_exist +!www-client/chromium +dev-util/cmake +alsa-utils +""" + + template_object = WorldFormat(template_text, + "/path/to/template/media-sound", + chroot_path=CHROOT_PATH) + result_dict = OrderedDict({"www-client": + OrderedDict({"chromium": + OrderedDict({"stable": None, + "not_exist": '!', + None: '!'})}), + "dev-util": + OrderedDict({"cmake": + OrderedDict({None: None})}), + "media-sound": + OrderedDict({"alsa-utils": + OrderedDict({None: None})})}) + assert template_object.warnings == [ + "package 'www-client/chromium:not_exist' not found"] + assert template_object._document_dictionary == result_dict + + +@pytest.mark.formats +@pytest.mark.world +def test_joining_template(): + original_text = """www-client/chromium:unstable +dev-python/pip +dev-util/cmake +clementine +""" + template_text = """www-client/chromium:stable +!!www-client/chromium:unstable +!www-client/chromium +dev-util/cmake +alsa-utils +""" + + original_object = WorldFormat(original_text, + "/path/to/template/media-sound", + chroot_path=CHROOT_PATH) + template_object = WorldFormat(template_text, + "/path/to/template/media-sound", + chroot_path=CHROOT_PATH) + result_dict = OrderedDict({"www-client": + OrderedDict({"chromium": + OrderedDict({"stable": None})}), + "dev-python": + OrderedDict({"pip": + OrderedDict({None: None})}), + "dev-util": + OrderedDict({"cmake": + OrderedDict({None: None})}), + "media-sound": + OrderedDict({"clementine": + OrderedDict({None: None}), + "alsa-utils": + OrderedDict({None: None})})}) + + original_object.join_template(template_object) + assert original_object._document_dictionary == result_dict + + +@pytest.mark.formats +@pytest.mark.world +def test_joining_and_get_text_without_header(): + original_text = """www-client/chromium:unstable +dev-python/pip +dev-util/cmake +clementine +""" + template_text = """www-client/chromium:stable +!!www-client/chromium:unstable +!www-client/chromium +dev-util/cmake +alsa-utils +""" + result_text = """dev-python/pip +dev-util/cmake +media-sound/alsa-utils +media-sound/clementine +www-client/chromium:stable +""" + + original_object = WorldFormat(original_text, + "/path/to/template/media-sound", + chroot_path=CHROOT_PATH) + template_object = WorldFormat(template_text, + "/path/to/template/media-sound", + chroot_path=CHROOT_PATH) + original_object.join_template(template_object) + assert original_object.document_text == result_text + + +@pytest.mark.formats +@pytest.mark.world +def test_joining_and_get_text_with_header(): + original_text = """www-client/chromium:unstable +dev-python/pip +dev-util/cmake +clementine +""" + template_text = """www-client/chromium:stable +!!www-client/chromium:unstable +!www-client/chromium +dev-util/cmake +alsa-utils +""" + result_text = """#------------------------------------------------------------------------------- +# Modified by Calculate Utilities 4.0 +# Processed template files: +# /path/to/template/media-sound +#------------------------------------------------------------------------------- +dev-python/pip +dev-util/cmake +media-sound/alsa-utils +media-sound/clementine +www-client/chromium:stable +""" + + original_object = WorldFormat(original_text, + "/path/to/template/media-sound", + chroot_path=CHROOT_PATH, + add_header=True) + template_object = WorldFormat(template_text, + "/path/to/template/media-sound", + chroot_path=CHROOT_PATH) + original_object.join_template(template_object) + assert original_object.document_text == result_text diff --git a/tests/templates/format/test_xml_gconf.py b/tests/templates/format/test_xml_gconf.py index aa07d13..e49f14e 100644 --- a/tests/templates/format/test_xml_gconf.py +++ b/tests/templates/format/test_xml_gconf.py @@ -3,6 +3,7 @@ from collections import OrderedDict from calculate.templates.format.xml_gconf_format import XMLGConfFormat +@pytest.mark.formats @pytest.mark.xml_gconf class TestParsingMethods: def test_if_input_document_is_simple_gconf_tree__the_format_object_contains_correct_dictionary(self): diff --git a/tests/templates/format/test_xml_xfce.py b/tests/templates/format/test_xml_xfce.py index 0970f82..d8387be 100644 --- a/tests/templates/format/test_xml_xfce.py +++ b/tests/templates/format/test_xml_xfce.py @@ -3,6 +3,7 @@ from collections import OrderedDict from calculate.templates.format.xml_xfce_format import XMLXfceFormat +@pytest.mark.formats @pytest.mark.xml_xfce class TestParsingMethods: def test_if_input_document_contains_just_few_parameter_lines__the_initialised_object_contains_correct_dictionary(self): diff --git a/tests/templates/format/testfiles/world/var/db/pkg/dev-python/pip/CONTENTS b/tests/templates/format/testfiles/world/var/db/pkg/dev-python/pip/CONTENTS new file mode 100644 index 0000000..e69de29 diff --git a/tests/templates/format/testfiles/world/var/db/pkg/dev-python/pip/SLOT b/tests/templates/format/testfiles/world/var/db/pkg/dev-python/pip/SLOT new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tests/templates/format/testfiles/world/var/db/pkg/dev-python/pip/SLOT @@ -0,0 +1 @@ +0 diff --git a/tests/templates/format/testfiles/world/var/db/pkg/dev-util/cmake-3.13-r1/CONTENTS b/tests/templates/format/testfiles/world/var/db/pkg/dev-util/cmake-3.13-r1/CONTENTS new file mode 100644 index 0000000..e69de29 diff --git a/tests/templates/format/testfiles/world/var/db/pkg/dev-util/cmake-3.13-r1/SLOT b/tests/templates/format/testfiles/world/var/db/pkg/dev-util/cmake-3.13-r1/SLOT new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tests/templates/format/testfiles/world/var/db/pkg/dev-util/cmake-3.13-r1/SLOT @@ -0,0 +1 @@ +0 diff --git a/tests/templates/format/testfiles/world/var/db/pkg/media-sound/alsa-utils-1.2.2/CONTENTS b/tests/templates/format/testfiles/world/var/db/pkg/media-sound/alsa-utils-1.2.2/CONTENTS new file mode 100644 index 0000000..e69de29 diff --git a/tests/templates/format/testfiles/world/var/db/pkg/media-sound/alsa-utils-1.2.2/SLOT b/tests/templates/format/testfiles/world/var/db/pkg/media-sound/alsa-utils-1.2.2/SLOT new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tests/templates/format/testfiles/world/var/db/pkg/media-sound/alsa-utils-1.2.2/SLOT @@ -0,0 +1 @@ +0 diff --git a/tests/templates/format/testfiles/world/var/db/pkg/media-sound/clementine-1.4.0_rc1/CONTENTS b/tests/templates/format/testfiles/world/var/db/pkg/media-sound/clementine-1.4.0_rc1/CONTENTS new file mode 100644 index 0000000..e69de29 diff --git a/tests/templates/format/testfiles/world/var/db/pkg/media-sound/clementine-1.4.0_rc1/SLOT b/tests/templates/format/testfiles/world/var/db/pkg/media-sound/clementine-1.4.0_rc1/SLOT new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tests/templates/format/testfiles/world/var/db/pkg/media-sound/clementine-1.4.0_rc1/SLOT @@ -0,0 +1 @@ +0 diff --git a/tests/templates/format/testfiles/world/var/db/pkg/www-client/chromium-88.0.404/CONTENTS b/tests/templates/format/testfiles/world/var/db/pkg/www-client/chromium-88.0.404/CONTENTS new file mode 100644 index 0000000..e69de29 diff --git a/tests/templates/format/testfiles/world/var/db/pkg/www-client/chromium-88.0.404/SLOT b/tests/templates/format/testfiles/world/var/db/pkg/www-client/chromium-88.0.404/SLOT new file mode 100644 index 0000000..2bf5ad0 --- /dev/null +++ b/tests/templates/format/testfiles/world/var/db/pkg/www-client/chromium-88.0.404/SLOT @@ -0,0 +1 @@ +stable diff --git a/tests/templates/format/testfiles/world/var/db/pkg/www-client/chromium-89.0.211/CONTENTS b/tests/templates/format/testfiles/world/var/db/pkg/www-client/chromium-89.0.211/CONTENTS new file mode 100644 index 0000000..e69de29 diff --git a/tests/templates/format/testfiles/world/var/db/pkg/www-client/chromium-89.0.211/SLOT b/tests/templates/format/testfiles/world/var/db/pkg/www-client/chromium-89.0.211/SLOT new file mode 100644 index 0000000..6842dbd --- /dev/null +++ b/tests/templates/format/testfiles/world/var/db/pkg/www-client/chromium-89.0.211/SLOT @@ -0,0 +1 @@ +unstable diff --git a/tests/templates/test_directory_processor.py b/tests/templates/test_directory_processor.py index 12159d7..7f2582c 100644 --- a/tests/templates/test_directory_processor.py +++ b/tests/templates/test_directory_processor.py @@ -2097,6 +2097,7 @@ def test_backgrounds_format_with_single_resolution(): @pytest.mark.directory_processor def test_backgrounds_format_making_no_changes(): + print("id datavars:", id(datavars)) datavars.main['cl_template_path'] = os.path.join(CHROOT_PATH, 'templates_69')