Mercurial > repos > fubar > tool_factory_2
comparison toolfactory/rgToolFactory2.py @ 97:515be7318f2b draft
Uploaded
author | fubar |
---|---|
date | Sat, 21 Nov 2020 10:11:36 +0000 |
parents | d54976fc996a |
children | 67628c7dc9f3 |
comparison
equal
deleted
inserted
replaced
96:d54976fc996a | 97:515be7318f2b |
---|---|
989 "--test_output", os.path.abspath(tool_test_path), | 989 "--test_output", os.path.abspath(tool_test_path), |
990 "--skip_venv", | 990 "--skip_venv", |
991 "--galaxy_root", | 991 "--galaxy_root", |
992 self.args.galaxy_root, | 992 self.args.galaxy_root, |
993 os.path.abspath(xreal), | 993 os.path.abspath(xreal), |
994 ] | |
995 p = subprocess.run( | |
996 cll, shell=False, cwd=self.testdir, stderr=tout, stdout=tout | |
997 ) | |
998 tout.close() | |
999 return p.returncode | |
1000 | |
1001 | |
1002 def gal_test(self, genoutputs=True): | |
1003 """ | |
1004 export GALAXY_TEST_SAVE="./foo" && export GALAXY_TEST_NO_CLEANUP="1" \ | |
1005 && export GALAXY_TEST_TMP_DIR=./foo && sh run_tests.sh --id rgtf2 --report_file tool_tests_tool_conf.html functional.test_toolbox | |
1006 | |
1007 """ | |
1008 tool_test_rep_path = os.path.join(self.repdir,f"{self.tool_name}_galaxy_test_report.html") | |
1009 if os.path.exists(self.tlog): | |
1010 tout = open(self.tlog, "a") | |
1011 else: | |
1012 tout = open(self.tlog, "w") | |
1013 if genoutputs: | |
1014 dummy, tfile = tempfile.mkstemp() | |
1015 cll = [ | |
1016 "mkdir -p ./test","&&","export GALAXY_TEST_SAVE='./test'", "&&", "export GALAXY_TEST_NO_CLEANUP='1'", \ | |
1017 "&&", "export GALAXY_TEST_TMP_DIR='./test'", "&&", f"sh {self.args.galaxy_root}/run_tests.sh --id {self.args.tool_id} --report_file {tool_test_rep_path} functional.test_toolbox", | |
1018 ] | |
1019 p = subprocess.run( | |
1020 cll, | |
1021 shell=False, | |
1022 cwd=self.testdir, | |
1023 stderr=dummy, | |
1024 stdout=dummy, | |
1025 ) | |
1026 # if all went well, tgz is in ./test and down a nest of tmp directories lurk the output files | |
1027 outfiles = [] | |
1028 for p in self.outfiles: | |
1029 oname = p[ONAMEPOS] | |
1030 outfiles.append(oname) | |
1031 paths = [] | |
1032 for root, dirs, files in os.walk('./test'): | |
1033 for f in files: | |
1034 if f in outfiles: | |
1035 paths.append([root,f]) | |
1036 for p in paths: | |
1037 src = os.path.join(p[0],p[1]) | |
1038 dest = os.path.join(self.testdir,f"{p[1]}_sample") | |
1039 shutil.copyfile(src,dest) | |
1040 | |
1041 else: | |
1042 cll = [ | |
1043 "mkdir -p ./test","&&","rm -rf ./test/*","&&","export GALAXY_TEST_SAVE='./test'", "&&", "export GALAXY_TEST_NO_CLEANUP=", \ | |
1044 "&&", "export GALAXY_TEST_TMP_DIR='./test'", "&&", f"sh {self.args.galaxy_root}/run_tests.sh --id {self.args.tool_id} --report_file {tool_test_rep_path} functional.test_toolbox", | |
994 ] | 1045 ] |
995 p = subprocess.run( | 1046 p = subprocess.run( |
996 cll, shell=False, cwd=self.testdir, stderr=tout, stdout=tout | 1047 cll, shell=False, cwd=self.testdir, stderr=tout, stdout=tout |
997 ) | 1048 ) |
998 tout.close() | 1049 tout.close() |
1149 if args.make_Tool == "generate": | 1200 if args.make_Tool == "generate": |
1150 retcode = r.run() | 1201 retcode = r.run() |
1151 r.moveRunOutputs() | 1202 r.moveRunOutputs() |
1152 r.makeToolTar() | 1203 r.makeToolTar() |
1153 else: | 1204 else: |
1154 retcode = r.planemo_test(genoutputs=True) # this fails :( - see PR | 1205 r.makeToolTar() |
1206 r.shedLoad() | |
1207 r.eph_galaxy_load() | |
1208 retcode = r.gal_test(genoutputs=True) # this fails | |
1209 r.makeToolTar() | |
1210 retcode = r.gal_test(genoutputs=False) | |
1155 r.moveRunOutputs() | 1211 r.moveRunOutputs() |
1156 r.makeToolTar() | 1212 r.makeToolTar() |
1157 retcode = r.planemo_test(genoutputs=False) | 1213 print(f"second galaxy_test returned {retcode}") |
1158 r.moveRunOutputs() | |
1159 r.makeToolTar() | |
1160 print(f"second planemo_test returned {retcode}") | |
1161 if args.make_Tool == "gentestinstall": | |
1162 r.shedLoad() | |
1163 r.eph_galaxy_load() | |
1164 | 1214 |
1165 | 1215 |
1166 if __name__ == "__main__": | 1216 if __name__ == "__main__": |
1167 main() | 1217 main() |