673 @property |
673 @property |
674 def skipped(self): |
674 def skipped(self): |
675 """Whether the test was skipped.""" |
675 """Whether the test was skipped.""" |
676 return self.ret == SKIPPED_STATUS |
676 return self.ret == SKIPPED_STATUS |
677 |
677 |
678 def pytest(test, wd, options, replacements, env): |
|
679 py3kswitch = options.py3k_warnings and ' -3' or '' |
|
680 cmd = '%s%s "%s"' % (PYTHON, py3kswitch, test) |
|
681 vlog("# Running", cmd) |
|
682 if os.name == 'nt': |
|
683 replacements.append((r'\r\n', '\n')) |
|
684 return run(cmd, wd, options, replacements, env) |
|
685 |
|
686 class PythonTest(Test): |
678 class PythonTest(Test): |
687 """A Python-based test.""" |
679 """A Python-based test.""" |
688 def _run(self, testtmp, replacements, env): |
680 def _run(self, testtmp, replacements, env): |
689 return pytest(self._path, testtmp, self._options, replacements, |
681 py3kswitch = self._options.py3k_warnings and ' -3' or '' |
690 env) |
682 cmd = '%s%s "%s"' % (PYTHON, py3kswitch, self._path) |
|
683 vlog("# Running", cmd) |
|
684 if os.name == 'nt': |
|
685 replacements.append((r'\r\n', '\n')) |
|
686 return run(cmd, testtmp, self._options, replacements, env) |
|
687 |
691 |
688 |
692 needescape = re.compile(r'[\x00-\x08\x0b-\x1f\x7f-\xff]').search |
689 needescape = re.compile(r'[\x00-\x08\x0b-\x1f\x7f-\xff]').search |
693 escapesub = re.compile(r'[\x00-\x08\x0b-\x1f\\\x7f-\xff]').sub |
690 escapesub = re.compile(r'[\x00-\x08\x0b-\x1f\\\x7f-\xff]').sub |
694 escapemap = dict((chr(i), r'\x%02x' % i) for i in range(256)) |
691 escapemap = dict((chr(i), r'\x%02x' % i) for i in range(256)) |
695 escapemap.update({'\\': '\\\\', '\r': r'\r'}) |
692 escapemap.update({'\\': '\\\\', '\r': r'\r'}) |