[PATCH] run-tests.py: reset cwd after each test

Patrick Mézard pmezard at gmail.com
Mon Feb 8 16:53:57 CST 2010


Le 08/02/10 02:57, Mads Kiilerich a écrit :
> # HG changeset patch
> # User Mads Kiilerich <mads at kiilerich.com>
> # Date 1265594241 -3600
> # Node ID bc86633b086c08ea75c1c2e5533181396cfdb64e
> # Parent  98e7028a41bc2ec1de154834d9f20c48d5476b74
> run-tests.py: reset cwd after each test
> 
> runone had (and has) several ways to exit without changing cwd back.
> That could cause -k runs to fail.
> 
> diff --git a/tests/run-tests.py b/tests/run-tests.py
> --- a/tests/run-tests.py
> +++ b/tests/run-tests.py
> @@ -639,7 +639,6 @@
>  
>      killdaemons()
>  
> -    os.chdir(TESTDIR)
>      if not options.keep_tmpdir:
>          shutil.rmtree(tmpd, True)
>      if skipped:
> @@ -803,6 +802,7 @@
>                      continue
>  
>              ret = runone(options, test, skips, fails)
> +            os.chdir(TESTDIR)
>              if ret is None:
>                  skipped += 1
>              elif not ret:

We should fix that but I am not fond of moving the chdir() out of runone(). It's tempting because this is run-tests.py but that's not something we would allow anywhere else. I have to think more about it.

--
Patrick Mézard


More information about the Mercurial-devel mailing list