Files
templates/tools/dsview/tests/test_gate_summary.py

22 lines
1.0 KiB
Python

import os
from pathlib import Path
import shutil
import subprocess
import tempfile
import unittest
ROOT = Path(__file__).resolve().parents[1]
COMPILER = shutil.which('g++') or (r'C:/setcorp/tools/msys64/ucrt64/bin/g++.exe' if os.name == 'nt' else None)
@unittest.skipUnless(COMPILER and Path(COMPILER).is_file(), 'C++ compiler required')
class GateSummaryTests(unittest.TestCase):
def test_verdict_priority_completion_and_reset(self):
with tempfile.TemporaryDirectory() as temporary:
binary = Path(temporary) / ('summary.exe' if os.name == 'nt' else 'summary')
env = dict(os.environ)
env['PATH'] = str(Path(COMPILER).parent) + os.pathsep + env.get('PATH', '')
subprocess.run([COMPILER, '-std=c++11', '-static', '-I', str(ROOT / 'native'),
str(ROOT / 'tests/gate_summary_test.cpp'), '-o', str(binary)],
env=env, check=True, capture_output=True)
subprocess.run([str(binary)], env=env, check=True, capture_output=True)