Skip to content

Commit

Permalink
Fix submission tests (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
ElliottKasoar authored Nov 20, 2024
1 parent af4fdf6 commit 0ac7f65
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 7 deletions.
12 changes: 10 additions & 2 deletions tests/calculations/test_geomopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,20 @@ def test_run_opt(model_folder, janus_code):
assert result["xyz_output"].filename == "aiida-results.xyz"


def test_example_opt(example_path):
def test_example_opt(example_path, janus_code):
"""Test function to run geometry optimization using the example file provided."""
example_file_path = example_path / "submit_geomopt.py"
command = ["verdi", "run", example_file_path, "janus@localhost"]
command = [
"verdi",
"run",
example_file_path,
f"{janus_code.label}@{janus_code.computer.label}",
]

# Execute the command
result = subprocess.run(command, capture_output=True, text=True, check=False)
assert result.stderr == ""
assert result.returncode == 0
assert "results from calculation:" in result.stdout
assert "'traj_file': <SinglefileData: uuid:" in result.stdout
assert "'final_structure': <StructureData: uuid:" in result.stdout
17 changes: 14 additions & 3 deletions tests/calculations/test_md.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,23 @@ def test_run_md(model_folder, structure_folder, janus_code):
) # check


def test_example_md(example_path):
def test_example_md(example_path, janus_code):
"""Test function to run MD calculation using the example file provided."""
example_file_path = example_path / "submit_md.py"
command = ["verdi", "run", example_file_path, "janus@localhost"]

command = [
"verdi",
"run",
example_file_path,
f"{janus_code.label}@{janus_code.computer.label}",
"--md_dict_str",
"{'steps': 10, 'traj-every': 1}",
]
# Execute the command
result = subprocess.run(command, capture_output=True, text=True, check=False)
assert result.stderr == ""
assert result.returncode == 0
assert "results from calculation:" in result.stdout
assert "'results_dict': <Dict: uuid:" in result.stdout
assert "'traj_output': <TrajectoryData: uuid:" in result.stdout
assert "'final_structure': <StructureData: uuid" in result.stdout
assert "'stats_file': <SinglefileData: uuid" in result.stdout
12 changes: 10 additions & 2 deletions tests/calculations/test_singlepoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,20 @@ def test_run_sp(model_folder, janus_code):
assert obtained_res["info"]["mace_stress"][0] == pytest.approx(-0.005816546985101)


def test_example(example_path):
def test_example(example_path, janus_code):
"""Test function to run singlepoint calculation using the example file provided."""
example_file_path = example_path / "submit_singlepoint.py"
command = ["verdi", "run", example_file_path, "janus@localhost"]
command = [
"verdi",
"run",
example_file_path,
f"{janus_code.label}@{janus_code.computer.label}",
]

# Execute the command
result = subprocess.run(command, capture_output=True, text=True, check=False)
assert result.stderr == ""
assert result.returncode == 0
assert "results from calculation:" in result.stdout
assert "'results_dict': <Dict: uuid:" in result.stdout
assert "'xyz_output': <SinglefileData: uuid:" in result.stdout

0 comments on commit 0ac7f65

Please sign in to comment.