Skip to content

TestConfig

Test Schema.

TestConfig dataclass

Configuration for testing task queues.

Attributes:

Name Type Description
worker bool

Worker.

broker bool

Broker.

storage bool

Storage.

global_config bool

Global config.

plugins bool

Plugins.

Source code in src/qtasks/schemas/test.py
 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
44
45
46
47
@dataclass
class TestConfig:
    """
    Configuration for testing task queues.

    Attributes:
        worker (bool): Worker.
        broker (bool): Broker.
        storage (bool): Storage.
        global_config (bool): Global config.
        plugins (bool): Plugins.
    """

    __test__ = False

    worker: bool = False
    broker: bool = False
    storage: bool = False
    global_config: bool = False
    plugins: bool = False

    @classmethod
    def full(cls):
        """Create a complete testing configuration."""
        return cls(
            worker=True, broker=True, storage=True, global_config=True, plugins=True
        )

    @classmethod
    def only_worker(cls, plugins: bool = False):
        """Create a testing configuration for the worker only."""
        return cls(worker=True, plugins=plugins)

    @classmethod
    def only_broker(cls, plugins: bool = False):
        """Create a test configuration for the broker only."""
        return cls(broker=True, plugins=plugins)

    @classmethod
    def full_broker(cls):
        """Create a complete testing configuration for the broker."""
        return cls(broker=True, storage=True, global_config=True, plugins=True)

full() classmethod

Create a complete testing configuration.

Source code in src/qtasks/schemas/test.py
27
28
29
30
31
32
@classmethod
def full(cls):
    """Create a complete testing configuration."""
    return cls(
        worker=True, broker=True, storage=True, global_config=True, plugins=True
    )

full_broker() classmethod

Create a complete testing configuration for the broker.

Source code in src/qtasks/schemas/test.py
44
45
46
47
@classmethod
def full_broker(cls):
    """Create a complete testing configuration for the broker."""
    return cls(broker=True, storage=True, global_config=True, plugins=True)

only_broker(plugins=False) classmethod

Create a test configuration for the broker only.

Source code in src/qtasks/schemas/test.py
39
40
41
42
@classmethod
def only_broker(cls, plugins: bool = False):
    """Create a test configuration for the broker only."""
    return cls(broker=True, plugins=plugins)

only_worker(plugins=False) classmethod

Create a testing configuration for the worker only.

Source code in src/qtasks/schemas/test.py
34
35
36
37
@classmethod
def only_worker(cls, plugins: bool = False):
    """Create a testing configuration for the worker only."""
    return cls(worker=True, plugins=plugins)