@@ -63,17 +63,35 @@ class CommonSubsetImpls:
6363 def __init__ (self , module_name ):
6464 self .cmdname = cmdname (module_name )
6565
66- def scan_files (self , pattern ):
66+ def scan_stdin (self ):
67+ """
68+ Historical implementation of the files profile that's also used elsewhere.
69+ Reads test one line at a time from stdin. Consider this implementation deprecated.
70+ Newer test runners are advised to use scan_files() without the pattern argument.
71+ """
72+ def subset (client ):
73+ # read lines as test file names
74+ for t in client .stdin ():
75+ client .test_path (t .rstrip ("\n " ))
76+ client .run ()
77+
78+ return wrap (subset , subset_cmd , self .cmdname )
79+
80+ def scan_files (self , pattern = None ):
6781 """
6882 Suitable for test runners that use files as unit of tests where file names follow a naming pattern.
6983
7084 :param pattern: file masks that identify test files, such as '*_spec.rb'
85+ for test runners that do not have natural file naming conventions, pass in None,
86+ so that the implementation will refuse to accept directories.
7187 """
7288 @click .argument ('files' , required = True , nargs = - 1 )
7389 def subset (client , files ):
7490 # client type: Optimize in def lauchable.commands.subset.subset
7591 def parse (fname : str ):
7692 if os .path .isdir (fname ):
93+ if pattern is None :
94+ raise click .UsageError (f'{ fname } is a directory, but expecting a file or GLOB' )
7795 client .scan (fname , '**/' + pattern )
7896 elif fname == '@-' :
7997 # read stdin
0 commit comments