fschulze / pytest-pdb

pytest plugin which adds pdb helper commands related to pytest.
MIT License
12 stars 2 forks source link

gototest/whichtest is wrong during fixture setup #7

Open blueyed opened 5 years ago

blueyed commented 5 years ago

With a stack like the following gt/wt will pick frame 38 (fixtures.execute):

[32]   …/project/.venv/lib/python3.7/site-packages/_pytest/python.py(1442)setup()
-> fixtures.fillfixtures(self)
[33]   …/project/.venv/lib/python3.7/site-packages/_pytest/fixtures.py(297)fillfixtures()
-> request._fillfixtures()
[34]   …/project/.venv/lib/python3.7/site-packages/_pytest/fixtures.py(470)_fillfixtures()
-> item.funcargs[argname] = self.getfixturevalue(argname)
[35]   …/project/.venv/lib/python3.7/site-packages/_pytest/fixtures.py(517)getfixturevalue()
-> return self._get_active_fixturedef(argname).cached_result[0]
[36]   …/project/.venv/lib/python3.7/site-packages/_pytest/fixtures.py(540)_get_active_fixturedef()
-> self._compute_fixture_value(fixturedef)
[37]   …/project/.venv/lib/python3.7/site-packages/_pytest/fixtures.py(626)_compute_fixture_value()
-> fixturedef.execute(request=subrequest)
[38] > …/project/.venv/lib/python3.7/site-packages/_pytest/fixtures.py(927)execute()
-> return hook.pytest_fixture_setup(fixturedef=self, request=request)
[39]   …/project/.venv/lib/python3.7/site-packages/pluggy/hooks.py(284)__call__()
-> return self._hookexec(self, self.get_hookimpls(), kwargs)
[40]   …/project/.venv/lib/python3.7/site-packages/pluggy/manager.py(67)_hookexec()
-> return self._inner_hookexec(hook, methods, kwargs)
[41]   …/project/.venv/lib/python3.7/site-packages/pluggy/manager.py(61)<lambda>()
-> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False,
[42]   …/project/.venv/lib/python3.7/site-packages/pluggy/callers.py(187)_multicall()
-> res = hook_impl.function(*args)
[43]   …/project/.venv/lib/python3.7/site-packages/_pytest/fixtures.py(969)pytest_fixture_setup()
-> result = call_fixture_func(fixturefunc, request, kwargs)
[44]   …/project/.venv/lib/python3.7/site-packages/_pytest/fixtures.py(828)call_fixture_func()
-> res = fixturefunc(**kwargs)
[45]   …/project/tests/conftest.py(36)app()
-> app = get_app('127.0.0.1', '6379', loop=loop)
[46]   …/project/spokes/__init__.py(32)get_app()
-> loop = asyncio.get_event_loop()
(Pdb++)

Ref: https://github.com/fschulze/pytest-pdb/pull/5#discussion_r139697762.

https://github.com/fschulze/pytest-pdb/pull/5/files#diff-30e02d59448c958f16700f2683820a2cR7 was meant to handle this.

blueyed commented 5 years ago

@fschulze Is this something you are interested to have fixed? IIRC it previously would go to the fixture (if during setup/teardown).

fschulze commented 5 years ago

Yes, makes sense

blueyed commented 4 years ago

..unfortunately I do not feel really motivated giving the feedback to other PRs. Will likely add this to pdbpp directly sooner or later.