-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
topic: fixturesanything involving fixtures directly or indirectlyanything involving fixtures directly or indirectlytopic: reportingrelated to terminal output and user-facing messages and errorsrelated to terminal output and user-facing messages and errors
Description
I'm getting an error saying that a fixture is not found, even though it is in the list of available fixtures
.
$ pytest test_linked.py
============================= test session starts ==============================
platform linux -- Python 3.6.3, pytest-3.2.3, py-1.4.34, pluggy-0.4.0
rootdir: /home/ravi/prj/nn, inifile:
collected 1 item
test_linked.py E
==================================== ERRORS ====================================
_____________________ ERROR at setup of test_linked_thing ______________________
file /home/ravi/prj/nn/test_linked.py, line 19
def test_linked_thing(linked_thing_1, linked_thing_2):
file /home/ravi/prj/nn/test_linked.py, line 9
@pytest.fixture
def linked_thing_1(linked_thing_2):
file /home/ravi/prj/nn/test_linked.py, line 14
@pytest.fixture
def linked_thing_2(linked_thing_1):
E fixture 'linked_thing_1' not found
> available fixtures: cache, capfd, capsys, doctest_namespace, linked_thing_1, linked_thing_2, monkeypatch, pytestconfig, record_xml_property, recwarn, tmpdir, tmpdir_factory
> use 'pytest --fixtures [testpath]' for help on them.
/home/ravi/prj/nn/test_linked.py:14
=========================== 1 error in 0.01 seconds ============================
$
test_linked.py
import pytest
class LinkedThing:
def __init__(self, other_linked_thing):
self.link = other_linked_thing
@pytest.fixture
def linked_thing_1(linked_thing_2):
return LinkedThing(linked_thing_2)
@pytest.fixture
def linked_thing_2(linked_thing_1):
return LinkedThing(linked_thing_1)
def test_linked_thing(linked_thing_1, linked_thing_2):
assert 1
Environment:
$ pytest --version
This is pytest version 3.2.3, imported from /home/ravi/.local/share/virtualenvs/nn/lib/python3.6/site-packages/pytest.py
$ uname -a
Linux svelte 4.13.11-1-MANJARO #1 SMP PREEMPT Thu Nov 2 13:37:46 UTC 2017 x86_64 GNU/Linux
$ pip list --format=columns
Package Version
----------------- ---------
certifi 2017.11.5
chardet 3.0.4
colorama 0.3.9
docopt 0.6.2
gevent 1.2.2
greenlet 0.4.12
idna 2.6
numpy 1.13.3
pbr 3.1.1
pigar 0.7.1
pip 9.0.1
pip-autoremove 0.9.0
pipreqs 0.4.9
py 1.4.34
pytest 3.2.3
requests 2.18.4
setuptools 36.6.0
six 1.11.0
stevedore 1.27.1
urllib3 1.22
virtualenv 15.1.0
virtualenv-clone 0.2.6
virtualenvwrapper 4.8.2
wheel 0.30.0
yarg 0.1.9
Is there a work-around?
charlax
Metadata
Metadata
Assignees
Labels
topic: fixturesanything involving fixtures directly or indirectlyanything involving fixtures directly or indirectlytopic: reportingrelated to terminal output and user-facing messages and errorsrelated to terminal output and user-facing messages and errors