Skip to content

How can I set environment variables (i.e. config properties) when unit test using Python? #157

@shengjun-zh

Description

@shengjun-zh

Refer to the document below, I can do unit test using Python, but I found there is no way to pass the environment variables (i.e. config properties) when calling setup_fn_call().

https://github.com/fnproject/fdk-python#unit-testing-your-functions

@pytest.mark.asyncio
async def test_parse_request_without_data():
    call = await fixtures.setup_fn_call(handler)

    content, status, headers = await call

    assert 200 == status
    assert {"message": "Hello World"} == json.loads(content)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions