public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
blob 8f7fe68875837a7dce32b8e182ee9772a9bb2bbb 935 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
 
#! /usr/bin/python3

# SPDX-License-Identifier: GPL-2.0-or-later
#
# Copyright Red Hat
# Author: David Gibson <david@gibson.dropbear.id.au>

"""
Manage the manifest of classless tests in a module
"""

import sys

MANIFEST = "__avocado_classless__"


def manifest(mod):
    """Return avocado-classless manifest for a Python module"""
    if not hasattr(mod, MANIFEST):
        setattr(mod, MANIFEST, {})
    return getattr(mod, MANIFEST)


class ManifestTestInfo:  # pylint: disable=R0903
    """Metadata about a classless test"""

    def __init__(self, func):
        self.func = func

    def run_test(self):
        self.func()


def manifest_add(mod, name, func):
    """Register a function as a classless test"""

    if isinstance(mod, str):
        mod = sys.modules[mod]

    mfest = manifest(mod)
    if name in mfest:
        raise ValueError(f"Duplicate classless test name {name}")
    mfest[name] = ManifestTestInfo(func)

debug log:

solving 8f7fe688 ...
found 8f7fe688 in https://archives.passt.top/passt-dev/20230627025429.2209702-7-david@gibson.dropbear.id.au/

applying [1/1] https://archives.passt.top/passt-dev/20230627025429.2209702-7-david@gibson.dropbear.id.au/
diff --git a/test/avocado_classless/avocado_classless/manifest.py b/test/avocado_classless/avocado_classless/manifest.py
new file mode 100644
index 00000000..8f7fe688

Checking patch test/avocado_classless/avocado_classless/manifest.py...
Applied patch test/avocado_classless/avocado_classless/manifest.py cleanly.

index at:
100644 8f7fe68875837a7dce32b8e182ee9772a9bb2bbb	test/avocado_classless/avocado_classless/manifest.py

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).