diff --git a/tests/run-tests.py b/tests/run-tests.py
index af289d6cd422f604d854205df8890aa287524221_dGVzdHMvcnVuLXRlc3RzLnB5..d7a34c07e69b1130930a45c445eb365fae1642b0_dGVzdHMvcnVuLXRlc3RzLnB5 100755
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -200,6 +200,7 @@
         options.pure = True
 
     if options.with_hg:
+        options.with_hg = os.path.expanduser(options.with_hg)
         if not (os.path.isfile(options.with_hg) and
                 os.access(options.with_hg, os.X_OK)):
             parser.error('--with-hg must specify an executable hg script')