コード例 #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'
コード例 #2
0
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"
コード例 #3
0
ファイル: test_config.py プロジェクト: stb-tester/stb-tester
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'
コード例 #4
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"
コード例 #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'
コード例 #6
0
ファイル: test_config.py プロジェクト: stb-tester/stb-tester
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'
コード例 #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'