mercredi 24 mai 2017

What's the pytest equivalent for this simple Nose plugin?

I have a simple nose plugin

from nose.plugins import Plugin


class TestPlugin(Plugin):
    enabled = True
    def configure(self, options, conf):
        pass

    def startTest(self, test):
        self.thing = get_thing()

    def stopTest(self, test):
        self.thing.deactivate()

How can I achieve the same functionality in pytest? It looks like pytest_runtest_setup would be equivalent to startTest. Is that correct and is there an equivalent to stopTest?

Aucun commentaire:

Enregistrer un commentaire