429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
|
bUseCache = None # we may rebuild if it’s necessary
if xArgs.use_cache:
bUseCache = True # we use the cache if it exists
if xArgs.force_rebuild:
bUseCache = False # we rebuild
sVersion = create(sLang, xConfig, xArgs.install, xArgs.javascript, bUseCache)
# tests
if xArgs.tests or xArgs.perf or xArgs.perf_memo:
print("> Running tests")
try:
tests = importlib.import_module("grammalecte."+sLang+".tests")
print(tests.__file__)
except ImportError:
print(f"# Error. Import failed: grammalecte.{sLang}.tests")
traceback.print_exc()
else:
if xArgs.tests:
xTestSuite = unittest.TestLoader().loadTestsFromModule(tests)
unittest.TextTestRunner().run(xTestSuite)
if xArgs.perf or xArgs.perf_memo:
hDst = open("./gc_lang/"+sLang+"/perf_memo.txt", "a", encoding="utf-8", newline="\n") if xArgs.perf_memo else None
tests.perf(sVersion, hDst)
# JavaScript linter
if xArgs.lint_web_ext:
with helpers.CD("_build/webext/"+sLang):
os.system(r'web-ext lint -o text')
# Firefox
|
|
|
>
>
>
>
>
>
|
<
|
<
<
<
<
<
<
|
|
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
|
bUseCache = None # we may rebuild if it’s necessary
if xArgs.use_cache:
bUseCache = True # we use the cache if it exists
if xArgs.force_rebuild:
bUseCache = False # we rebuild
sVersion = create(sLang, xConfig, xArgs.install, xArgs.javascript, bUseCache)
# Tests
if xArgs.tests:
print("> Running tests")
lTestModules = [f"grammalecte.{sLang}.tests_core", \
f"grammalecte.{sLang}.tests_modules"]
xTestSuite = unittest.TestLoader().loadTestsFromNames(lTestModules)
unittest.TextTestRunner().run(xTestSuite)
if xArgs.perf or xArgs.perf_memo:
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)
# JavaScript linter
if xArgs.lint_web_ext:
with helpers.CD("_build/webext/"+sLang):
os.system(r'web-ext lint -o text')
# Firefox
|