tests/run-tests.py
branchstable
changeset 1221 3a049b21a05b
parent 1219 cefcbbc5502c
child 1224 f3c19de4b29c
equal deleted inserted replaced
1219:cefcbbc5502c 1221:3a049b21a05b
   196              "temporary installation")
   196              "temporary installation")
   197     parser.add_option("-3", "--py3k-warnings", action="store_true",
   197     parser.add_option("-3", "--py3k-warnings", action="store_true",
   198         help="enable Py3k warnings on Python 2.6+")
   198         help="enable Py3k warnings on Python 2.6+")
   199     parser.add_option('--extra-config-opt', action="append",
   199     parser.add_option('--extra-config-opt', action="append",
   200                       help='set the given config opt in the test hgrc')
   200                       help='set the given config opt in the test hgrc')
       
   201     parser.add_option('--random', action="store_true",
       
   202                       help='run tests in random order')
   201 
   203 
   202     for option, (envvar, default) in defaults.items():
   204     for option, (envvar, default) in defaults.items():
   203         defaults[option] = type(default)(os.environ.get(envvar, default))
   205         defaults[option] = type(default)(os.environ.get(envvar, default))
   204     parser.set_defaults(**defaults)
   206     parser.set_defaults(**defaults)
   205     (options, args) = parser.parse_args()
   207     (options, args) = parser.parse_args()
  1246         if len(args) == 0:
  1248         if len(args) == 0:
  1247             args = sorted(os.listdir("."))
  1249             args = sorted(os.listdir("."))
  1248 
  1250 
  1249     tests = args
  1251     tests = args
  1250 
  1252 
       
  1253     if options.random:
       
  1254         random.shuffle(tests)
       
  1255 
  1251     # Reset some environment variables to well-known values so that
  1256     # Reset some environment variables to well-known values so that
  1252     # the tests produce repeatable output.
  1257     # the tests produce repeatable output.
  1253     os.environ['LANG'] = os.environ['LC_ALL'] = os.environ['LANGUAGE'] = 'C'
  1258     os.environ['LANG'] = os.environ['LC_ALL'] = os.environ['LANGUAGE'] = 'C'
  1254     os.environ['TZ'] = 'GMT'
  1259     os.environ['TZ'] = 'GMT'
  1255     os.environ["EMAIL"] = "Foo Bar <foo.bar@example.com>"
  1260     os.environ["EMAIL"] = "Foo Bar <foo.bar@example.com>"