From 84d118b52db6eb4506a683d85bb490f295c953b7 Mon Sep 17 00:00:00 2001 From: dblock Date: Tue, 26 Oct 2021 00:24:49 +0000 Subject: [PATCH] Fix: retry command substitution. Signed-off-by: dblock --- src/build_workflow/build_args.py | 3 +-- src/ci_workflow/ci_args.py | 3 +-- tests/tests_build_workflow/test_build_args.py | 6 ++---- tests/tests_ci_workflow/test_ci_args.py | 6 ++---- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/build_workflow/build_args.py b/src/build_workflow/build_args.py index 078b84f6b0..3e4c7c8dda 100644 --- a/src/build_workflow/build_args.py +++ b/src/build_workflow/build_args.py @@ -6,7 +6,6 @@ import argparse import logging -import os import sys @@ -76,7 +75,7 @@ def __init__(self): self.keep = args.keep self.platform = args.platform self.architecture = args.architecture - self.script_path = sys.argv[0].replace(os.path.sep + os.path.join("src", "run_build.py"), f"{os.path.sep}build.sh") + self.script_path = sys.argv[0].replace("/src/run_build.py", "/build.sh") def component_command(self, name): return " ".join( diff --git a/src/ci_workflow/ci_args.py b/src/ci_workflow/ci_args.py index 93f121c206..12cf0ded7a 100644 --- a/src/ci_workflow/ci_args.py +++ b/src/ci_workflow/ci_args.py @@ -6,7 +6,6 @@ import argparse import logging -import os import sys @@ -46,7 +45,7 @@ def __init__(self): self.component = args.component self.keep = args.keep self.logging_level = args.logging_level - self.script_path = sys.argv[0].replace(os.path.sep + os.path.join("src", "run_ci.py"), f"{os.path.sep}ci.sh") + self.script_path = sys.argv[0].replace("/src/run_ci.py", "/ci.sh") def component_command(self, name): return " ".join( diff --git a/tests/tests_build_workflow/test_build_args.py b/tests/tests_build_workflow/test_build_args.py index 154362cc38..e2e1851a85 100644 --- a/tests/tests_build_workflow/test_build_args.py +++ b/tests/tests_build_workflow/test_build_args.py @@ -14,9 +14,9 @@ class TestBuildArgs(unittest.TestCase): - BUILD_PY = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..", "src", "run_build.py")) + BUILD_PY = "./src/run_build.py" - BUILD_SH = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..", "build.sh")) + BUILD_SH = "./build.sh" OPENSEARCH_MANIFEST = os.path.realpath( os.path.join( @@ -83,8 +83,6 @@ def test_architecture(self): @patch("argparse._sys.argv", [BUILD_PY, OPENSEARCH_MANIFEST, "--component", "xyz"]) def test_script_path(self): - self.assertTrue(os.path.isfile(self.BUILD_PY)) - self.assertTrue(os.path.isfile(self.BUILD_SH)) self.assertEqual(BuildArgs().script_path, self.BUILD_SH) @patch("argparse._sys.argv", [BUILD_PY, OPENSEARCH_MANIFEST]) diff --git a/tests/tests_ci_workflow/test_ci_args.py b/tests/tests_ci_workflow/test_ci_args.py index 786ff07dd3..275a4fd9c0 100644 --- a/tests/tests_ci_workflow/test_ci_args.py +++ b/tests/tests_ci_workflow/test_ci_args.py @@ -13,9 +13,9 @@ class TestCiArgs(unittest.TestCase): - CI_PY = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..", "src", "run_ci.py")) + CI_PY = "./src/run_ci.py" - CI_SH = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "..", "ci.sh")) + CI_SH = "./ci.sh" OPENSEARCH_MANIFEST = os.path.realpath( os.path.join( @@ -58,8 +58,6 @@ def test_component(self): @patch("argparse._sys.argv", [CI_PY, OPENSEARCH_MANIFEST, "--component", "xyz"]) def test_script_path(self): - self.assertTrue(os.path.isfile(self.CI_PY)) - self.assertTrue(os.path.isfile(self.CI_SH)) self.assertEqual(CiArgs().script_path, self.CI_SH) @patch("argparse._sys.argv", [CI_PY, OPENSEARCH_MANIFEST])