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

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

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

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