Changeset 5008 for anuga_core/source/anuga/utilities/test_system_tools.py
- Timestamp:
- Feb 7, 2008, 6:28:04 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/utilities/test_system_tools.py
r4986 r5008 37 37 38 38 # Generate a text file 39 tmp_fd , tmp_name = mkstemp(suffix='.tmp', dir='.')40 fid = os.fdopen(tmp_fd, 'w')39 tmp_fd , tmp_name = mkstemp(suffix='.tmp', dir='.') 40 fid = os.fdopen(tmp_fd, 'w') 41 41 string = 'My temp file with textual content. AAAABBBBCCCC1234' 42 42 fid.write(string) 43 fid.flush()44 43 fid.close() 45 44 46 45 ref_crc = zlib.crc32(string) 47 48 46 checksum = compute_checksum(tmp_name) 49 50 51 47 assert checksum == ref_crc 52 48 … … 56 52 57 53 # Binary file 58 tmp_fd , tmp_name = mkstemp(suffix='.tmp',dir='.') 59 fid = os.fdopen(tmp_fd,'w+b') 60 54 tmp_fd , tmp_name = mkstemp(suffix='.tmp', dir='.') 55 fid = os.fdopen(tmp_fd, 'w+b') 61 56 62 57 string = 'My temp file with binary content. AAAABBBBCCCC1234' 63 58 fid.write(string) 64 fid. flush()59 fid.close() 65 60 66 61 … … 70 65 assert checksum == ref_crc 71 66 72 # Close and remove temporary file73 fid.close()74 67 os.remove(tmp_name) 75 68
Note: See TracChangeset
for help on using the changeset viewer.