semvec/pypi-packages huggingface dataset:
ucam-protobuf-testing 0.2.0
Testing support library for python protobuf projects
License: MIT
Requires Python: <4.0,>=3.10

# UCam Protobuf Testing Library

This project contains a support library to enable projects using python code
autogenerated from protobuf files to be more easily tested.

Currently it contains an auto-factory function supporting creating
[`factory-boy`](https://factoryboy.readthedocs.io/en/stable/introduction.html)
factories from
[`betterproto`](https://github.com/danielgtaylor/python-betterproto)
generated python code.

## Usage

Install the library via pip:

```console
pip install ucam-protobuf-testing
```

Then create a factory from a dataclass or betterproto message:

```python
@dataclass
class A:
    a_text: str
    integer: int
    value: float


class MyEnum(Enum):
    option1 = 1
    option2 = 2


@dataclass
class B:
    related: A
    an_enum: MyEnum
    list_of_str: list[str]


AFactory = auto_factory(A)
BFactory = auto_factory(B)
```

## Local Development

Install poetry via:

```console
pipx install poetry
pipx inject poetry poethepoet[poetry_plugin]
```

Install dependencies via:

```console
poetry install
```

Build the library via:

```console
poetry build
```

Run the tests via:

```console
poetry poe tox
```

### Dependencies

To add a new dependency for the library:

```console
poetry add {dependency}
```

To add a new development-time dependency, used only during testing:

```console
poetry add -G dev {dependency}
```

To remove a dependency which is no longer needed:

```console
poetry remove {dependency}
```

## CI configuration

The project is configured with Gitlab AutoDevOps via Gitlab CI using the .gitlab-ci.yml file.