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.1.0.tar.gz (4.1 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.1.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ucam_protobuf_testing-0.1.0.tar.gz
  • Upload date:
  • Size: 4.1 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.1.0.tar.gz
Algorithm Hash digest
SHA256 8f561a7744e8673a3bce74cc2e740c7416b5c83930c025671ff968210c129cba
MD5 af783e64026d7b787389023fcd131edf
BLAKE2b-256 24a037427e38ce31e438806aa5d1689cb8fee4bdc9e627a8cf8f14eb0d2074d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ucam_protobuf_testing-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ae3512739027e6476a0b8a3ca6b2465cc2f6d6061576fc90357bb4dd0fa35581
MD5 0aaf043c28fa279b124f7fc5055e3e30
BLAKE2b-256 b5af14ee3a5517ea6c31c53af40fff1d9e949e5bef2c441816aa6e4ed20fb9fc

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