Files
templates-parser/regtests/test_support.py
Victor Verbeke f0fba60ca9 Fix tests on Windows (#55)
* Fix run command with interpreter, fix test paths

Two problems fixed:
- Bug introduced in previous merge request that would crash Run by
  giving it a bad kwarg. Reverted to self.shell, but used the
  e3.sys.interpreter to be more flexible.
- Replaced the tests naming by setting a tests_subdir instead of a
  test_name method, which would crash Windows tests.

TN: V223-017
2022-06-29 18:15:15 +02:00

28 lines
594 B
Python
Executable File

"""
This module contains support functions for all test.py
"""
from e3.os.process import Run
import os
import sys
def gprbuild(prj):
"""Compile a project with gprbuild"""
cmd = ["gprbuild", "-p", "-P" + prj, "-bargs", "-E"]
process = Run(cmd)
if process.status:
print(process.out)
def run(bin, options=None, output_file=None):
"""Run a test"""
if options is None:
options = []
if "TIMEOUT" in os.environ:
timeout = int(os.environ["TIMEOUT"])
else:
timeout = 300
Run([bin] + options, output=output_file, timeout=timeout)