Mercurial > hg-stable
comparison tests/test-atomictempfile.py @ 29393:50269a4dce61
atomictempfile: add read to the supported file operations
author | Martijn Pieters <mjpieters@fb.com> |
---|---|
date | Thu, 23 Jun 2016 18:20:58 +0100 |
parents | f21286e48bc6 |
children | 6d96658a22b0 |
comparison
equal
deleted
inserted
replaced
29392:f21286e48bc6 | 29393:50269a4dce61 |
---|---|
87 # of file timestamp (or test happened to be executed at | 87 # of file timestamp (or test happened to be executed at |
88 # bad timing). Exit silently in this case, because running | 88 # bad timing). Exit silently in this case, because running |
89 # on other faster platforms can detect problems | 89 # on other faster platforms can detect problems |
90 pass | 90 pass |
91 | 91 |
92 def testread(self): | |
93 with open(self._filename, 'wb') as f: | |
94 f.write(b'foobar\n') | |
95 file = atomictempfile(self._filename, mode='rb') | |
96 self.assertTrue(file.read(), b'foobar\n') | |
97 file.discard() | |
98 | |
92 if __name__ == '__main__': | 99 if __name__ == '__main__': |
93 import silenttestrunner | 100 import silenttestrunner |
94 silenttestrunner.main(__name__) | 101 silenttestrunner.main(__name__) |