|
14 | 14 | from util import UserError
|
15 | 15 |
|
16 | 16 |
|
17 |
| -@pytest.mark.parametrize("work_dir", [None, "/unknown/file", "./tests/.cache/action1"]) |
| 17 | +@pytest.mark.parametrize("work_dir", ["/unknown/file", "./tests/.cache/action1"]) |
18 | 18 | @pytest.mark.parametrize("name", [None, "", "action"])
|
19 | 19 | @pytest.mark.parametrize("description", [None, "", "desssscriippttion"])
|
20 | 20 | @pytest.mark.parametrize("image", [None, "", "immmaage"])
|
21 | 21 | @pytest.mark.parametrize("entrypoint", [None, "", "ennntrrrypopiint"])
|
22 | 22 | @pytest.mark.parametrize("args", [None, [], ["1"], ["1", "2"], ["1", "", ""]])
|
23 | 23 | def test_action(work_dir: str, name: str, description: str, image: str, entrypoint: str, args: Sequence[str]):
|
24 |
| - action: Action = Action(work_dir=Path(work_dir) if work_dir is not None else None, |
| 24 | + action: Action = Action(work_dir=Path(work_dir), |
25 | 25 | name=name,
|
26 | 26 | description=description,
|
27 | 27 | image=image,
|
28 |
| - entrypoint=entrypoint, args=args) |
29 |
| - assert action.work_dir == (Path(work_dir) if work_dir is not None else None) |
| 28 | + entrypoint=entrypoint, |
| 29 | + args=args) |
| 30 | + assert action.work_dir == Path(work_dir).absolute() |
30 | 31 | assert action.name == name
|
31 | 32 | assert action.description == description
|
32 | 33 | assert action.image == image
|
@@ -66,7 +67,7 @@ def test_plug(name: str,
|
66 | 67 | allowed_resource_names=allowed_resource_names,
|
67 | 68 | allowed_resource_types=allowed_resource_types)
|
68 | 69 | assert plug.name == name
|
69 |
| - assert plug.path == Path(path) |
| 70 | + assert plug.path == Path(path).absolute() |
70 | 71 | assert plug.readonly == readonly
|
71 | 72 | assert plug.resource_name_patterns == allowed_resource_names
|
72 | 73 | assert plug.resource_type_patterns == allowed_resource_types
|
@@ -143,7 +144,7 @@ def create_manifest():
|
143 | 144 | for plug_name, expected_plug in expected['plugs'].items():
|
144 | 145 | plug: Plug = manifest.plug(plug_name)
|
145 | 146 | if 'name' in expected_plug: assert plug.name == expected_plug['name']
|
146 |
| - if 'path' in expected_plug: assert plug.path == Path(expected_plug['path']) |
| 147 | + if 'path' in expected_plug: assert plug.path == Path(expected_plug['path']).absolute() |
147 | 148 | if 'readonly' in expected_plug: assert plug.readonly == expected_plug['readonly']
|
148 | 149 | if 'resource_name_patterns' in expected_plug:
|
149 | 150 | assert plug.resource_name_patterns == expected_plug['resource_name_patterns']
|
@@ -308,6 +309,6 @@ def test_resource_initialize(capsys):
|
308 | 309 | assert resource._state_action.args == init_result['state_action']['args']
|
309 | 310 | assert resource._status == ResourceStatus.INITIALIZED
|
310 | 311 | assert resource._plug_volumes == [
|
311 |
| - f"{str(scenario_dir / 'p2')}:{init_result['plugs']['readonly_plug']['container_path']}:ro", |
312 |
| - f"{str(scenario_dir / 'p1')}:{init_result['plugs']['writable_plug']['container_path']}:rw" |
| 312 | + f"{str((scenario_dir / 'p2').absolute())}:{init_result['plugs']['readonly_plug']['container_path']}:ro", |
| 313 | + f"{str((scenario_dir / 'p1').absolute())}:{init_result['plugs']['writable_plug']['container_path']}:rw" |
313 | 314 | ]
|
0 commit comments