예제 #1
0
def test_incorrect_schema(filename, schema, test_data):
    """ Test to validate the exception is raised for incorrect testcase schema"""
    filename = test_data + filename
    schema = scl.yaml_load(ZEPHYR_BASE + '/scripts/sanity_chk/' + schema)
    with pytest.raises(Exception) as exception:
        scl.yaml_load_verify(filename, schema)
        assert str(exception.value) == "Schema validation failed"
예제 #2
0
 def load(self, map_file):
     hwm_schema = scl.yaml_load(self.schema_path)
     duts = scl.yaml_load_verify(map_file, hwm_schema)
     for dut in duts:
         pre_script = dut.get('pre_script')
         post_script = dut.get('post_script')
         post_flash_script = dut.get('post_flash_script')
         platform = dut.get('platform')
         id = dut.get('id')
         runner = dut.get('runner')
         runner_params = dut.get('runner_params')
         serial_pty = dut.get('serial_pty')
         serial = dut.get('serial')
         baud = dut.get('baud', None)
         product = dut.get('product')
         fixtures = dut.get('fixtures', [])
         connected = dut.get('connected') and ((serial or serial_pty)
                                               is not None)
         if not connected:
             continue
         new_dut = DUT(platform=platform,
                       product=product,
                       runner=runner,
                       runner_params=runner_params,
                       id=id,
                       serial_pty=serial_pty,
                       serial=serial,
                       serial_baud=baud,
                       connected=connected,
                       pre_script=pre_script,
                       post_script=post_script,
                       post_flash_script=post_flash_script)
         new_dut.fixtures = fixtures
         new_dut.counter = 0
         self.duts.append(new_dut)
예제 #3
0
    def load_quarantine(self, file):
        """
        Loads quarantine list from the given yaml file. Creates a dictionary
        of all tests configurations (platform + scenario: comment) that shall be
        skipped due to quarantine
        """

        # Load yaml into quarantine_yaml
        quarantine_yaml = scl.yaml_load_verify(file, self.quarantine_schema)

        # Create quarantine_list with a product of the listed
        # platforms and scenarios for each entry in quarantine yaml
        quarantine_list = []
        for quar_dict in quarantine_yaml:
            if quar_dict['platforms'][0] == "all":
                plat = self.platform_names
            else:
                plat = quar_dict['platforms']
            comment = quar_dict.get('comment', "NA")
            quarantine_list.append([{".".join([p, s]): comment}
                                   for p in plat for s in quar_dict['scenarios']])

        # Flatten the quarantine_list
        quarantine_list = [it for sublist in quarantine_list for it in sublist]
        # Change quarantine_list into a dictionary
        for d in quarantine_list:
            self.quarantine.update(d)
예제 #4
0
    def load(self):
        self.data = scl.yaml_load_verify(self.filename, self.schema)

        if 'tests' in self.data:
            self.scenarios = self.data['tests']
        if 'common' in self.data:
            self.common = self.data['common']