[PATCH 3 of 5 oldpy] tests: update sitecustomize to use uuid1() instead of randrange()

Augie Fackler raf at durin42.com
Mon Nov 21 18:48:05 EST 2016


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1479768699 18000
#      Mon Nov 21 17:51:39 2016 -0500
# Node ID 59ed48548b8d21484008d3c8a9617dd6dddf13f4
# Parent  90385d2c7d7b968c4e36398f33f22fe9b28ec05b
tests: update sitecustomize to use uuid1() instead of randrange()

The comments mention that uuid would be better, so let's go ahead and
make good on an old idea.

diff --git a/tests/sitecustomize.py b/tests/sitecustomize.py
--- a/tests/sitecustomize.py
+++ b/tests/sitecustomize.py
@@ -4,11 +4,10 @@ import os
 if os.environ.get('COVERAGE_PROCESS_START'):
     try:
         import coverage
-        import random
+        import uuid
 
-        # uuid is better, but not available in Python 2.4.
         covpath = os.path.join(os.environ['COVERAGE_DIR'],
-                               'cov.%s' % random.randrange(0, 1000000000000))
+                               'cov.%s' % uuid.uuid1())
         cov = coverage.coverage(data_file=covpath, auto_data=True)
         cov._warn_no_data = False
         cov._warn_unimported_source = False


More information about the Mercurial-devel mailing list