##// END OF EJS Templates
run-tests: move replacements generation into Test...
Gregory Szorc -
r21298:ba475035 default
parent child Browse files
Show More
@@ -595,6 +595,24 b' class Test(object):'
595 595 def _run(self, replacements, env):
596 596 raise NotImplemented('Subclasses must implement Test.run()')
597 597
598 def getreplacements(self, count):
599 port = self._options.port + count * 3
600 r = [
601 (r':%s\b' % port, ':$HGPORT'),
602 (r':%s\b' % (port + 1), ':$HGPORT1'),
603 (r':%s\b' % (port + 2), ':$HGPORT2'),
604 ]
605
606 if os.name == 'nt':
607 r.append(
608 (''.join(c.isalpha() and '[%s%s]' % (c.lower(), c.upper()) or
609 c in '/\\' and r'[/\\]' or c.isdigit() and c or '\\' + c
610 for c in self.testtmp), '$TESTTMP'))
611 else:
612 r.append((re.escape(self.testtmp), '$TESTTMP'))
613
614 return r, port
615
598 616 def pytest(test, wd, options, replacements, env):
599 617 py3kswitch = options.py3k_warnings and ' -3' or ''
600 618 cmd = '%s%s "%s"' % (PYTHON, py3kswitch, test)
@@ -999,23 +1017,7 b' def runone(options, test, count):'
999 1017 os.mkdir(threadtmp)
1000 1018
1001 1019 t = runner(testpath, options, threadtmp)
1002
1003 port = options.port + count * 3
1004 replacements = [
1005 (r':%s\b' % port, ':$HGPORT'),
1006 (r':%s\b' % (port + 1), ':$HGPORT1'),
1007 (r':%s\b' % (port + 2), ':$HGPORT2'),
1008 ]
1009 if os.name == 'nt':
1010 replacements.append(
1011 (''.join(c.isalpha() and '[%s%s]' % (c.lower(), c.upper()) or
1012 c in '/\\' and r'[/\\]' or
1013 c.isdigit() and c or
1014 '\\' + c
1015 for c in t.testtmp), '$TESTTMP'))
1016 else:
1017 replacements.append((re.escape(t.testtmp), '$TESTTMP'))
1018
1020 replacements, port = t.getreplacements(count)
1019 1021 env = createenv(options, t.testtmp, threadtmp, port)
1020 1022 createhgrc(env['HGRCPATH'], options)
1021 1023
General Comments 0
You need to be logged in to leave comments. Login now