e3.testsuite.testcase_finder

Attributes

TestFinderResult

Exceptions

ProbingError

Exception raised in TestFinder.probe when a test is misformatted.

Classes

ParsedTest

Basic information to instantiate a test driver.

TestFinder

Interface for objects that find testcases in the tests subdirectory.

YAMLTestFinder

Look for "test.yaml"-based tests.

AdaCoreLegacyTestFinder

Look for testcases in directories whose name matches a Ticket Number.

Module Contents

class e3.testsuite.testcase_finder.ParsedTest

Basic information to instantiate a test driver.

test_name: str

Name for this testcase.

driver_cls: Type[e3.testsuite.driver.TestDriver] | None

Test driver class to instantiate, None to use the default one.

test_env: dict

Base test environment.

Driver instantiation will complete it with test directory, test name, etc.

test_dir: str

Directory that contains the testcase.

test_matcher: str | None = None

Textual text matcher.

If not None, string to match against the list of requested tests to run: in that case, the test is ignored if there is no match. This is needed to filter out tests in testsuites where tests don’t necessarily have dedicated directories.

e3.testsuite.testcase_finder.TestFinderResult
exception e3.testsuite.testcase_finder.ProbingError

Bases: Exception

Exception raised in TestFinder.probe when a test is misformatted.

class e3.testsuite.testcase_finder.TestFinder

Interface for objects that find testcases in the tests subdirectory.

property test_dedicated_directory: bool

Return whether each test has a dedicated test directory.

Even though e3-testsuite is primarily designed for this to be true, some testsuites actually host multiple tests in the same directory. When this is the case, we need to probe all directories and only then filter which test to run using ParsedTest.test_matcher.

abstractmethod probe(testsuite: e3.testsuite.TestsuiteCore, dirpath: str, dirnames: List[str], filenames: List[str]) TestFinderResult

Return a test if the “dirpath” directory contains a testcase.

Raise a ProbingError if anything is wrong.

Parameters:
  • testsuite – Testsuite instance that is looking for testcases.

  • dirpath – Directory to probe for a testcase.

  • dirnames – List of directories that “dirpath” contains.

  • filenames – List of files that “dirpath” contains.

class e3.testsuite.testcase_finder.YAMLTestFinder

Bases: TestFinder

Look for “test.yaml”-based tests.

This considers that all directories that contain a “test.yaml” file are testcases. This file is parsed as YAML, the result is used as a test environment, and if it contains a “driver” key, it uses the testsuite driver whose name corresponds to the associated string value.

probe(testsuite: e3.testsuite.TestsuiteCore, dirpath: str, dirnames: List[str], filenames: List[str]) TestFinderResult

Return a test if the “dirpath” directory contains a testcase.

Raise a ProbingError if anything is wrong.

Parameters:
  • testsuite – Testsuite instance that is looking for testcases.

  • dirpath – Directory to probe for a testcase.

  • dirnames – List of directories that “dirpath” contains.

  • filenames – List of files that “dirpath” contains.

class e3.testsuite.testcase_finder.AdaCoreLegacyTestFinder(driver_cls: Type[e3.testsuite.driver.TestDriver])

Bases: TestFinder

Look for testcases in directories whose name matches a Ticket Number.

TN_RE
driver_cls
probe(testsuite: e3.testsuite.TestsuiteCore, dirpath: str, dirnames: List[str], filenames: List[str]) TestFinderResult

Return a test if the “dirpath” directory contains a testcase.

Raise a ProbingError if anything is wrong.

Parameters:
  • testsuite – Testsuite instance that is looking for testcases.

  • dirpath – Directory to probe for a testcase.

  • dirnames – List of directories that “dirpath” contains.

  • filenames – List of files that “dirpath” contains.