e3.testsuite.testcase_finder
============================

.. py:module:: e3.testsuite.testcase_finder


Attributes
----------

.. autoapisummary::

   e3.testsuite.testcase_finder.TestFinderResult


Exceptions
----------

.. autoapisummary::

   e3.testsuite.testcase_finder.ProbingError


Classes
-------

.. autoapisummary::

   e3.testsuite.testcase_finder.ParsedTest
   e3.testsuite.testcase_finder.TestFinder
   e3.testsuite.testcase_finder.YAMLTestFinder
   e3.testsuite.testcase_finder.AdaCoreLegacyTestFinder


Module Contents
---------------

.. py:class:: ParsedTest

   Basic information to instantiate a test driver.


   .. py:attribute:: test_name
      :type:  str

      Name for this testcase.



   .. py:attribute:: driver_cls
      :type:  Optional[Type[e3.testsuite.driver.TestDriver]]

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



   .. py:attribute:: test_env
      :type:  dict

      Base test environment.

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



   .. py:attribute:: test_dir
      :type:  str

      Directory that contains the testcase.



   .. py:attribute:: test_matcher
      :type:  Optional[str]
      :value: 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.



.. py:data:: TestFinderResult

.. py:exception:: ProbingError

   Bases: :py:obj:`Exception`


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


.. py:class:: TestFinder

   Interface for objects that find testcases in the tests subdirectory.


   .. py:property:: test_dedicated_directory
      :type: 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.



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


      Return a test if the "dirpath" directory contains a testcase.

      Raise a ProbingError if anything is wrong.

      :param testsuite: Testsuite instance that is looking for testcases.
      :param dirpath: Directory to probe for a testcase.
      :param dirnames: List of directories that "dirpath" contains.
      :param filenames: List of files that "dirpath" contains.



.. py:class:: YAMLTestFinder

   Bases: :py:obj:`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.


   .. py:method:: 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.

      :param testsuite: Testsuite instance that is looking for testcases.
      :param dirpath: Directory to probe for a testcase.
      :param dirnames: List of directories that "dirpath" contains.
      :param filenames: List of files that "dirpath" contains.



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

   Bases: :py:obj:`TestFinder`


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


   .. py:attribute:: TN_RE


   .. py:attribute:: driver_cls


   .. py:method:: 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.

      :param testsuite: Testsuite instance that is looking for testcases.
      :param dirpath: Directory to probe for a testcase.
      :param dirnames: List of directories that "dirpath" contains.
      :param filenames: List of files that "dirpath" contains.



