Skip to content

Commit 4ff426f

Browse files
committed
test: attempt to add test case
1 parent 22c3244 commit 4ff426f

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

tests/tests.py

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,40 @@ def get_executor(self) -> str:
1818

1919
def get_executor_settings(self) -> Optional[ExecutorSettingsBase]:
2020
return ExecutorSettings(init_seconds_before_status_checks=1)
21+
22+
class TestEfficiencyReport(snakemake.common.tests.TestWorkflowsLocalStorageBase):
23+
__test__ = True
24+
25+
def get_executor(self) -> str:
26+
return "slurm"
27+
28+
def get_executor_settings(self) -> Optional[ExecutorSettingsBase]:
29+
return ExecutorSettings(efficiency_report=True,
30+
init_seconds_before_status_checks=1)
31+
32+
def test_efficiency_report_generation(self):
33+
# 1. Define a simple workflow (e.g., in a temporary file)
34+
workflow_content = """
35+
rule all:
36+
input:
37+
"output.txt"
38+
39+
rule dummy_rule:
40+
output:
41+
"output.txt"
42+
shell:
43+
"touch output.txt"
44+
"""
45+
with open("Snakefile", "w") as f:
46+
f.write(workflow_content)
47+
48+
# 2. Run the workflow
49+
self.run_snakemake()
50+
51+
# 3. Verify the report file exists
52+
report_filename = f"efficiency_report_{self.run_uuid}.log"
53+
report_path = os.path.join(self.slurm_logdir, report_filename)
54+
self.assertTrue(os.path.exists(report_path), f"Report file {report_path} not found.")
2155

2256

2357
class TestWorkflowsRequeue(TestWorkflows):
@@ -251,7 +285,6 @@ def test_gpu_model_nested_string_raise(self, mock_job):
251285
):
252286
set_gres_string(job)
253287

254-
255288
class TestSLURMResources(TestWorkflows):
256289
"""
257290
Test workflows using job resources passed as part of the job configuration.

0 commit comments

Comments
 (0)