Mercurial > hg
comparison tests/run-tests.py @ 29485:6a98f9408a50
py3: make files use absolute_import and print_function
This patch includes addition of absolute_import and print_function to the
files where they are missing. The modern importing conventions are also followed.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sun, 03 Jul 2016 22:28:24 +0530 |
parents | 89822d7a9d5f |
children | 348b2b9da703 |
comparison
equal
deleted
inserted
replaced
29484:53b7fc7cc2bb | 29485:6a98f9408a50 |
---|---|
41 # (You could use any subset of the tests: test-s* happens to match | 41 # (You could use any subset of the tests: test-s* happens to match |
42 # enough that it's worth doing parallel runs, few enough that it | 42 # enough that it's worth doing parallel runs, few enough that it |
43 # completes fairly quickly, includes both shell and Python scripts, and | 43 # completes fairly quickly, includes both shell and Python scripts, and |
44 # includes some scripts that run daemon processes.) | 44 # includes some scripts that run daemon processes.) |
45 | 45 |
46 from __future__ import print_function | 46 from __future__ import absolute_import, print_function |
47 | 47 |
48 from distutils import version | |
49 import difflib | 48 import difflib |
49 import distutils.version as version | |
50 import errno | 50 import errno |
51 import json | 51 import json |
52 import optparse | 52 import optparse |
53 import os | 53 import os |
54 import random | |
55 import re | |
54 import shutil | 56 import shutil |
55 import subprocess | |
56 import signal | 57 import signal |
57 import socket | 58 import socket |
59 import subprocess | |
58 import sys | 60 import sys |
59 import tempfile | 61 import tempfile |
62 import threading | |
60 import time | 63 import time |
61 import random | 64 import unittest |
62 import re | 65 import xml.dom.minidom as minidom |
63 import threading | 66 |
64 import killdaemons as killmod | |
65 try: | 67 try: |
66 import Queue as queue | 68 import Queue as queue |
67 except ImportError: | 69 except ImportError: |
68 import queue | 70 import queue |
69 from xml.dom import minidom | |
70 import unittest | |
71 | 71 |
72 if os.environ.get('RTUNICODEPEDANTRY', False): | 72 if os.environ.get('RTUNICODEPEDANTRY', False): |
73 try: | 73 try: |
74 reload(sys) | 74 reload(sys) |
75 sys.setdefaultencoding("undefined") | 75 sys.setdefaultencoding("undefined") |
473 getattr(proc, 'terminate', lambda : os.kill(proc.pid, signal.SIGTERM))() | 473 getattr(proc, 'terminate', lambda : os.kill(proc.pid, signal.SIGTERM))() |
474 except OSError: | 474 except OSError: |
475 pass | 475 pass |
476 | 476 |
477 def killdaemons(pidfile): | 477 def killdaemons(pidfile): |
478 import killdaemons as killmod | |
478 return killmod.killdaemons(pidfile, tryhard=False, remove=True, | 479 return killmod.killdaemons(pidfile, tryhard=False, remove=True, |
479 logfn=vlog) | 480 logfn=vlog) |
480 | 481 |
481 class Test(unittest.TestCase): | 482 class Test(unittest.TestCase): |
482 """Encapsulates a single, runnable test. | 483 """Encapsulates a single, runnable test. |
2491 sys.stdout.write(out) | 2492 sys.stdout.write(out) |
2492 sys.exit(1) | 2493 sys.exit(1) |
2493 | 2494 |
2494 def _outputcoverage(self): | 2495 def _outputcoverage(self): |
2495 """Produce code coverage output.""" | 2496 """Produce code coverage output.""" |
2496 from coverage import coverage | 2497 import coverage |
2498 coverage = coverage.coverage | |
2497 | 2499 |
2498 vlog('# Producing coverage report') | 2500 vlog('# Producing coverage report') |
2499 # chdir is the easiest way to get short, relative paths in the | 2501 # chdir is the easiest way to get short, relative paths in the |
2500 # output. | 2502 # output. |
2501 os.chdir(self._hgroot) | 2503 os.chdir(self._hgroot) |