Show More
@@ -93,8 +93,10 b' def parseargs():' | |||||
93 | parser.add_option("-k", "--keywords", |
|
93 | parser.add_option("-k", "--keywords", | |
94 | help="run tests matching keywords") |
|
94 | help="run tests matching keywords") | |
95 | parser.add_option("--keep-tmpdir", action="store_true", |
|
95 | parser.add_option("--keep-tmpdir", action="store_true", | |
96 | help="keep temporary directory after running tests" |
|
96 | help="keep temporary directory after running tests") | |
97 | " (best used with --tmpdir)") |
|
97 | parser.add_option("--tmpdir", type="string", | |
|
98 | help="run tests in the given temporary directory" | |||
|
99 | " (implies --keep-tmpdir)") | |||
98 | parser.add_option("-R", "--restart", action="store_true", |
|
100 | parser.add_option("-R", "--restart", action="store_true", | |
99 | help="restart at last error") |
|
101 | help="restart at last error") | |
100 | parser.add_option("-p", "--port", type="int", |
|
102 | parser.add_option("-p", "--port", type="int", | |
@@ -109,8 +111,6 b' def parseargs():' | |||||
109 | parser.add_option("-t", "--timeout", type="int", |
|
111 | parser.add_option("-t", "--timeout", type="int", | |
110 | help="kill errant tests after TIMEOUT seconds" |
|
112 | help="kill errant tests after TIMEOUT seconds" | |
111 | " (default: $%s or %d)" % defaults['timeout']) |
|
113 | " (default: $%s or %d)" % defaults['timeout']) | |
112 | parser.add_option("--tmpdir", type="string", |
|
|||
113 | help="run tests in the given temporary directory") |
|
|||
114 | parser.add_option("-v", "--verbose", action="store_true", |
|
114 | parser.add_option("-v", "--verbose", action="store_true", | |
115 | help="output verbose messages") |
|
115 | help="output verbose messages") | |
116 | parser.add_option("-n", "--nodiff", action="store_true", |
|
116 | parser.add_option("-n", "--nodiff", action="store_true", | |
@@ -173,11 +173,6 b' def parseargs():' | |||||
173 |
|
173 | |||
174 | if options.tmpdir: |
|
174 | if options.tmpdir: | |
175 | options.tmpdir = os.path.expanduser(options.tmpdir) |
|
175 | options.tmpdir = os.path.expanduser(options.tmpdir) | |
176 | try: |
|
|||
177 | os.makedirs(options.tmpdir) |
|
|||
178 | except OSError, err: |
|
|||
179 | if err.errno != errno.EEXIST: |
|
|||
180 | raise |
|
|||
181 |
|
176 | |||
182 | if options.jobs < 1: |
|
177 | if options.jobs < 1: | |
183 | parser.error('--jobs must be positive') |
|
178 | parser.error('--jobs must be positive') | |
@@ -765,8 +760,24 b' def main():' | |||||
765 |
|
760 | |||
766 | global TESTDIR, HGTMP, INST, BINDIR, PYTHONDIR, COVERAGE_FILE |
|
761 | global TESTDIR, HGTMP, INST, BINDIR, PYTHONDIR, COVERAGE_FILE | |
767 | TESTDIR = os.environ["TESTDIR"] = os.getcwd() |
|
762 | TESTDIR = os.environ["TESTDIR"] = os.getcwd() | |
768 | HGTMP = os.environ['HGTMP'] = os.path.realpath(tempfile.mkdtemp('', 'hgtests.', |
|
763 | if options.tmpdir: | |
769 | options.tmpdir)) |
|
764 | options.keep_tmpdir = True | |
|
765 | tmpdir = options.tmpdir | |||
|
766 | if os.path.exists(tmpdir): | |||
|
767 | # Meaning of tmpdir has changed since 1.3: we used to create | |||
|
768 | # HGTMP inside tmpdir; now HGTMP is tmpdir. So fail if | |||
|
769 | # tmpdir already exists. | |||
|
770 | sys.exit("error: temp dir %r already exists" % tmpdir) | |||
|
771 | ||||
|
772 | # Automatically removing tmpdir sounds convenient, but could | |||
|
773 | # really annoy anyone in the habit of using "--tmpdir=/tmp" | |||
|
774 | # or "--tmpdir=$HOME". | |||
|
775 | #vlog("# Removing temp dir", tmpdir) | |||
|
776 | #shutil.rmtree(tmpdir) | |||
|
777 | os.makedirs(tmpdir) | |||
|
778 | else: | |||
|
779 | tmpdir = tempfile.mkdtemp('', 'hgtests.') | |||
|
780 | HGTMP = os.environ['HGTMP'] = os.path.realpath(tmpdir) | |||
770 | DAEMON_PIDS = None |
|
781 | DAEMON_PIDS = None | |
771 | HGRCPATH = None |
|
782 | HGRCPATH = None | |
772 |
|
783 |
General Comments 0
You need to be logged in to leave comments.
Login now