Mercurial > hg > AtomicWrite
view tests/test_atomicwrite.py @ 1:a4188f41ca35 default tip
basically the thing
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Fri, 02 Jan 2015 13:22:09 -0800 |
parents | dc90512b9c98 |
children |
line wrap: on
line source
#!/usr/bin/env python """ unit tests for AtomicWrite """ import atomic import os import tempfile import unittest class AtomicWriteUnitTest(unittest.TestCase): def test_atomicwrite(self): tf = tempfile.mktemp() self.assertFalse(os.path.exists(tf)) atomic.write('foo', tf) self.assertTrue(os.path.exists(tf)) self.assertEqual(open(tf, 'r').read(), 'foo') if __name__ == '__main__': unittest.main()