Skip to content

Commit 345ca41

Browse files
committed
Improve tests and update changelog
1 parent 8e82938 commit 345ca41

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## Changes in 0.1.2 (in development)
22

3+
* Improve handling of environment file specification (#63)
4+
35
## Changes in 0.1.1
46

57
* Improve automated parameter extraction (#9)

test/test_cli.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,11 @@ def test_make_script(
6262

6363

6464
@pytest.mark.parametrize("specify_dir", [False, True])
65+
@pytest.mark.parametrize("specify_env", [False, True])
6566
@patch("xcengine.cli.ImageBuilder")
66-
def test_image_build(builder_mock, tmp_path, specify_dir):
67+
def test_image_build(builder_mock, tmp_path, specify_dir, specify_env):
6768
(nb_path := tmp_path / "foo.ipynb").touch()
69+
(env_path := tmp_path / "environment.yml").touch()
6870
(build_dir := tmp_path / "build").mkdir()
6971
runner = CliRunner()
7072
tag = "foo"
@@ -73,13 +75,14 @@ def test_image_build(builder_mock, tmp_path, specify_dir):
7375
cli,
7476
["image", "build", "--tag", tag]
7577
+ (["--build-dir", str(build_dir)] if specify_dir else [])
78+
+ (["--environment", str(env_path)] if specify_env else [])
7679
+ [str(nb_path)],
7780
)
7881
assert result.output.startswith("Built image")
7982
assert result.exit_code == 0
8083
builder_mock.assert_called_once_with(
8184
notebook=nb_path,
82-
environment=None,
85+
environment=(env_path if specify_env else None),
8386
tag=tag,
8487
build_dir=(build_dir if specify_dir else ANY),
8588
)

0 commit comments

Comments
 (0)