The issue is that the names RUN_FOLDER
and fixture
scoped to the function setup
and so will not be available to test_scrape_wellformed_html
. If you look at the code for with_setup
you will see that it does not do anything to alter the run function's environment.
In order to do what you want to do you need to make your fixtures global variables:
testapp = app.test_client()
RUN_FOLDER = os.path.dirname(os.path.realpath(__file__))
fixture = None
def setup():
global fixture
app.config['TESTING'] = True
fixture = {'html_hash':'aaaa'} #mocking the hash
def teardown():
global fixture
app.config['TESTING'] = False
fixture = None
@with_setup(setup, teardown)
def test_scrape_wellformed_html():
# run test here