Example #1
0
def test_again():
    res = app.do_something()  # it is still test_1.json
    ...
Example #2
0
def test_app():
    app.data_file = 'test_1.json'  # manually overwrite

    res = app.do_something()  # it is now test_1.json
    ...
Example #3
0
def test_again():
    res = app.do_something() # back to the original value
    ...
Example #4
0
def test_sum(monkeypatch):
    monkeypatch.setattr(app, 'data_file', 'test_1.json')

    res = app.do_something()    # It is now test_1.json
    ...
Example #5
0
def test_sum(monkeypatch, tmpdir):
    fake_file = tmpdir.join('test_1.json')
    monkeypatch.setattr(app, 'data_file', fake_file)

    res = app.do_something()
    ...
Example #6
0
import app

app.do_something()
Example #7
0
def test_something():
    assert do_something()