Esempio n. 1
0
    def delete(self, using=None):
        """Delete the record from the DB and the main_test content.

        The main_test will be deleted from the DB and the FileSystem.
        """
        get_sub_model(self.main_test).delete(using)
        super(RunData, self).delete(using)
Esempio n. 2
0
    def leaf(self):
        """Return the leaf resource-data inheriting from self."""
        sub_model = get_sub_model(self)
        if sub_model is None:
            return self

        return sub_model.leaf
Esempio n. 3
0
    def main_test_link(self):
        """Return a link to the test admin page.

        Returns:
            str. link to the main test's admin page.
        """
        if self.main_test is not None:
            return get_sub_model(self.main_test).admin_link

        return None
Esempio n. 4
0
def _generate_tests_tree_by_run_name(run_name):
    """Create a pseudo-test item summarizing the tests of the run name.

    Note:
        The summary assumes the last run contained all the relevant tests,
        tests not shown on the last run are not included.

    Args:
        run_name (str): name of the run to summarize.

    Returns:
        TestSimulator. pseudo-test item representing the original test tree.
    """
    run_datas = RunData.objects.filter(run_name=run_name,
                   main_test__isnull=False).order_by('main_test__start_time')

    if not run_datas.exists():
        raise RuntimeError("No runs found for run name %r" % run_name)

    last_run = run_datas.last()
    actual_main_test = get_sub_model(last_run.main_test)
    return _generate_tests_tree_by_data(actual_main_test)