@@ -62,7 +62,7 @@ def force(t: float, ampl: float = 1.0, omega: float = 0.1):
6262 return np .array ((0 , 0 , ampl * sin (omega * t )), dtype = float )
6363
6464
65- @pytest .fixture ( scope = "session" )
65+ @pytest .fixture
6666def oscillator_fmu ():
6767 return _oscillator_fmu ()
6868
@@ -79,7 +79,7 @@ def _oscillator_fmu():
7979 return fmu_path
8080
8181
82- @pytest .fixture ( scope = "session" )
82+ @pytest .fixture
8383def driver_fmu ():
8484 return _driver_fmu ()
8585
@@ -97,15 +97,15 @@ def _driver_fmu():
9797 return fmu_path
9898
9999
100- @pytest .fixture ( scope = "session" )
100+ @pytest .fixture
101101def system_structure ():
102102 return _system_structure ()
103103
104104
105105def _system_structure ():
106106 """Make a OSP structure file and return the path"""
107107 path = make_osp_system_structure (
108- name = "ForcedOscillator " ,
108+ name = "OspSystemStructure " ,
109109 simulators = {
110110 "osc" : {"source" : "HarmonicOscillator.fmu" , "stepSize" : 0.01 },
111111 "drv" : {"source" : "DrivingForce.fmu" , "stepSize" : 0.01 },
@@ -115,7 +115,8 @@ def _system_structure():
115115 start = 0.0 ,
116116 base_step = 0.01 ,
117117 algorithm = "fixedStep" ,
118- path = Path (__file__ ).parent / "data" / "Oscillator" ,
118+ # path=Path(__file__).parent / "data" / "Oscillator",
119+ path = Path .cwd (),
119120 )
120121
121122 return path
@@ -171,6 +172,7 @@ def test_make_fmus(
171172 assert not len (val ), f"Validation of of { oscillator_fmu .name } was not successful. Errors: { val } "
172173
173174
175+ @pytest .mark .usefixtures ("oscillator_fmu" , "driver_fmu" )
174176def test_make_system_structure (system_structure : Path ):
175177 assert Path (system_structure ).exists (), "System structure not created"
176178 el = from_xml (Path (system_structure ))
@@ -228,6 +230,7 @@ def test_run_osp(oscillator_fmu: Path, driver_fmu: Path):
228230
229231
230232@pytest .mark .skipif (sys .platform .startswith ("linux" ), reason = "HarmonicOsciallator.fmu throws an error on Linux" )
233+ @pytest .mark .usefixtures ("oscillator_fmu" , "driver_fmu" )
231234def test_run_osp_system_structure (system_structure : Path , show : bool ):
232235 "Run an OSP simulation in the same way as the SimulatorInterface of case_study is implemented"
233236 log_output_level (CosimLogLevel .TRACE )
0 commit comments