boakley / robotframework-lint

Linter for robot framework plain text files
Apache License 2.0
126 stars 48 forks source link

is_templated does not pay attention to [Template] setting on the test itself #45

Open ntdaley opened 7 years ago

ntdaley commented 7 years ago

Currently this won't pay attention to the [Template] setting on the test itself, only to the 'Test Template' setting on the parent file. (Also doesn't account for colon in the parent suite's setting name)

should probably be updated to something like:

@property
def is_templated(self):
    """Return True if the test is part of a suite that uses a Test Template"""
    for setting in self.settings:
        if setting[1].lower() == '[template]':
            return True
    for table in self.parent.tables:
        if isinstance(table, SettingTable):
            for row in table.rows:
                if row[0].lower().rstrip(':') == "test template":
                    return True
    return False