Skip to content

Allow defining port (and maybe other configuration) at runtime #308

Description

@guludo

Hi there,

I have a use case where I will only know the port to a running instance of mongo at runtime (and I'm able to get that via a session-scoped fixture). I would like to be able to tell pytest-mongo to use such a port. By looking at the documentation, it seems that there isn't a supported way of passing the port (or other configuration) to pytest-mongo at runtime. That would really be useful.

A way I can think of providing such a feature is to allow users to override a fixture that will give the configuration necessary. For example:

@pyest.fixture(scope='session')
def pytest_mongo_conf(my, own, required, fixtures, here):
    ... # Get host and port from other fixtures
    # Options defined in the returned dictionary would override their previous (or default) values
    return {
        'host': host,
        'port': port,
    }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions