December 9th, 2016

404

Passing fixtures to test in pytest

Оригинал: https://medium.com/@george.shuklin/passing-fixtures-to-test-in-pytest-e8dade1f01ff#.33tcjdsd0
Грамманаци саммонятся. Знатоки python/pytest призываются.

I’m working on project which uses pytest to run testinfra tests against cloud instances. Those tests should have information about servers they ought to test (IP address and credentials is a bare minimum).

After some thoughts I decided to create fixture(s) with all relevant information. The question I stumble was ‘how to pass it to pytest’? One of possible solutions is provided below.

Collapse )