Mercurial > hg > AtomicWrite
annotate 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 |
rev | line source |
---|---|
0 | 1 #!/usr/bin/env python |
2 | |
3 """ | |
4 unit tests for AtomicWrite | |
5 """ | |
6 | |
1 | 7 import atomic |
0 | 8 import os |
9 import tempfile | |
10 import unittest | |
11 | |
12 class AtomicWriteUnitTest(unittest.TestCase): | |
13 | |
14 def test_atomicwrite(self): | |
15 tf = tempfile.mktemp() | |
16 self.assertFalse(os.path.exists(tf)) | |
1 | 17 atomic.write('foo', tf) |
18 self.assertTrue(os.path.exists(tf)) | |
19 self.assertEqual(open(tf, 'r').read(), 'foo') | |
0 | 20 |
21 if __name__ == '__main__': | |
22 unittest.main() | |
23 |