diff --git a/komodo/release_transpiler.py b/komodo/release_transpiler.py index 54f24e5f9..f3af64e36 100755 --- a/komodo/release_transpiler.py +++ b/komodo/release_transpiler.py @@ -106,13 +106,13 @@ def _check_consistency_in_versions( ) -def transpile_releases(matrix_file: str, output_folder: str, coords: dict) -> None: +def transpile_releases(matrix_file: str, output_folder: str, matrix: dict) -> None: """Transpile a matrix file possibly containing different os and framework versions (e.g. rhel6 and rhel7, py3.6 and py3.8). Write one dimension file for each element in the matrix (e.g. rhel7 and py3.8, rhel6 and py3.6)""" - rhel_versions = coords["rhel"] - python_versions = coords["py"] + rhel_versions = matrix["rhel"] + python_versions = matrix["py"] release_base = os.path.splitext(os.path.basename(matrix_file))[0] release_folder = os.path.dirname(matrix_file) @@ -133,7 +133,7 @@ def combine(args): def transpile(args): - transpile_releases(args.matrix_file, args.output_folder, args.coords) + transpile_releases(args.matrix_file, args.output_folder, args.matrix) def main(): @@ -206,11 +206,11 @@ def main(): help="Folder to output new release files", ) transpile_parser.add_argument( - "--coords", - help="Coordinates of the matrix to be transpiled.", + "--matrix", + help="Matrix to be transpiled.", type=yaml.safe_load, required=False, - default="{rhel: ['7'], py: ['3.8']}", + default="{'rhel': ['7'], 'py': ['3.8']}", ) args = parser.parse_args() args.func(args) diff --git a/tests/test_release_transpiler.py b/tests/test_release_transpiler.py index 2da053d5a..5b6217f2a 100644 --- a/tests/test_release_transpiler.py +++ b/tests/test_release_transpiler.py @@ -38,16 +38,16 @@ def test_build_release_matrix(tmpdir): @pytest.mark.parametrize( - "coords", + "matrix", [({"py": ["3.8"], "rhel": ["7"]}), ({"py": ["3.8", "3.10"], "rhel": ["7", "8"]})], ) -def test_transpile_add_argument(tmpdir, coords): +def test_transpile_add_argument(tmpdir, matrix): release_file = os.path.join(_get_test_root(), "data", "test_release_matrix.yml") release_base = os.path.basename(release_file).strip(".yml") with tmpdir.as_cwd(): - transpile_releases(release_file, os.getcwd(), coords) - rhel_ver_str = f"rhel{coords['rhel'][0]}" - py_ver_str = f"py{coords['py'][0].replace('.', '')}" + transpile_releases(release_file, os.getcwd(), matrix) + rhel_ver_str = f"rhel{matrix['rhel'][0]}" + py_ver_str = f"py{matrix['py'][0].replace('.', '')}" assert os.path.isfile( "{}-{}-{}.yml".format(release_base, py_ver_str, rhel_ver_str) @@ -55,17 +55,17 @@ def test_transpile_add_argument(tmpdir, coords): @pytest.mark.parametrize( - "coords", + "matrix", [ ({"py": ["3.8"], "rhel": ["7"]}), ({"py": ["3.7"], "rhel": ["7"]}), ({"py": ["3.6"], "rhel": ["5"]}), ], ) -def test_validate_versions_in_args_with_release_file(coords): +def test_validate_versions_in_args_with_release_file(matrix): release_file = os.path.join(_get_test_root(), "data", "test_release_matrix.yml") try: - transpile_releases(release_file, os.getcwd(), coords) + transpile_releases(release_file, os.getcwd(), matrix) except KeyError as exception_info: assert "not found in package" in str(exception_info)