Manually Patching attribute


We can replace the attribute during the test run and create a json file locally to be used. At least two problems with this:


examples/exa/test_data_2.py
import app

def test_sum():
    app.data_file = 'test_1.json'    # manually overwrite

    res = app.get_sum()
    assert True
    assert res == 42

def test_again():
    print(app.data_file)             # it is still test_1.json

examples/exa/test_1.json
{
    "x": 19,
    "y": 23
}