Show More
@@ -364,41 +364,6 b' def createhgrc(path, options):' | |||||
364 | hgrc.write('[%s]\n%s\n' % (section, key)) |
|
364 | hgrc.write('[%s]\n%s\n' % (section, key)) | |
365 | hgrc.close() |
|
365 | hgrc.close() | |
366 |
|
366 | |||
367 | def createenv(options, testtmp, threadtmp, port): |
|
|||
368 | env = os.environ.copy() |
|
|||
369 | env['TESTTMP'] = testtmp |
|
|||
370 | env['HOME'] = testtmp |
|
|||
371 | env["HGPORT"] = str(port) |
|
|||
372 | env["HGPORT1"] = str(port + 1) |
|
|||
373 | env["HGPORT2"] = str(port + 2) |
|
|||
374 | env["HGRCPATH"] = os.path.join(threadtmp, '.hgrc') |
|
|||
375 | env["DAEMON_PIDS"] = os.path.join(threadtmp, 'daemon.pids') |
|
|||
376 | env["HGEDITOR"] = sys.executable + ' -c "import sys; sys.exit(0)"' |
|
|||
377 | env["HGMERGE"] = "internal:merge" |
|
|||
378 | env["HGUSER"] = "test" |
|
|||
379 | env["HGENCODING"] = "ascii" |
|
|||
380 | env["HGENCODINGMODE"] = "strict" |
|
|||
381 |
|
||||
382 | # Reset some environment variables to well-known values so that |
|
|||
383 | # the tests produce repeatable output. |
|
|||
384 | env['LANG'] = env['LC_ALL'] = env['LANGUAGE'] = 'C' |
|
|||
385 | env['TZ'] = 'GMT' |
|
|||
386 | env["EMAIL"] = "Foo Bar <foo.bar@example.com>" |
|
|||
387 | env['COLUMNS'] = '80' |
|
|||
388 | env['TERM'] = 'xterm' |
|
|||
389 |
|
||||
390 | for k in ('HG HGPROF CDPATH GREP_OPTIONS http_proxy no_proxy ' + |
|
|||
391 | 'NO_PROXY').split(): |
|
|||
392 | if k in env: |
|
|||
393 | del env[k] |
|
|||
394 |
|
||||
395 | # unset env related to hooks |
|
|||
396 | for k in env.keys(): |
|
|||
397 | if k.startswith('HG_'): |
|
|||
398 | del env[k] |
|
|||
399 |
|
||||
400 | return env |
|
|||
401 |
|
||||
402 | def checktools(): |
|
367 | def checktools(): | |
403 | # Before we go any further, check for pre-requisite tools |
|
368 | # Before we go any further, check for pre-requisite tools | |
404 | # stuff from coreutils (cat, rm, etc) are not tested |
|
369 | # stuff from coreutils (cat, rm, etc) are not tested | |
@@ -585,6 +550,7 b' class Test(object):' | |||||
585 | def __init__(self, path, options, threadtmp): |
|
550 | def __init__(self, path, options, threadtmp): | |
586 | self._path = path |
|
551 | self._path = path | |
587 | self._options = options |
|
552 | self._options = options | |
|
553 | self._threadtmp = threadtmp | |||
588 |
|
554 | |||
589 | self.testtmp = os.path.join(threadtmp, os.path.basename(path)) |
|
555 | self.testtmp = os.path.join(threadtmp, os.path.basename(path)) | |
590 | os.mkdir(self.testtmp) |
|
556 | os.mkdir(self.testtmp) | |
@@ -613,6 +579,41 b' class Test(object):' | |||||
613 |
|
579 | |||
614 | return r, port |
|
580 | return r, port | |
615 |
|
581 | |||
|
582 | def getenv(self, port): | |||
|
583 | env = os.environ.copy() | |||
|
584 | env['TESTTMP'] = self.testtmp | |||
|
585 | env['HOME'] = self.testtmp | |||
|
586 | env["HGPORT"] = str(port) | |||
|
587 | env["HGPORT1"] = str(port + 1) | |||
|
588 | env["HGPORT2"] = str(port + 2) | |||
|
589 | env["HGRCPATH"] = os.path.join(self._threadtmp, '.hgrc') | |||
|
590 | env["DAEMON_PIDS"] = os.path.join(self._threadtmp, 'daemon.pids') | |||
|
591 | env["HGEDITOR"] = sys.executable + ' -c "import sys; sys.exit(0)"' | |||
|
592 | env["HGMERGE"] = "internal:merge" | |||
|
593 | env["HGUSER"] = "test" | |||
|
594 | env["HGENCODING"] = "ascii" | |||
|
595 | env["HGENCODINGMODE"] = "strict" | |||
|
596 | ||||
|
597 | # Reset some environment variables to well-known values so that | |||
|
598 | # the tests produce repeatable output. | |||
|
599 | env['LANG'] = env['LC_ALL'] = env['LANGUAGE'] = 'C' | |||
|
600 | env['TZ'] = 'GMT' | |||
|
601 | env["EMAIL"] = "Foo Bar <foo.bar@example.com>" | |||
|
602 | env['COLUMNS'] = '80' | |||
|
603 | env['TERM'] = 'xterm' | |||
|
604 | ||||
|
605 | for k in ('HG HGPROF CDPATH GREP_OPTIONS http_proxy no_proxy ' + | |||
|
606 | 'NO_PROXY').split(): | |||
|
607 | if k in env: | |||
|
608 | del env[k] | |||
|
609 | ||||
|
610 | # unset env related to hooks | |||
|
611 | for k in env.keys(): | |||
|
612 | if k.startswith('HG_'): | |||
|
613 | del env[k] | |||
|
614 | ||||
|
615 | return env | |||
|
616 | ||||
616 | def pytest(test, wd, options, replacements, env): |
|
617 | def pytest(test, wd, options, replacements, env): | |
617 | py3kswitch = options.py3k_warnings and ' -3' or '' |
|
618 | py3kswitch = options.py3k_warnings and ' -3' or '' | |
618 | cmd = '%s%s "%s"' % (PYTHON, py3kswitch, test) |
|
619 | cmd = '%s%s "%s"' % (PYTHON, py3kswitch, test) | |
@@ -1018,7 +1019,7 b' def runone(options, test, count):' | |||||
1018 |
|
1019 | |||
1019 | t = runner(testpath, options, threadtmp) |
|
1020 | t = runner(testpath, options, threadtmp) | |
1020 | replacements, port = t.getreplacements(count) |
|
1021 | replacements, port = t.getreplacements(count) | |
1021 | env = createenv(options, t.testtmp, threadtmp, port) |
|
1022 | env = t.getenv(port) | |
1022 | createhgrc(env['HGRCPATH'], options) |
|
1023 | createhgrc(env['HGRCPATH'], options) | |
1023 |
|
1024 | |||
1024 | starttime = time.time() |
|
1025 | starttime = time.time() |
General Comments 0
You need to be logged in to leave comments.
Login now