1+ import tempfile
12from pathlib import Path
23
34from libvcell import sbml_to_finite_volume_input , sbml_to_vcml , vcml_to_finite_volume_input , vcml_to_sbml , vcml_to_vcml
@@ -21,30 +22,36 @@ def test_sbml_to_finite_volume_input(temp_output_dir: Path, sbml_file_path: Path
2122 assert msg == "Success"
2223
2324
24- def test_sbml_to_vcml (temp_output_dir : Path , sbml_file_path : Path ) -> None :
25+ def test_sbml_to_vcml (sbml_file_path : Path ) -> None :
2526 sbml_content = sbml_file_path .read_text ()
26- vcml_file_path = temp_output_dir / "test.vcml"
27- success , msg = sbml_to_vcml (sbml_content = sbml_content , vcml_file_path = vcml_file_path )
28- assert vcml_file_path .exists ()
29- assert success is True
30- assert msg == "Success"
27+ with tempfile .TemporaryDirectory () as temp_dir :
28+ temp_output_dir = Path (temp_dir )
29+ vcml_file_path = temp_output_dir / "test.vcml"
30+ success , msg = sbml_to_vcml (sbml_content = sbml_content , vcml_file_path = vcml_file_path )
31+ assert vcml_file_path .exists ()
32+ assert success is True
33+ assert msg == "Success"
3134
3235
33- def test_vcml_to_sbml (temp_output_dir : Path , vcml_file_path : Path , vcml_app_name : str ) -> None :
36+ def test_vcml_to_sbml (vcml_file_path : Path , vcml_app_name : str ) -> None :
3437 vcml_content = vcml_file_path .read_text ()
35- sbml_file_path = temp_output_dir / "test.sbml"
36- success , msg = vcml_to_sbml (
37- vcml_content = vcml_content , application_name = vcml_app_name , sbml_file_path = sbml_file_path
38- )
39- assert sbml_file_path .exists ()
40- assert success is True
41- assert msg == "Success"
42-
43-
44- def test_vcml_to_vcml (temp_output_dir : Path , vcml_file_path : Path ) -> None :
38+ with tempfile .TemporaryDirectory () as temp_dir :
39+ temp_output_dir = Path (temp_dir )
40+ sbml_file_path = temp_output_dir / "test.sbml"
41+ success , msg = vcml_to_sbml (
42+ vcml_content = vcml_content , application_name = vcml_app_name , sbml_file_path = sbml_file_path
43+ )
44+ assert sbml_file_path .exists ()
45+ assert success is True
46+ assert msg == "Success"
47+
48+
49+ def test_vcml_to_vcml (vcml_file_path : Path ) -> None :
4550 vcml_content = vcml_file_path .read_text ()
46- vcml_file_path = temp_output_dir / "test.vcml"
47- success , msg = vcml_to_vcml (vcml_content = vcml_content , vcml_file_path = vcml_file_path )
48- assert vcml_file_path .exists ()
49- assert success is True
50- assert msg == "Success"
51+ with tempfile .TemporaryDirectory () as temp_dir :
52+ temp_output_dir = Path (temp_dir )
53+ vcml_file_path = temp_output_dir / "test.vcml"
54+ success , msg = vcml_to_vcml (vcml_content = vcml_content , vcml_file_path = vcml_file_path )
55+ assert vcml_file_path .exists ()
56+ assert success is True
57+ assert msg == "Success"
0 commit comments