contrib/check-py3-compat.py
changeset 45250 4e5da64d5549
parent 44470 9d2b2df2c2ba
child 45849 c102b704edb5
--- a/contrib/check-py3-compat.py	Fri Jul 24 12:13:10 2020 -0700
+++ b/contrib/check-py3-compat.py	Fri Jul 24 16:32:45 2020 -0700
@@ -97,6 +97,15 @@
     if sys.version_info[0] == 2:
         fn = check_compat_py2
     else:
+        # check_compat_py3 will import every filename we specify as long as it
+        # starts with one of a few prefixes. It does this by converting
+        # specified filenames like 'mercurial/foo.py' to 'mercurial.foo' and
+        # importing that. When running standalone (not as part of a test), this
+        # means we actually import the installed versions, not the files we just
+        # specified. When running as test-check-py3-compat.t, we technically
+        # would import the correct paths, but it's cleaner to have both cases
+        # use the same import logic.
+        sys.path.insert(0, '.')
         fn = check_compat_py3
 
     for f in sys.argv[1:]: