@pytest.fixture(params=['text', 'module'])
def makedoctest(self, testdir, request):

    def makeit(doctest):
        mode = request.param
        if (mode == 'text'):
            testdir.maketxtfile(doctest)
        else:
            assert (mode == 'module')
            testdir.makepyfile(('"""\n%s"""' % doctest))
    return makeit
@pytest.fixture(params=['text', 'module'])
def makedoctest(self, testdir, request):

    def makeit(doctest):
        mode = request.param
        if (mode == 'text'):
            testdir.maketxtfile(doctest)
        else:
            assert (mode == 'module')
            testdir.makepyfile(('"\n%s"' % doctest))
    return makeit