Skip to main content

Testing support library for python protobuf projects

Project description

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 factories from betterproto generated python code.

Usage

Install the library via pip:

pip install ucam-protobuf-testing

Then create a factory from a dataclass or betterproto message:

@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:

pipx install poetry
pipx inject poetry poethepoet[poetry_plugin]

Install dependencies via:

poetry install

Build the library via:

poetry build

Run the tests via:

poetry poe tox

Dependencies

To add a new dependency for the library:

poetry add {dependency}

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

poetry add -G dev {dependency}

To remove a dependency which is no longer needed:

poetry remove {dependency}

CI configuration

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ucam_protobuf_testing-0.2.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ucam_protobuf_testing-0.2.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file ucam_protobuf_testing-0.2.0.tar.gz.

File metadata

  • Download URL: ucam_protobuf_testing-0.2.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for ucam_protobuf_testing-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ec73544e3e5951a80f2fbf2ccc3e3c59ac1ecb078378b796ea1e62c6b828a303
MD5 105c890e2ee719094ad9d3332e23244d
BLAKE2b-256 e7863a8947fdca80dae5718e3134e8dd1b1edfa61aa24e034920302b8b31328f

See more details on using hashes here.

File details

Details for the file ucam_protobuf_testing-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ucam_protobuf_testing-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 16cbdd515cb53453652530832de39140f3f9b74eaa60b43260846be13433181e
MD5 5f166e295e3ea0431ea120e8f4d5ff1d
BLAKE2b-256 f1eed63d36d34bb5a0bed2e8b936f4d2188e4b718c3d4d40214082d23a1a6118

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page