Exemple #1
0
def test_sponge_that_on_exception_file_isnt_modified():
    with scoped_curdir():
        open('foo', 'w').write('bar')
        try:
            with _sponge('foo') as f:
                f.write('hello')
                raise RuntimeError()
        except RuntimeError:
            pass
        assert open('foo').read() == 'bar'
def test_sponge_that_on_exception_file_isnt_modified():
    with _directory_sandbox():
        open("foo", "w").write("bar")
        try:
            with _sponge("foo") as f:
                f.write("hello")
                raise RuntimeError()
        except RuntimeError:
            pass
        assert open("foo").read() == "bar"
Exemple #3
0
def test_sponge_that_on_exception_file_isnt_modified():
    with scoped_curdir():
        open('foo', 'w').write('bar')
        try:
            with _sponge('foo') as f:
                f.write('hello')
                raise RuntimeError()
        except RuntimeError:
            pass
        assert open('foo').read() == 'bar'
def test_sponge_that_new_data_end_up_in_file():
    with _directory_sandbox():
        with _sponge("hello") as f:
            f.write("hello")
        assert open("hello").read() == "hello"
Exemple #5
0
def test_sponge_that_new_data_end_up_in_file():
    with scoped_curdir():
        with _sponge('hello') as f:
            f.write('hello')
        assert open('hello').read() == 'hello'
Exemple #6
0
def test_sponge_that_new_data_end_up_in_file():
    with scoped_curdir():
        with _sponge('hello') as f:
            f.write('hello')
        assert open('hello').read() == 'hello'
Exemple #7
0
def test_sponge_that_new_data_end_up_in_file():
    with _directory_sandbox():
        with _sponge('hello') as f:
            f.write('hello')
        assert open('hello').read() == 'hello'