From 2d22f5c0a8b12eab2ddd1fb5bcbe9cede69f5887 Mon Sep 17 00:00:00 2001 From: AJ Schmidt Date: Tue, 16 Aug 2022 10:12:20 -0400 Subject: [PATCH] fix conda env names --- .../rapids_dependency_file_generator.py | 2 +- tests/test_rapids_dependency_file_generator.py | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/rapids_dependency_file_generator/rapids_dependency_file_generator.py b/src/rapids_dependency_file_generator/rapids_dependency_file_generator.py index d14ac408..fd23c410 100644 --- a/src/rapids_dependency_file_generator/rapids_dependency_file_generator.py +++ b/src/rapids_dependency_file_generator/rapids_dependency_file_generator.py @@ -51,7 +51,7 @@ def make_dependency_file( if file_type == str(GeneratorTypes.CONDA): file_contents += yaml.dump( { - "name": name, + "name": os.path.splitext(name)[0], "channels": conda_channels, "dependencies": dependencies, } diff --git a/tests/test_rapids_dependency_file_generator.py b/tests/test_rapids_dependency_file_generator.py index 78a225e3..28fadcca 100644 --- a/tests/test_rapids_dependency_file_generator.py +++ b/tests/test_rapids_dependency_file_generator.py @@ -24,17 +24,19 @@ def test_dedupe(): assert deduped == ["dep1", {"pip": ["pip_dep1", "pip_dep2"]}] -@mock.patch("rapids_dependency_file_generator.rapids_dependency_file_generator.os.path") -def test_make_dependency_file(mock_path): - relpath = "../../dependencies.yaml" - mock_path.relpath.return_value = relpath +@mock.patch( + "rapids_dependency_file_generator.rapids_dependency_file_generator.os.path.relpath" +) +def test_make_dependency_file(mock_relpath): + relpath = "../../config_file.yaml" + mock_relpath.return_value = relpath header = f"""\ # This file was automatically generated by `{cli_name}`. Changes should not be made directly to this file. # Instead, edit {relpath} and rerun `{cli_name}`. """ env = make_dependency_file( "conda", - "tmp_env", + "tmp_env.yaml", "config_file", "output_path", ["rapidsai", "nvidia"], @@ -50,7 +52,7 @@ def test_make_dependency_file(mock_path): env = make_dependency_file( "requirements", - "tmp_env", + "tmp_env.txt", "config_file", "output_path", ["rapidsai", "nvidia"],