Exemple #1
0
class TestGroupReportSchema(TestCaseReportSchema):
    """
    Schema for ``testing.TestGroupReportSchema``, supports tree serialization.
    """

    source_class = TestGroupReport
    # category = fields.String()
    part = fields.List(fields.Integer, allow_none=True)
    fix_spec_path = fields.String(allow_none=True)
    env_status = fields.String(allow_none=True)

    # status_reason = fields.String(allow_none=True)
    # runtime_status = fields.String(dump_only=True)
    # counter = fields.Dict(dump_only=True)

    entries = custom_fields.GenericNested(
        schema_context={
            TestCaseReport: TestCaseReportSchema,
            TestGroupReport: "self",
        },
        many=True,
    )

    @post_load
    def make_report(self, data):
        """
        Propagate tag indices after deserialization
        """
        rep = super(TestGroupReportSchema, self).make_report(data)
        rep.propagate_tag_indices()
        return rep
Exemple #2
0
class TestReportSchema(Schema):
    """Schema for test report root, ``testing.TestReport``."""

    timer = TimerField()
    name = fields.String()
    uid = fields.UUID()
    meta = fields.Dict()

    status = fields.String(dump_only=True)
    tags_index = TagField(dump_only=True)
    status_override = fields.String(allow_none=True)

    entries = custom_fields.GenericNested(
        schema_context={TestGroupReport: TestGroupReportSchema}, many=True)

    @post_load
    def make_test_report(self, data):  # pylint: disable=no-self-use
        """Create report object & deserialize sub trees."""
        load_tree = functools.partial(
            load_tree_data,
            node_schema=TestGroupReportSchema,
            leaf_schema=TestCaseReportSchema,
        )

        entry_data = data.pop('entries')
        status_override = data.pop('status_override')
        timer = data.pop('timer')

        test_plan_report = TestReport(**data)
        test_plan_report.entries = [load_tree(c_data) for c_data in entry_data]
        test_plan_report.status_override = status_override
        test_plan_report.timer = timer
        return test_plan_report
Exemple #3
0
class TestGroupReportSchema(TestCaseReportSchema):
    """
    Schema for ``testing.TestGroupReportSchema``, supports tree serialization.
    """

    source_class = TestGroupReport
    part = fields.List(fields.Integer, allow_none=True)
    fix_spec_path = fields.String(allow_none=True)
    env_status = fields.String(allow_none=True)
    strict_order = fields.Bool()
    category = fields.String()

    entries = custom_fields.GenericNested(
        schema_context={
            TestCaseReport: TestCaseReportSchema,
            TestGroupReport: lambda: TestGroupReportSchema(),
        },
        many=True,
    )

    @post_load
    def make_report(self, data, **kwargs):
        """
        Propagate tag indices after deserialization
        """
        rep = super(TestGroupReportSchema, self).make_report(data)
        rep.propagate_tag_indices()
        return rep
Exemple #4
0
class TestReportSchema(Schema):
    """Schema for test report root, ``testing.TestReport``."""
    class Meta:
        unknown = EXCLUDE

    name = fields.String(required=True)
    description = fields.String(allow_none=True)
    uid = fields.String(required=True)
    category = fields.String(dump_only=True)
    timer = TimerField(required=True)
    meta = fields.Dict()
    label = fields.String(allow_none=True)

    status_override = fields.String(allow_none=True)
    status = fields.String()
    runtime_status = fields.String()
    tags_index = TagField(dump_only=True)
    information = fields.List(fields.List(fields.String()))
    counter = fields.Dict(dump_only=True)

    attachments = fields.Dict()
    logs = fields.Nested(ReportLogSchema, many=True)
    timeout = fields.Integer(allow_none=True)

    entries = custom_fields.GenericNested(
        schema_context={TestGroupReport: TestGroupReportSchema}, many=True)

    @post_load
    def make_test_report(self, data, **kwargs):
        """Create report object & deserialize sub trees."""
        load_tree = functools.partial(
            load_tree_data,
            node_schema=TestGroupReportSchema,
            leaf_schema=TestCaseReportSchema,
        )

        entry_data = data.pop("entries")
        status_override = data.pop("status_override")
        status = data.pop("status")
        runtime_status = data.pop("runtime_status")
        timer = data.pop("timer")
        timeout = data.pop("timeout", None)
        logs = data.pop("logs", [])

        test_plan_report = TestReport(**data)
        test_plan_report.entries = [load_tree(c_data) for c_data in entry_data]
        test_plan_report.propagate_tag_indices()

        test_plan_report.status_override = status_override
        test_plan_report.status = status
        test_plan_report.runtime_status = runtime_status
        test_plan_report.timer = timer
        test_plan_report.timeout = timeout
        test_plan_report.logs = logs

        return test_plan_report
Exemple #5
0
class ReportGroupSchema(ReportSchema):
    """Schema for ``base.ReportGroup``."""

    source_class = ReportGroup

    entries = custom_fields.GenericNested(schema_context={
        'Report': ReportSchema,
        'ReportGroup': 'self'
    },
                                          many=True)
Exemple #6
0
class ReportGroupSchema(ReportSchema):
    """Schema for ``base.ReportGroup``."""

    source_class = ReportGroup

    entries = custom_fields.GenericNested(
        schema_context={
            "Report": ReportSchema,
            "ReportGroup": lambda: ReportGroupSchema(),
        },
        many=True,
    )
Exemple #7
0
class TestGroupReportSchema(TestCaseReportSchema):
    """
    Schema for ``testing.TestGroupReportSchema``, supports tree serialization.
    """

    source_class = TestGroupReport
    category = fields.String(allow_none=True)

    entries = custom_fields.GenericNested(schema_context={
        TestCaseReport: TestCaseReportSchema,
        TestGroupReport: 'self'
    },
                                          many=True)
Exemple #8
0
class TestGroupReportSchema(TestCaseReportSchema):
    """
    Schema for ``testing.TestGroupReportSchema``, supports tree serialization.
    """

    source_class = TestGroupReport
    category = fields.String(allow_none=True)
    part = fields.List(fields.Integer, allow_none=True)

    entries = custom_fields.GenericNested(schema_context={
        TestCaseReport: TestCaseReportSchema,
        TestGroupReport: 'self'
    },
                                          many=True)

    @post_load
    def make_report(self, data):
        """
        Propagate tag indices after deserialization
        """
        rep = super(TestGroupReportSchema, self).make_report(data)
        rep.propagate_tag_indices()
        return rep