##// END OF EJS Templates
run-tests: stop writing a `python3` symlink pointing to python2...
marmoute -
r48294:23f5ed6d default
parent child Browse files
Show More
@@ -1,4 +1,4 b''
1 #!/usr/bin/env python3
1 #!/usr/bin/env python
2
2
3 from __future__ import absolute_import
3 from __future__ import absolute_import
4
4
@@ -1,4 +1,4 b''
1 #!/usr/bin/env python3
1 #!/usr/bin/env python
2
2
3 """dummy SMTP server for use in tests"""
3 """dummy SMTP server for use in tests"""
4
4
@@ -1,4 +1,4 b''
1 #!/usr/bin/env python3
1 #!/usr/bin/env python
2
2
3 """This does HTTP GET requests given a host:port and path and returns
3 """This does HTTP GET requests given a host:port and path and returns
4 a subset of the headers plus the body of the result."""
4 a subset of the headers plus the body of the result."""
@@ -1,4 +1,4 b''
1 #!/usr/bin/env python3
1 #!/usr/bin/env python
2 """Test the running system for features availability. Exit with zero
2 """Test the running system for features availability. Exit with zero
3 if all features are there, non-zero otherwise. If a feature name is
3 if all features are there, non-zero otherwise. If a feature name is
4 prefixed with "no-", the absence of feature is tested.
4 prefixed with "no-", the absence of feature is tested.
@@ -3530,9 +3530,11 b' class TestRunner(object):'
3530 """Configure the environment to use the appropriate Python in tests."""
3530 """Configure the environment to use the appropriate Python in tests."""
3531 # Tests must use the same interpreter as us or bad things will happen.
3531 # Tests must use the same interpreter as us or bad things will happen.
3532 if sys.platform == 'win32':
3532 if sys.platform == 'win32':
3533 pyexename = b'python.exe'
3533 pyexe_names = [b'python', b'python.exe']
3534 elif sys.version_info[0] < 3:
3535 pyexe_names = [b'python', b'python2']
3534 else:
3536 else:
3535 pyexename = b'python3' # XXX this is wrong with python2...
3537 pyexe_names = [b'python', b'python3']
3536
3538
3537 # os.symlink() is a thing with py3 on Windows, but it requires
3539 # os.symlink() is a thing with py3 on Windows, but it requires
3538 # Administrator rights.
3540 # Administrator rights.
@@ -3540,7 +3542,7 b' class TestRunner(object):'
3540 msg = "# Making python executable in test path a symlink to '%s'"
3542 msg = "# Making python executable in test path a symlink to '%s'"
3541 msg %= sysexecutable
3543 msg %= sysexecutable
3542 vlog(msg)
3544 vlog(msg)
3543 for pyexename in [pyexename]:
3545 for pyexename in pyexe_names:
3544 mypython = os.path.join(self._tmpbindir, pyexename)
3546 mypython = os.path.join(self._tmpbindir, pyexename)
3545 try:
3547 try:
3546 if os.readlink(mypython) == sysexecutable:
3548 if os.readlink(mypython) == sysexecutable:
@@ -3566,11 +3568,16 b' class TestRunner(object):'
3566 with open(osenvironb[b'RUNTESTDIR'] + b'/python3', 'wb') as f:
3568 with open(osenvironb[b'RUNTESTDIR'] + b'/python3', 'wb') as f:
3567 f.write(b'#!/bin/sh\n')
3569 f.write(b'#!/bin/sh\n')
3568 f.write(b'py -3.%d "$@"\n' % sys.version_info[1])
3570 f.write(b'py -3.%d "$@"\n' % sys.version_info[1])
3571 if os.getenv('MSYSTEM'):
3572 with open(osenvironb[b'RUNTESTDIR'] + b'/python2', 'wb') as f:
3573 f.write(b'#!/bin/sh\n')
3574 f.write(b'py -2.%d "$@"\n' % sys.version_info[1])
3569
3575
3570 exedir, exename = os.path.split(sysexecutable)
3576 exedir, exename = os.path.split(sysexecutable)
3571 msg = "# Modifying search path to find %s as %s in '%s'"
3577 for pyexename in pyexe_names:
3572 msg %= (exename, pyexename, exedir)
3578 msg = "# Modifying search path to find %s as %s in '%s'"
3573 vlog(msg)
3579 msg %= (exename, pyexename, exedir)
3580 vlog(msg)
3574 path = os.environ['PATH'].split(os.pathsep)
3581 path = os.environ['PATH'].split(os.pathsep)
3575 while exedir in path:
3582 while exedir in path:
3576 path.remove(exedir)
3583 path.remove(exedir)
@@ -3598,8 +3605,9 b' class TestRunner(object):'
3598 extra_paths.append(scripts_dir)
3605 extra_paths.append(scripts_dir)
3599
3606
3600 os.environ['PATH'] = os.pathsep.join(extra_paths + path)
3607 os.environ['PATH'] = os.pathsep.join(extra_paths + path)
3601 if not self._findprogram(pyexename):
3608 for pyexename in pyexe_names:
3602 print("WARNING: Cannot find %s in search path" % pyexename)
3609 if not self._findprogram(pyexename):
3610 print("WARNING: Cannot find %s in search path" % pyexename)
3603
3611
3604 def _installhg(self):
3612 def _installhg(self):
3605 """Install hg into the test environment.
3613 """Install hg into the test environment.
@@ -1,4 +1,4 b''
1 #!/usr/bin/env python3
1 #!/usr/bin/env python
2 """
2 """
3 Tests the behavior of filelog w.r.t. data starting with '\1\n'
3 Tests the behavior of filelog w.r.t. data starting with '\1\n'
4 """
4 """
@@ -1,4 +1,4 b''
1 #!/usr/bin/env python3
1 #!/usr/bin/env python
2 from __future__ import absolute_import, print_function
2 from __future__ import absolute_import, print_function
3
3
4 import hashlib
4 import hashlib
@@ -1,4 +1,4 b''
1 #!/usr/bin/env python3
1 #!/usr/bin/env python
2 from __future__ import absolute_import
2 from __future__ import absolute_import
3
3
4 import hashlib
4 import hashlib
@@ -2036,3 +2036,34 b' Test conditional output matching'
2036 # Ran 2 tests, 0 skipped, 2 failed.
2036 # Ran 2 tests, 0 skipped, 2 failed.
2037 python hash seed: * (glob)
2037 python hash seed: * (glob)
2038 [1]
2038 [1]
2039
2040 Test that a proper "python" has been set up
2041 ===========================================
2042
2043 (with a small check-code work around)
2044 $ printf "#!/usr/bi" > test-py3.tmp
2045 $ printf "n/en" >> test-py3.tmp
2046 $ cat << EOF >> test-py3.tmp
2047 > v python3
2048 > import sys
2049 > print('.'.join(str(x) for x in sys.version_info))
2050 > EOF
2051 $ mv test-py3.tmp test-py3.py
2052 $ chmod +x test-py3.py
2053
2054 (with a small check-code work around)
2055 $ printf "#!/usr/bi" > test-py.tmp
2056 $ printf "n/en" >> test-py.tmp
2057 $ cat << EOF >> test-py.tmp
2058 > v python
2059 > import sys
2060 > print('.'.join(str(x) for x in sys.version_info))
2061 > EOF
2062 $ mv test-py.tmp test-py.py
2063 $ chmod +x test-py.py
2064
2065 $ ./test-py3.py
2066 3.* (glob)
2067 $ ./test-py.py
2068 2.* (glob) (no-py3 !)
2069 3.* (glob) (py3 !)
@@ -1,4 +1,4 b''
1 #!/usr/bin/env python3
1 #!/usr/bin/env python
2 from __future__ import absolute_import, print_function
2 from __future__ import absolute_import, print_function
3
3
4 import sys
4 import sys
@@ -1,4 +1,4 b''
1 #!/usr/bin/env python3
1 #!/usr/bin/env python
2 """
2 """
3 Tests the buffering behavior of stdio streams in `mercurial.utils.procutil`.
3 Tests the buffering behavior of stdio streams in `mercurial.utils.procutil`.
4 """
4 """
@@ -1,4 +1,4 b''
1 #!/usr/bin/env python3
1 #!/usr/bin/env python
2
2
3 from __future__ import absolute_import, print_function
3 from __future__ import absolute_import, print_function
4
4
General Comments 0
You need to be logged in to leave comments. Login now