11import itertools
22import platform
3- import sys
43import tempfile
54import zipfile
65from pathlib import Path
109import pythonfmu
1110from pythonfmu .builder import FmuBuilder , get_platform
1211
13- DEMO = "pythonslave.py"
1412PROJECT_TEST_CASES = [
1513 ("dummy.txt" ,),
1614 ("dummy.py" , "subdir/dummy.txt" ),
2523
2624
2725def test_zip_content (tmp_path ):
28- script_file = Path (__file__ ).parent / DEMO
2926
27+ script_name = "pythonslave.py"
28+ script_file = Path (__file__ ).parent / "slaves" / script_name
3029 fmu = FmuBuilder .build_FMU (script_file , dest = tmp_path )
3130 assert fmu .exists ()
3231 assert zipfile .is_zipfile (fmu )
@@ -35,7 +34,7 @@ def test_zip_content(tmp_path):
3534 names = files .namelist ()
3635
3736 assert "modelDescription.xml" in names
38- assert "/" .join (("resources" , DEMO )) in names
37+ assert "/" .join (("resources" , script_name )) in names
3938 module_file = "/" .join (("resources" , "slavemodule.txt" ))
4039 assert module_file in names
4140
@@ -72,9 +71,8 @@ def test_zip_content(tmp_path):
7271
7372@pytest .mark .parametrize ("pfiles" , PROJECT_TEST_CASES )
7473def test_project_files (tmp_path , pfiles ):
75- script_file = Path (__file__ ).parent / DEMO
7674 pfiles = map (Path , pfiles )
77-
75+ script_file = Path ( __file__ ). parent / "slaves/pythonslave.py"
7876 def build ():
7977 with tempfile .TemporaryDirectory () as project_dir :
8078 project_dir = Path (project_dir )
@@ -120,13 +118,13 @@ def build():
120118
121119@pytest .mark .parametrize ("pfiles" , PROJECT_TEST_CASES )
122120def test_project_files_containing_script (tmp_path , pfiles ):
123- orig_script_file = Path (__file__ ).parent / DEMO
121+ orig_script_file = Path (__file__ ).parent / "slaves/pythonslave.py"
124122 pfiles = map (Path , pfiles )
125123
126124 def build ():
127125 with tempfile .TemporaryDirectory () as project_dir :
128126 project_dir = Path (project_dir )
129- script_file = project_dir / DEMO
127+ script_file = project_dir / "slave.py"
130128 with open (orig_script_file ) as script_f :
131129 script_file .write_text (script_f .read ())
132130
@@ -159,8 +157,7 @@ def build():
159157
160158
161159def test_documentation (tmp_path ):
162- script_file = Path (__file__ ).parent / DEMO
163-
160+ script_file = Path (__file__ ).parent / "slaves/pythonslave.py"
164161 def build ():
165162 with tempfile .TemporaryDirectory () as documentation_dir :
166163 doc_dir = Path (documentation_dir )
0 commit comments