Mercurial > hg
comparison tests/run-tests.py @ 44144:bd0de73cf810
run-tests: remove --py3-warnings
This Python 2 only mode was to help Python 2 alert when doing
things not supported on Python 3. Now that we have test coverage with
Python 3, I don't think we need it.
Differential Revision: https://phab.mercurial-scm.org/D7978
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 22 Nov 2019 20:12:10 -0800 |
parents | 6d3b67a837a6 |
children | 109322cd322a |
comparison
equal
deleted
inserted
replaced
44143:7f86426fdd2c | 44144:bd0de73cf810 |
---|---|
553 "--pure", | 553 "--pure", |
554 action="store_true", | 554 action="store_true", |
555 help="use pure Python code instead of C extensions", | 555 help="use pure Python code instead of C extensions", |
556 ) | 556 ) |
557 hgconf.add_argument( | 557 hgconf.add_argument( |
558 "-3", | |
559 "--py3-warnings", | |
560 action="store_true", | |
561 help="enable Py3k warnings on Python 2.7+", | |
562 ) | |
563 hgconf.add_argument( | |
564 "--with-chg", | 558 "--with-chg", |
565 metavar="CHG", | 559 metavar="CHG", |
566 help="use specified chg wrapper in place of hg", | 560 help="use specified chg wrapper in place of hg", |
567 ) | 561 ) |
568 hgconf.add_argument( | 562 hgconf.add_argument( |
746 sys.stderr.write( | 740 sys.stderr.write( |
747 'warning: --slowtimeout option ignored with --debug\n' | 741 'warning: --slowtimeout option ignored with --debug\n' |
748 ) | 742 ) |
749 options.timeout = 0 | 743 options.timeout = 0 |
750 options.slowtimeout = 0 | 744 options.slowtimeout = 0 |
751 if options.py3_warnings: | |
752 if PYTHON3: | |
753 parser.error('--py3-warnings can only be used on Python 2.7') | |
754 | 745 |
755 if options.blacklist: | 746 if options.blacklist: |
756 options.blacklist = parselistfiles(options.blacklist, 'blacklist') | 747 options.blacklist = parselistfiles(options.blacklist, 'blacklist') |
757 if options.whitelist: | 748 if options.whitelist: |
758 options.whitelisted = parselistfiles(options.whitelist, 'whitelist') | 749 options.whitelisted = parselistfiles(options.whitelist, 'whitelist') |
907 debug=False, | 898 debug=False, |
908 first=False, | 899 first=False, |
909 timeout=None, | 900 timeout=None, |
910 startport=None, | 901 startport=None, |
911 extraconfigopts=None, | 902 extraconfigopts=None, |
912 py3warnings=False, | |
913 shell=None, | 903 shell=None, |
914 hgcommand=None, | 904 hgcommand=None, |
915 slowtimeout=None, | 905 slowtimeout=None, |
916 usechg=False, | 906 usechg=False, |
917 useipv6=False, | 907 useipv6=False, |
939 instances. | 929 instances. |
940 | 930 |
941 extraconfigopts is an iterable of extra hgrc config options. Values | 931 extraconfigopts is an iterable of extra hgrc config options. Values |
942 must have the form "key=value" (something understood by hgrc). Values | 932 must have the form "key=value" (something understood by hgrc). Values |
943 of the form "foo.key=value" will result in "[foo] key=value". | 933 of the form "foo.key=value" will result in "[foo] key=value". |
944 | |
945 py3warnings enables Py3k warnings. | |
946 | 934 |
947 shell is the shell to execute tests in. | 935 shell is the shell to execute tests in. |
948 """ | 936 """ |
949 if timeout is None: | 937 if timeout is None: |
950 timeout = defaults['timeout'] | 938 timeout = defaults['timeout'] |
966 self._first = first | 954 self._first = first |
967 self._timeout = timeout | 955 self._timeout = timeout |
968 self._slowtimeout = slowtimeout | 956 self._slowtimeout = slowtimeout |
969 self._startport = startport | 957 self._startport = startport |
970 self._extraconfigopts = extraconfigopts or [] | 958 self._extraconfigopts = extraconfigopts or [] |
971 self._py3warnings = py3warnings | |
972 self._shell = _bytespath(shell) | 959 self._shell = _bytespath(shell) |
973 self._hgcommand = hgcommand or b'hg' | 960 self._hgcommand = hgcommand or b'hg' |
974 self._usechg = usechg | 961 self._usechg = usechg |
975 self._useipv6 = useipv6 | 962 self._useipv6 = useipv6 |
976 | 963 |
1513 @property | 1500 @property |
1514 def refpath(self): | 1501 def refpath(self): |
1515 return os.path.join(self._testdir, b'%s.out' % self.bname) | 1502 return os.path.join(self._testdir, b'%s.out' % self.bname) |
1516 | 1503 |
1517 def _run(self, env): | 1504 def _run(self, env): |
1518 py3switch = self._py3warnings and b' -3' or b'' | |
1519 # Quote the python(3) executable for Windows | 1505 # Quote the python(3) executable for Windows |
1520 cmd = b'"%s"%s "%s"' % (PYTHON, py3switch, self.path) | 1506 cmd = b'"%s" "%s"' % (PYTHON, self.path) |
1521 vlog("# Running", cmd.decode("utf-8")) | 1507 vlog("# Running", cmd.decode("utf-8")) |
1522 normalizenewlines = os.name == 'nt' | 1508 normalizenewlines = os.name == 'nt' |
1523 result = self._runcommand(cmd, env, normalizenewlines=normalizenewlines) | 1509 result = self._runcommand(cmd, env, normalizenewlines=normalizenewlines) |
1524 if self._aborted: | 1510 if self._aborted: |
1525 raise KeyboardInterrupt() | 1511 raise KeyboardInterrupt() |
3364 debug=self.options.debug, | 3350 debug=self.options.debug, |
3365 first=self.options.first, | 3351 first=self.options.first, |
3366 timeout=self.options.timeout, | 3352 timeout=self.options.timeout, |
3367 startport=self._getport(count), | 3353 startport=self._getport(count), |
3368 extraconfigopts=self.options.extra_config_opt, | 3354 extraconfigopts=self.options.extra_config_opt, |
3369 py3warnings=self.options.py3_warnings, | |
3370 shell=self.options.shell, | 3355 shell=self.options.shell, |
3371 hgcommand=self._hgcommand, | 3356 hgcommand=self._hgcommand, |
3372 usechg=bool(self.options.with_chg or self.options.chg), | 3357 usechg=bool(self.options.with_chg or self.options.chg), |
3373 useipv6=useipv6, | 3358 useipv6=useipv6, |
3374 **kwds | 3359 **kwds |
3510 sys.exit(1) | 3495 sys.exit(1) |
3511 os.chdir(self._testdir) | 3496 os.chdir(self._testdir) |
3512 | 3497 |
3513 self._usecorrectpython() | 3498 self._usecorrectpython() |
3514 | 3499 |
3515 if self.options.py3_warnings and not self.options.anycoverage: | |
3516 vlog("# Updating hg command to enable Py3k Warnings switch") | |
3517 with open(os.path.join(self._bindir, 'hg'), 'rb') as f: | |
3518 lines = [line.rstrip() for line in f] | |
3519 lines[0] += ' -3' | |
3520 with open(os.path.join(self._bindir, 'hg'), 'wb') as f: | |
3521 for line in lines: | |
3522 f.write(line + '\n') | |
3523 | |
3524 hgbat = os.path.join(self._bindir, b'hg.bat') | 3500 hgbat = os.path.join(self._bindir, b'hg.bat') |
3525 if os.path.isfile(hgbat): | 3501 if os.path.isfile(hgbat): |
3526 # hg.bat expects to be put in bin/scripts while run-tests.py | 3502 # hg.bat expects to be put in bin/scripts while run-tests.py |
3527 # installation layout put it in bin/ directly. Fix it | 3503 # installation layout put it in bin/ directly. Fix it |
3528 with open(hgbat, 'rb') as f: | 3504 with open(hgbat, 'rb') as f: |