diff options
Diffstat (limited to 'tests/test-atomictempfile.py')
-rw-r--r-- | tests/test-atomictempfile.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/test-atomictempfile.py b/tests/test-atomictempfile.py index 9ebd7c0..c897ba8 100644 --- a/tests/test-atomictempfile.py +++ b/tests/test-atomictempfile.py @@ -12,21 +12,22 @@ def test1_simple(): assert basename in glob.glob('.foo-*') file.write('argh\n') - file.close() + file.rename() assert os.path.isfile('foo') assert basename not in glob.glob('.foo-*') print 'OK' -# discard() removes the temp file without making the write permanent -def test2_discard(): +# close() removes the temp file but does not make the write +# permanent -- essentially discards your work (WTF?!) +def test2_close(): if os.path.exists('foo'): os.remove('foo') file = atomictempfile('foo') (dir, basename) = os.path.split(file._tempname) file.write('yo\n') - file.discard() + file.close() assert not os.path.isfile('foo') assert basename not in os.listdir('.') @@ -44,5 +45,5 @@ def test3_oops(): if __name__ == '__main__': test1_simple() - test2_discard() + test2_close() test3_oops() |