Update hacking for Python3
The repo is Python 3 now, so update hacking to version 2.0 which supports Python 3. Fix problems found. Change-Id: I4cebf81b32bdf285f0d412255984c176140329be
This commit is contained in:
parent
546d00a803
commit
6fc8c9f785
|
@ -19,12 +19,13 @@ from muranopkgcheck.checkers import yaql_checker
|
|||
from muranopkgcheck import error
|
||||
|
||||
|
||||
ASSIGMENT_KEY = re.compile('^\$.?[\w]')
|
||||
ASSIGMENT_KEY = re.compile(r'^\$.?[\w]')
|
||||
|
||||
|
||||
def check_req(check, required=True):
|
||||
return locals()
|
||||
|
||||
|
||||
error.register.E203(description='Value should be string type')
|
||||
error.register.E200(description='No value should be here')
|
||||
error.register.E204(description='Wrong code structure/assigment')
|
||||
|
|
|
@ -142,5 +142,6 @@ def main():
|
|||
else:
|
||||
print('No errors found!')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
|
|
|
@ -84,5 +84,6 @@ class Register(object):
|
|||
self.errors[code] = props
|
||||
return _register
|
||||
|
||||
|
||||
report = Report(errors)
|
||||
register = Register(errors)
|
||||
|
|
|
@ -79,6 +79,7 @@ def load_cases():
|
|||
cases.extend(list(yaml.load_all(f)))
|
||||
return cases
|
||||
|
||||
|
||||
cases = load_cases()
|
||||
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ class MuranoPlTests(helpers.BaseValidatorTestClass):
|
|||
p_dict = deepcopy(MURANOPL_BASE['Properties'])
|
||||
p_dict['ports']['Contract'] = {
|
||||
'$.int()': '$.string()',
|
||||
'$.string()': {'$.int()': '$.ports()', '$.int()': {
|
||||
'$.string()': {'$.int()': {
|
||||
'$': [], '$.int()': '$.string()'}}
|
||||
}
|
||||
self.g = self.mpl_validator._valid_properties(p_dict)
|
||||
|
@ -254,7 +254,7 @@ class MuranoPlTests(helpers.BaseValidatorTestClass):
|
|||
p_dict = deepcopy(MURANOPL_BASE['Properties'])
|
||||
p_dict['ports']['Contract'] = {
|
||||
'$.int()': [],
|
||||
'$.int()': {}
|
||||
'$.string()': {}
|
||||
}
|
||||
self.g = self.mpl_validator._valid_properties(p_dict)
|
||||
|
||||
|
@ -265,7 +265,7 @@ class MuranoPlTests(helpers.BaseValidatorTestClass):
|
|||
p_dict = deepcopy(MURANOPL_BASE['Properties'])
|
||||
p_dict['ports']['Contract'] = [{
|
||||
'$.string()': '$.string()',
|
||||
'$.int()': [{'$.int()': '$.string()', '$.int()': []}]}]
|
||||
'$.int()': [{'$.int()': '$.string()', '$.string()': []}]}]
|
||||
self.g = self.mpl_validator._valid_properties(p_dict)
|
||||
|
||||
def test_contract_is_a_list_two_elements(self):
|
||||
|
|
|
@ -121,9 +121,9 @@ class BaseLoaderTest(base.TestCase):
|
|||
def test_search_for(self):
|
||||
fake = FakeLoader('fake')
|
||||
self.assertEqual(['1.yaml', 'sub/3.yaml'],
|
||||
list(fake.search_for('.*\.yaml$')))
|
||||
list(fake.search_for(r'.*\.yaml$')))
|
||||
self.assertEqual(['3.yaml'],
|
||||
list(fake.search_for('.*\.yaml$', subdir='sub')))
|
||||
list(fake.search_for(r'.*\.yaml$', subdir='sub')))
|
||||
|
||||
def test_read(self):
|
||||
fake = FakeLoader('fake')
|
||||
|
|
|
@ -21,8 +21,8 @@ import six
|
|||
from muranopkgcheck import error
|
||||
from muranopkgcheck.i18n import _
|
||||
|
||||
FQN_REGEX = re.compile('^([a-zA-Z_$][\w$]*\.)*[a-zA-Z_$][\w$]*$')
|
||||
NAME_REGEX = re.compile('^[A-Za-z_][\w]*$')
|
||||
FQN_REGEX = re.compile(r'^([a-zA-Z_$][\w$]*\.)*[a-zA-Z_$][\w$]*$')
|
||||
NAME_REGEX = re.compile(r'^[A-Za-z_][\w]*$')
|
||||
|
||||
error.register.E002(description='Yaml Error')
|
||||
error.register.E005(description='YAML multi document is not allowed')
|
||||
|
|
|
@ -62,7 +62,7 @@ error.register.W060(description='Wrong namespace fqn')
|
|||
class MuranoPLValidator(base.YamlValidator):
|
||||
def __init__(self, loaded_package):
|
||||
super(MuranoPLValidator, self).__init__(loaded_package,
|
||||
'Classes/.*\.yaml$',
|
||||
r'Classes/.*\.yaml$',
|
||||
True)
|
||||
self.yaql_checker = yaql_checker.YaqlChecker()
|
||||
self.code_structure = code_structure.CheckCodeStructure()
|
||||
|
|
|
@ -38,7 +38,7 @@ error.register.W100(description='Not known type. Probably typo')
|
|||
|
||||
class UiValidator(base.YamlValidator):
|
||||
def __init__(self, loaded_package):
|
||||
super(UiValidator, self).__init__(loaded_package, 'UI/.*\.yaml$')
|
||||
super(UiValidator, self).__init__(loaded_package, r'UI/.*\.yaml$')
|
||||
self.add_checker(self._valid_forms, 'Forms', False)
|
||||
self.add_checker(self._null_checker, 'Templates', False)
|
||||
self.add_checker(self._valid_application, 'Application', False)
|
||||
|
|
|
@ -89,6 +89,7 @@ class YamlLoader(BaseLoader):
|
|||
value.__yaml_meta__ = node.start_mark
|
||||
return value
|
||||
|
||||
|
||||
YamlLoader.add_constructor(
|
||||
u'tag:yaml.org,2002:seq',
|
||||
YamlLoader.construct_yaml_seq)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
|
||||
hacking<0.12,>=0.11.0 # Apache-2.0
|
||||
hacking>=2.0,<2.1 # Apache-2.0
|
||||
|
||||
coverage!=4.4,>=4.0 # Apache-2.0
|
||||
python-subunit>=1.0.0 # Apache-2.0/BSD
|
||||
|
|
|
@ -41,5 +41,6 @@ def main():
|
|||
with open('doc/source/_errors_list.rst', 'w') as f:
|
||||
f.write(r)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Reference in New Issue