summaryrefslogtreecommitdiffstats
path: root/library/python/testing/recipe
diff options
context:
space:
mode:
authoriaz1607 <[email protected]>2022-02-10 16:45:37 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:45:37 +0300
commite5437feb4ac2d2dc044e1090b9312dde5ef197e0 (patch)
treef5a238c69dd20a1fa2092127a31b8aff25020f7d /library/python/testing/recipe
parentf4945d0a44b8770f0801de3056aa41639b0b7bd2 (diff)
Restoring authorship annotation for <[email protected]>. Commit 1 of 2.
Diffstat (limited to 'library/python/testing/recipe')
-rw-r--r--library/python/testing/recipe/ports.py66
-rw-r--r--library/python/testing/recipe/ya.make10
2 files changed, 38 insertions, 38 deletions
diff --git a/library/python/testing/recipe/ports.py b/library/python/testing/recipe/ports.py
index 9f7de1e767c..1344a58ac9f 100644
--- a/library/python/testing/recipe/ports.py
+++ b/library/python/testing/recipe/ports.py
@@ -1,33 +1,33 @@
-import os
-import sys
-import subprocess
-import time
-
-from yatest.common.network import PortManager
-
-
-def __get_port_range():
- port_count = int(sys.argv[1])
- pid_filename = sys.argv[2]
- port_manager = PortManager()
- start_port = port_manager.get_port_range(None, port_count)
- sys.stderr.write(str(start_port) + "\n")
- with open(pid_filename, 'w') as afile:
- afile.write(str(os.getpid()))
- while 1:
- time.sleep(1)
-
-
-def get_port_range(port_count=1, pid_filename="recipe_port.pid"):
- env = os.environ.copy()
- env["Y_PYTHON_ENTRY_POINT"] = "library.python.testing.recipe.ports:__get_port_range"
- res = subprocess.Popen([sys.argv[0], str(port_count), pid_filename], env=env, cwd=os.getcwd(), stderr=subprocess.PIPE)
- while not os.path.exists(pid_filename):
- time.sleep(0.01)
- port_start = int(res.stderr.readline())
- return port_start
-
-
-def release_port_range(pid_filename="recipe_port.pid"):
- with open(pid_filename, 'r') as afile:
- os.kill(int(afile.read()), 9)
+import os
+import sys
+import subprocess
+import time
+
+from yatest.common.network import PortManager
+
+
+def __get_port_range():
+ port_count = int(sys.argv[1])
+ pid_filename = sys.argv[2]
+ port_manager = PortManager()
+ start_port = port_manager.get_port_range(None, port_count)
+ sys.stderr.write(str(start_port) + "\n")
+ with open(pid_filename, 'w') as afile:
+ afile.write(str(os.getpid()))
+ while 1:
+ time.sleep(1)
+
+
+def get_port_range(port_count=1, pid_filename="recipe_port.pid"):
+ env = os.environ.copy()
+ env["Y_PYTHON_ENTRY_POINT"] = "library.python.testing.recipe.ports:__get_port_range"
+ res = subprocess.Popen([sys.argv[0], str(port_count), pid_filename], env=env, cwd=os.getcwd(), stderr=subprocess.PIPE)
+ while not os.path.exists(pid_filename):
+ time.sleep(0.01)
+ port_start = int(res.stderr.readline())
+ return port_start
+
+
+def release_port_range(pid_filename="recipe_port.pid"):
+ with open(pid_filename, 'r') as afile:
+ os.kill(int(afile.read()), 9)
diff --git a/library/python/testing/recipe/ya.make b/library/python/testing/recipe/ya.make
index dd323aa2457..4698546e424 100644
--- a/library/python/testing/recipe/ya.make
+++ b/library/python/testing/recipe/ya.make
@@ -5,14 +5,14 @@ OWNER(
PY23_LIBRARY()
-PY_SRCS(
- __init__.py
- ports.py
-)
+PY_SRCS(
+ __init__.py
+ ports.py
+)
PEERDIR(
contrib/python/ipdb
- library/python/testing/yatest_common
+ library/python/testing/yatest_common
library/python/testing/yatest_lib
)