Esempio n. 1
0
 def _get_deprecated_setter(self, name):
     normalized = normalize(name)
     for setting in list(self._setters) + list(self._aliases):
         if normalize(setting) == normalized:
             self._report_deprecated_setting(name, setting)
             return self._get_setter(setting)
     return None
Esempio n. 2
0
 def _resolve_deprecated_table(self, used_name):
     normalized = normalize(used_name)
     for name in (self._setting_table_names + self._variable_table_names +
                  self._testcase_table_names + self._keyword_table_names +
                  self._comment_table_names):
         if normalize(name) == normalized:
             self._report_deprecated_table(used_name, name)
             return name
     return None
Esempio n. 3
0
 def _get_attr(self, fields, name, upper=False):
     name = 'ROBOT_LIBRARY_' + name
     for field in fields:
         if field.getSimpleName().toString() == name:
             value = field.getConstantValue()
             if upper:
                 value = normalize(value, ignore='_').upper()
             return value
     return ''
Esempio n. 4
0
 def _get_attr(self, doc, name, upper=False):
     name = 'ROBOT_LIBRARY_' + name
     for field in doc.fields():
         if field.name() == name and field.isPublic():
             value = field.constantValue()
             if upper:
                 value = normalize(value, ignore='_').upper()
             return value
     return ''
Esempio n. 5
0
 def _set_execution_mode(self, data):
     rpa = normalize(data.testcase_table.header[0]) in ('task', 'tasks')
     if self.rpa is None:
         self.rpa = rpa
     elif self.rpa is not rpa:
         this, that = ('tasks', 'tests') if rpa else ('tests', 'tasks')
         raise DataError("Conflicting execution modes. File '%s' has %s "
                         "but files parsed earlier have %s. Fix headers "
                         "or use '--rpa' or '--norpa' options to set the "
                         "execution mode explicitly."
                         % (data.source, this, that))
Esempio n. 6
0
 def _get_flavor_and_index(self, declaration):
     for index, item in enumerate(declaration):
         if item in self.flavors:
             return item, index
         if item in self.normalized_flavors:
             correct = self.normalized_flavors[item]
             self._report_deprecated_flavor_syntax(item, correct)
             return correct, index
         if normalize(item).startswith('in'):
             return item.upper(), index
     return 'IN', len(declaration)
Esempio n. 7
0
 def __init__(self, name):
     #: Human readable identifier of the object these statistics
     #: belong to. Either `All Tests` or `Critical Tests` for
     #: :class:`~robot.model.totalstatistics.TotalStatistics`,
     #: long name of the suite for
     #: :class:`~robot.model.suitestatistics.SuiteStatistics`
     #: or name of the tag for
     #: :class:`~robot.model.tagstatistics.TagStatistics`
     self.name = name
     #: Number of passed tests.
     self.passed = 0
     #: Number of failed tests.
     self.failed = 0
     #: Number of milliseconds it took to execute.
     self.elapsed = 0
     self._norm_name = normalize(name, ignore='_')
Esempio n. 8
0
 def _get_attr(self, object, attr, default='', upper=False):
     value = unic(getattr(object, attr, default))
     if upper:
         value = normalize(value, ignore='_').upper()
     return value
Esempio n. 9
0
def _get_scope(libcode):
    if inspect.ismodule(libcode):
        return 'global'
    scope = getattr(libcode, 'ROBOT_LIBRARY_SCOPE', '')
    return normalize(unic(scope), ignore='_')
Esempio n. 10
0
 def _validate_mode(self, name1, name2):
     tasks1 = normalize(name1) in ('task', 'tasks')
     tasks2 = normalize(name2) in ('task', 'tasks')
     if tasks1 is not tasks2:
         raise DataError('One file cannot have both tests and tasks.')
Esempio n. 11
0
 def find(self, name):
     number = normalize(name)[2:-1]
     try:
         return self._get_int(number)
     except ValueError:
         return float(number)
Esempio n. 12
0
File: model.py Progetto: Garjy/RIDE
 def normalize(self, setting):
     result = normalize(setting)
     return result[0:-1] if result and result[-1]==':' else result