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

login
register
mail settings
Submitter Augie Fackler
Date Nov. 21, 2016, 11:48 p.m.
Message ID <59ed48548b8d21484008.1479772085@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/17674/
State Accepted
Headers show

Comments

Augie Fackler - Nov. 21, 2016, 11:48 p.m.
# HG changeset patch
# User Augie Fackler <augie@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.

Patch

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