Index: gc_core/py/lang_core/tests_core.py ================================================================== --- gc_core/py/lang_core/tests_core.py +++ gc_core/py/lang_core/tests_core.py @@ -26,11 +26,11 @@ print('{} : {}'.format(label, end - start)) if hDst: hDst.write("{:<12.6}".format(end-start)) -def perf (sVersion, bMemo=False): +def perf (sVersion, sResultFile=""): "performance tests" print("Performance tests") gc_engine.load() gc_engine.parse("Text to compile rules before launching real tests.") @@ -38,11 +38,11 @@ spfPerfTest = os.path.join(spHere, "perf.txt") if not os.path.exists(spfPerfTest): print(f"No file in <{spHere}>") return with open(spfPerfTest, "r", encoding="utf-8") as hSrc: - hDst = open("./gc_lang/"+sLang+"/perf_memo.txt", "a", encoding="utf-8", newline="\n") if bMemo else None + hDst = open(sResultFile, "a", encoding="utf-8", newline="\n") if sResultFile else None if hDst: hDst.write("{:<12}{:<20}".format(sVersion, time.strftime("%Y.%m.%d %H:%M"))) for sText in ( s.strip() for s in hSrc if not s.startswith("#") and s.strip() ): with timeblock(sText[:sText.find(".")], hDst): gc_engine.parse(sText) Index: make.py ================================================================== --- make.py +++ make.py @@ -449,11 +449,12 @@ try: tests = importlib.import_module(f"grammalecte.{sLang}.tests_core") except ImportError: print(f"# Error. Import failed: grammalecte.{sLang}.tests_core") else: - tests.perf(sVersion, xArgs.perf_memo) + sResultFile = f"gc_lang/{sLang}/perf_memo.text" if xArgs.perf_memo else "" + tests.perf(sVersion, sResultFile) # JavaScript linter if xArgs.lint_web_ext: with helpers.CD("_build/webext/"+sLang): os.system(r'web-ext lint -o text')