Skip to main content

Generates pytest fixtures that allow the use of type hinting

Project description

pytest-factoryboy-fixtures

Writes pytest fixtures for FactoryBoy with type hinting. The hints allow for proper code completion in your tests when using PyCharm.

Usage

pytest-factoryboy-fixtures [comma seperated class names]

Add the generated code to your conftest.py.

Example

>>> pytest-factoryboy-fixtures FirstClass,SecondClass

    @fixture
    def first_class() -> FirstClass:
        return FirstClassFactory()
        
        
    @fixture
    def first_class_factory() -> Union[Type[FirstClass], Type[FirstClassFactory]]:
        return FirstClassFactory
        
        
    @fixture
    def second_class() -> SecondClass:
        return SecondClassFactory()
        
        
    @fixture
    def second_class_factory() -> Union[Type[SecondClass], Type[SecondClassFactory]]:
        return SecondClassFactory

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

pytest-factoryboy-fixtures-0.1.tar.gz (3.4 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page