Files
Pierre-Marie de Rodat c81db28966 Testsuite: switch to Python3 and e3-testsuite
Also introduce a Mypy setup, to type-check the testsuite code (only that
for now).

Change-Id: Ib90b1ac7e344fb34c7560dc0ff32ca95e0705cd7
TN: U622-042
2021-10-13 11:48:31 +02:00

50 lines
1.3 KiB
Python

from __future__ import annotations
from dataclasses import dataclass
import os.path
from typing import List, Optional
def indent(text: str, prefix: str = " ") -> str:
"""
Indent all lines in `text` with the given prefix.
:param text: Text to indent.
:param prefix: Indentation string.
"""
return "\n".join(prefix + line for line in text.splitlines())
def env_path_split(path_list: Optional[str]) -> List[str]:
"""
Split a *PATH environment variable into a list of paths.
:param path_list: Content of a *PATH environment variable, for instance
PYTHONPATH.
"""
return path_list.split(os.path.pathsep) if path_list else []
def env_path_format(path_list: List[str]) -> str:
"""
Format a list of paths for a *PATH environment variable.
:param path_list: List of paths.
"""
return os.path.pathsep.join(path_list)
@dataclass
class TestsuiteConfig:
no_auto_pythonpath: bool
"""Whether to automatically add "gnatdbg" to the PYTHONPATH."""
coverage: bool
"""Whether gnatdbg code coverage is enabled."""
coverage_dir: str
"""Path to the directory where to store coverage data for each test."""
coverage_rcfile: str
"""Path to the configuration file for Python's coverage module."""