From: W. Trevor King Date: Tue, 17 Aug 2010 10:38:18 +0000 (-0400) Subject: Use UUID in test/config.py's output file name. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4f73d07f91a9dad741535ba8d5f33f8ac3001427;p=hooke.git Use UUID in test/config.py's output file name. --- diff --git a/test/config.py b/test/config.py index 0ef82cb..7f31b13 100644 --- a/test/config.py +++ b/test/config.py @@ -21,6 +21,7 @@ Test the commands listed in :file:`doc/tutorial.txt`. >>> import os >>> import os.path +>>> from uuid import uuid4 >>> from hooke.hooke import Hooke, HookeRunner >>> h = Hooke() >>> r = HookeRunner() @@ -47,14 +48,15 @@ Success temperature = 295.3 ... ->>> config_already_exists = os.path.exists('myconfig.cfg') +>>> file_name = '%s.cfg' % uuid4() +>>> config_already_exists = os.path.exists(file_name) >>> config_already_exists False ->>> h = r.run_lines(h, ['save_config --output myconfig.cfg']) +>>> h = r.run_lines(h, ['save_config --output %s' % file_name]) Success ->>> os.path.isfile('myconfig.cfg') +>>> os.path.isfile(file_name) True >>> if config_already_exists == False: -... os.remove('myconfig.cfg') +... os.remove(file_name) """ diff --git a/test/export_block.py b/test/export_block.py index 15a01ed..161525e 100644 --- a/test/export_block.py +++ b/test/export_block.py @@ -29,12 +29,16 @@ Success >>> file_name = '%s.dat' % uuid4() +>>> export_already_exists = os.path.exists(file_name) +>>> export_already_exists +False >>> h = r.run_lines(h, ['export_block --output %s' % file_name]) Success >>> with open(file_name, 'r') as f: ... lines = f.readlines() ->>> os.remove(file_name) +>>> if export_already_exists == False: +... os.remove(file_name) >>> print len(lines) 2049 >>> print ''.join(lines[:5]), # doctest: +ELLIPSIS, +REPORT_UDIFF +NORMALIZE_WHITESPACE