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

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

    res = app.do_something()    # It is now test_1.json
    ...
Esempio n. 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()
    ...
Esempio n. 6
0
import app

app.do_something()
Esempio n. 7
0
def test_something():
    assert do_something()