def test_test_invalid(): """ Test invalid test """ # Missing name with pytest.raises(tmt.utils.GeneralError): test = tmt.Test({}) # Invalid name with pytest.raises(tmt.utils.SpecificationError): test = tmt.Test({}, name='bad') # Invalid attributes for key in ['component', 'require', 'tag']: with pytest.raises(tmt.utils.SpecificationError): test = tmt.Test({key: 'string'}, name='/smoke') with pytest.raises(tmt.utils.SpecificationError): test = tmt.Test({'environment': 'string'}, name='/smoke')
def load(self): """ Load step data from the workdir """ super(Discover, self).load() try: tests = tmt.utils.yaml_to_dict(self.read('tests.yaml')) self._tests = [ tmt.Test(data, name) for name, data in tests.items()] except tmt.utils.FileError: self.debug('Discovered tests not found.', level=2)
def test_test_defaults(): """ Test default test attributes """ test = tmt.Test(dict(test='./test.sh'), name='/smoke') assert test.name == '/smoke' assert test.component == list() assert test.test == './test.sh' assert test.path == '/smoke' assert test.require == list() assert test.environment == dict() assert test.duration == '5m' assert test.enabled == True assert test.result == 'respect' assert test.tag == list()