mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
run-tests: allow automatic test discovery when providing folder as argument
Currently `run-tests.py` automatically discovers test only in the current directory if no argument is provided. This patch makes it possible to pass a number of tests and folders as arguments.
This commit is contained in:
parent
e400287a20
commit
02caf9675e
@ -2510,6 +2510,16 @@ class TestRunner(object):
|
||||
else:
|
||||
args = os.listdir(b'.')
|
||||
|
||||
expanded_args = []
|
||||
for arg in args:
|
||||
if os.path.isdir(arg):
|
||||
if not arg.endswith(b'/'):
|
||||
arg += b'/'
|
||||
expanded_args.extend([arg + a for a in os.listdir(arg)])
|
||||
else:
|
||||
expanded_args.append(arg)
|
||||
args = expanded_args
|
||||
|
||||
tests = []
|
||||
for t in args:
|
||||
if not (os.path.basename(t).startswith(b'test-')
|
||||
|
@ -1261,6 +1261,24 @@ support for running a test outside the current directory
|
||||
.
|
||||
# Ran 1 tests, 0 skipped, 0 failed.
|
||||
|
||||
support for automatically discovering test if arg is a folder
|
||||
$ mkdir tmp && cd tmp
|
||||
|
||||
$ cat > test-uno.t << EOF
|
||||
> $ echo line
|
||||
> line
|
||||
> EOF
|
||||
|
||||
$ cp test-uno.t test-dos.t
|
||||
$ cd ..
|
||||
$ cp -R tmp tmpp
|
||||
$ cp tmp/test-uno.t test-solo.t
|
||||
|
||||
$ $PYTHON $TESTDIR/run-tests.py tmp/ test-solo.t tmpp
|
||||
.....
|
||||
# Ran 5 tests, 0 skipped, 0 failed.
|
||||
$ rm -rf tmp tmpp
|
||||
|
||||
support for running run-tests.py from another directory
|
||||
$ mkdir tmp && cd tmp
|
||||
$ cat > useful-file.sh << EOF
|
||||
|
Loading…
Reference in New Issue
Block a user