Просмотр исходного кода

Enable recipe to run with test env file name in the command line

alexv-smirnov 1 год назад
Родитель
Сommit
8bedeb58ad

+ 2 - 1
library/python/testing/recipe/__init__.py

@@ -49,6 +49,7 @@ def get_options():
     parser.add_argument("--build-root", type=str, dest="build_root", default=None, help="Build root directory")
     parser.add_argument("--source-root", type=str, dest="source_root", default=None, help="Source root directory")
     parser.add_argument("--output-dir", type=str, dest="output_dir", default=None, help="Output directory")
+    parser.add_argument("--env-file", type=str, dest="env_file", default=None, help="File to read/write environment variables")
 
     args, opts = parser.parse_known_args()
 
@@ -59,7 +60,7 @@ def get_options():
         "test_stderr": args.test_stderr,
     }
 
-    ya = Ya(context=context, build_root=args.build_root, source_root=args.source_root, output_dir=args.output_dir)
+    ya = Ya(context=context, build_root=args.build_root, source_root=args.source_root, output_dir=args.output_dir, env_file=args.env_file)
 
     ya._data_root = ""  # XXX remove
 

+ 2 - 1
library/python/testing/yatest_lib/ya.py

@@ -39,6 +39,7 @@ class Ya(object):
         valgrind_path=None,
         gdb_path=None,
         data_root=None,
+        env_file=None,
     ):
         context_file_path = os.environ.get("YA_TEST_CONTEXT_FILE", None)
         if context_file_path:
@@ -101,7 +102,7 @@ class Ya(object):
         self._context["sanitize"] = context_build.get("sanitizer")
         self._context["ya_trace_path"] = context_internal.get("trace_file")
 
-        self._env_file = context_internal.get("env_file")
+        self._env_file = context_internal.get("env_file") or env_file
 
         if context:
             for k, v in context.items():