MCPcopy
hub / github.com/PaddlePaddle/PaddleFormers / construct_argv

Function construct_argv

tests/testing_utils.py:365–385  ·  view source on GitHub ↗

construct argv by configs Args: config (dict): the config data Returns: list[str]: the argvs

(config: dict)

Source from the content-addressed store, hash-verified

363
364
365def construct_argv(config: dict) -> list[str]:
366 """construct argv by configs
367
368 Args:
369 config (dict): the config data
370
371 Returns:
372 list[str]: the argvs
373 """
374 # get current test
375 # refer to: https://docs.pytest.org/en/latest/example/simple.html#pytest-current-test-environment-variable
376 current_test = "tests/__init__.py"
377 if "PYTEST_CURRENT_TEST" in os.environ:
378 current_test = os.getenv("PYTEST_CURRENT_TEST").split("::")[0]
379
380 argv = [current_test]
381 for key, value in config.items():
382 argv.append(f"--{key}")
383 argv.append(str(value))
384
385 return argv
386
387
388@contextmanager

Callers 1

argv_context_guardFunction · 0.85

Calls 3

splitMethod · 0.45
itemsMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected