MCPcopy Create free account
hub / github.com/apache/impala / build_test_args

Function build_test_args

tests/run-tests.py:147–219  ·  view source on GitHub ↗

Prepare the list of arguments that will be passed to pytest.main(). Args: base_name: the base name for the log file to write valid_dirs: a white list of sub-directories with desired tests (i.e, those that will not get flagged with --ignore before py.test is called.) Return:

(base_name, valid_dirs=VALID_TEST_DIRS)

Source from the content-addressed store, hash-verified

145
146
147def build_test_args(base_name, valid_dirs=VALID_TEST_DIRS):
148 """
149 Prepare the list of arguments that will be passed to pytest.main().
150
151 Args:
152 base_name: the base name for the log file to write
153 valid_dirs: a white list of sub-directories with desired tests (i.e, those
154 that will not get flagged with --ignore before py.test is called.)
155
156 Return:
157 a list of command line arguments
158
159 For most test stages (e.g., serial, parallel), we augment the given command
160 line arguments with a list of directories to ignore. However, when running the
161 metric verification tests at the end of the test run:
162
163 - verifiers.test_verify_metrics.TestValidateMetrics.test_metrics_are_zero
164 - verifiers.test_verify_metrics.TestValidateMetrics.test_num_unused_buffers
165
166 then we instead need to filter out args that specify other tests (otherwise,
167 they will be run again), but still retain the basic config args.
168 """
169
170 # When building the list of command line args, in order to correctly filter
171 # them as needed (see issue IMPALA-4510) we should account for the fact that
172 # '--foo bar' and '--foo=bar' might be supplied by the user. We also need to
173 # be able identify any other arbitrary options. E.g., if the user specified
174 # the following on the command line:
175 #
176 # 'run-tests.py --arg1 value1 --random_opt --arg2=value2'
177 #
178 # we want an iterable that, if unpacked as a list, would look like:
179 #
180 # [arg1, value1, random_opt, arg2, value2]
181 #
182 commandline_args = itertools.chain(*[arg.split('=') for arg in sys.argv[1:]])
183
184 ignored_dirs = build_ignore_dir_arg_list(valid_dirs=valid_dirs)
185 logging_args = []
186 for arg, log in LOGGING_ARGS.items():
187 logging_args.extend([arg, os.path.join(RESULT_DIR, log.format(base_name))])
188
189 if valid_dirs != ['verifiers']:
190 # This isn't the metrics verification stage yet, so we don't need to filter.
191 test_args = ignored_dirs + logging_args + list(commandline_args)
192 else:
193 # For metrics verification, we only want to run the verifier tests, so we need
194 # to filter out any command line args that specify other test modules, classes,
195 # and functions. The list of these can be found by calling
196 #
197 # _pytest.config.Parser().parse_known_args(commandline_args).file_or_dir
198 #
199 # get_explicit_test() does this for us.
200 # For example, with the following command line invocation:
201 #
202 # $ ./run-tests.py query_test/test_limit.py::TestLimit::test_limit \
203 # query_test/test_queries.py::TestHdfsQueries --verbose -n 4 \
204 # --table_formats=parquet/none --exploration_strategy core

Callers 1

run-tests.pyFile · 0.85

Calls 5

get_explicit_testsFunction · 0.85
joinMethod · 0.45
formatMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected