|
| 1 | +# Copyright 2022-2025 The Ramble Authors |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 4 | +# https://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 5 | +# <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your |
| 6 | +# option. This file may not be copied, modified, or distributed |
| 7 | +# except according to those terms. |
| 8 | + |
| 9 | +import os |
| 10 | + |
| 11 | +import pytest |
| 12 | + |
| 13 | +import ramble.workspace |
| 14 | +from ramble.main import RambleCommand |
| 15 | + |
| 16 | +pytestmark = pytest.mark.usefixtures( |
| 17 | + "mutable_config", "mutable_mock_workspace_path", "mutable_mock_apps_repo" |
| 18 | +) |
| 19 | + |
| 20 | +workspace = RambleCommand("workspace") |
| 21 | + |
| 22 | + |
| 23 | +def test_object_import_separate_python_source(request): |
| 24 | + ws_name = request.node.name |
| 25 | + ws = ramble.workspace.create(ws_name) |
| 26 | + global_args = ["-w", ws_name] |
| 27 | + |
| 28 | + workspace( |
| 29 | + "manage", |
| 30 | + "experiments", |
| 31 | + "import-test", |
| 32 | + "-v", |
| 33 | + "n_nodes=1", |
| 34 | + "-v", |
| 35 | + "processes_per_node=1", |
| 36 | + global_args=global_args, |
| 37 | + ) |
| 38 | + |
| 39 | + workspace("setup", global_args=global_args) |
| 40 | + |
| 41 | + rendered_script = os.path.join( |
| 42 | + ws.experiment_dir, "import-test", "test", "generated", "execute_experiment" |
| 43 | + ) |
| 44 | + with open(rendered_script) as f: |
| 45 | + content = f.read() |
| 46 | + assert "echo 1" in content |
0 commit comments