pytest-fixtures Questions

6

I'm new to testing and I've stumbled across pytest fixtures, but I'm not entirely sure when to use them and why they're useful. For example, see the below code: import pytest @pytest.fixture def i...
Triacid asked 14/6, 2020 at 17:55

4

I have a fixture that is returning an object of certain type and I have another fixture defined in another file that basically uses the object to do other things. But I am not able to return the ob...
Bernstein asked 31/5, 2019 at 23:9

9

Solved

I would like to use fixtures as arguments of pytest.mark.parametrize or something that would have the same results. For example: import pytest import my_package @pytest.fixture def dir1_fixture()...

5

The baseline of all my tests is that there will always be a taxi with at least one passenger in it. I can easily achieve this setup with some basic fixtures: from blah import Passenger, Taxi @pyt...
Butte asked 21/6, 2017 at 13:22

8

Solved

Consider the following Pytest: import pytest class TimeLine(object): instances = [0, 1, 2] @pytest.fixture def timeline(): return TimeLine() def test_timeline(timeline): for instance in time...

6

Solved

I'm trying to understand what conftest.py files are meant to be used for. In my (currently small) test suite I have one conftest.py file at the project root. I use it to define the fixtures that I ...
Literator asked 25/12, 2015 at 20:8
1

© 2022 - 2024 — McMap. All rights reserved.