Skip to content

when calling pytes.main([pathto\conftest.py tests\testsuite1.py::test1]) pytest_runtest_makereport doestn gets called #632

Answered by jgzzzz
jgzzzz asked this question in Q&A
Discussion options

You must be logged in to vote

if anybody is ever interested in knowing the solution, I reused code from this post:
https://github.com/pytest-dev/pytest-xdist/issues/79?ref=pythonrepo.com
and now pytest_runtest_makereport on my conftest.py gets called, the code looks like this:

def pytest_configure(config):
    config._foo = FooBar()
    config.pluginmanager.register(config._foo)


def pytest_unconfigure(config):
    foo = getattr(config, '_foo', None)
    if foo:
        del config._foo
        config.pluginmanager.unregister(foo)


class FooBar(object):
    # add docstrings from test cases to reports
    @pytest.hookimpl(tryfirst=True, hookwrapper=True)
    def pytest_runtest_makereport(self, item, call):
        out…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@jgzzzz
Comment options

Comment options

You must be logged in to vote
1 reply
@jgzzzz
Comment options

Comment options

You must be logged in to vote
1 reply
@BeyondEvil
Comment options

Answer selected by BeyondEvil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants