Skip to content

How to apply tinctures to all tests? #969

@Yutsuten

Description

@Yutsuten

This example in the documentation is awesome:

def time_request(stage):
    t0 = time.time()
    yield
    t1 = time.time()
    logger.info("Request for stage %s took %s", stage, t1 - t0)
# test_stuff.tavern.yaml
tinctures:
  - function: package.helpers:time_request

But I want to apply this to all tests and get all requests performance measured, so instead of adding these two lines of code to every single test, I'd like to use the including external files feature. I created an yaml file like this:

# include_tinctures.yaml
tinctures:
  - function: package.helpers:time_request

Then added this to pytest.ini:

[pytest]
tavern-global-cfg =
    include_tinctures.yaml

This should work like if we had this in every test, right?

includes:
  - !include include_tinctures.yaml

But I'm unable to make it work. Am I missing anything? Being able to do so would be awesome, tavern would become a performance tester too.

Thank you for the awesome tool by the way!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions