aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzhukoff-pavel <zhukoff-pavel@yandex-team.com>2023-05-10 12:40:13 +0300
committerzhukoff-pavel <zhukoff-pavel@yandex-team.com>2023-05-10 12:40:13 +0300
commitbe715415026f79c27aa5574943b003a3f606a106 (patch)
treedbd1d0e827cf86644701e56028fabb3ea9ad84c2
parent8082dfc524cc18b12aef69ac9f0a6c69315ac141 (diff)
downloadydb-be715415026f79c27aa5574943b003a3f606a106.tar.gz
Add environment set upon test launch from test.context for python tests
-rw-r--r--library/python/testing/yatest_lib/ya.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/library/python/testing/yatest_lib/ya.py b/library/python/testing/yatest_lib/ya.py
index 44a3fd51ca..0b48fcd03a 100644
--- a/library/python/testing/yatest_lib/ya.py
+++ b/library/python/testing/yatest_lib/ya.py
@@ -2,6 +2,7 @@ import os
import sys
import logging
import json
+import six
from .tools import to_str
from .external import ExternalDataInfo
@@ -107,6 +108,17 @@ class Ya(object):
if k not in self._context or v is not None:
self._context[k] = v
+ if self._env_file and os.path.exists(self._env_file):
+ yatest_logger.debug("Reading variables from env_file at %s", self._env_file)
+ var_list = []
+ with open(self._env_file) as file:
+ for ljson in file.readlines():
+ variable = json.loads(ljson)
+ for key, value in six.iteritems(variable):
+ os.environ[key] = str(value)
+ var_list.append(key)
+ yatest_logger.debug("Variables loaded: %s", var_list)
+
@property
def source_root(self):
return self._source_root