Patchwork run-tests: only sort files when not given as argument

login
register
mail settings
Submitter Simon Heimberg
Date March 21, 2013, 8:28 a.m.
Message ID <d3b734662b82e8232a4d.1363854538@lapsi.heimberg.home>
Download mbox | patch
Permalink /patch/1146/
State Accepted
Commit 05d544d17fa29c28d47483ae829b1a1c93ac4bd4
Headers show

Comments

Simon Heimberg - March 21, 2013, 8:28 a.m.
# HG changeset patch
# User Simon Heimberg <simohe@besonet.ch>
# Date 1363852581 -3600
# Node ID d3b734662b82e8232a4d43b549d5afc29421312d
# Parent  f56278a0a0c56fe0c6c02ef8e23dbe0cadb9df69
run-tests: only sort files when not given as argument

os.listdir returns the files in any order. This has to be sorted.
But when given as argument, the user should be allowed to set any order.

This restores the behaviour before 9848a94e2a.
Pierre-Yves David - March 21, 2013, 10:26 a.m.
On Thu, Mar 21, 2013 at 09:28:58AM +0100, Simon Heimberg wrote:
> # HG changeset patch
> # User Simon Heimberg <simohe@besonet.ch>
> # Date 1363852581 -3600
> # Node ID d3b734662b82e8232a4d43b549d5afc29421312d
> # Parent  f56278a0a0c56fe0c6c02ef8e23dbe0cadb9df69
> run-tests: only sort files when not given as argument
> 
> os.listdir returns the files in any order. This has to be sorted.
> But when given as argument, the user should be allowed to set any order.
> 
> This restores the behaviour before 9848a94e2a.

sounds good to me

> diff -r f56278a0a0c5 -r d3b734662b82 tests/run-tests.py
> --- a/tests/run-tests.py	Mit Mär 20 13:40:06 2013 -0700
> +++ b/tests/run-tests.py	Don Mär 21 08:56:21 2013 +0100
> @@ -1244,8 +1244,7 @@
>          checktools()
>  
>          if len(args) == 0:
> -            args = os.listdir(".")
> -        args.sort()
> +            args = sorted(os.listdir("."))
>  
>      tests = args
>  
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff -r f56278a0a0c5 -r d3b734662b82 tests/run-tests.py
--- a/tests/run-tests.py	Mit Mär 20 13:40:06 2013 -0700
+++ b/tests/run-tests.py	Don Mär 21 08:56:21 2013 +0100
@@ -1244,8 +1244,7 @@ 
         checktools()
 
         if len(args) == 0:
-            args = os.listdir(".")
-        args.sort()
+            args = sorted(os.listdir("."))
 
     tests = args