Remove references to self.install_test_root from packaging guide (#25238)

This commit is contained in:
Tamara Dahlgren 2021-08-26 10:22:40 -07:00 committed by GitHub
parent a3d8e95e76
commit 8664abc178
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4368,9 +4368,9 @@ The signature for ``cache_extra_test_sources`` is:
where ``srcs`` is a string or a list of strings corresponding to where ``srcs`` is a string or a list of strings corresponding to
the paths for the files and or subdirectories, relative to the staged the paths for the files and or subdirectories, relative to the staged
source, that are to be copied to the corresponding path relative to source, that are to be copied to the corresponding relative test path
``self.install_test_root``. All of the contents within each subdirectory under the prefix. All of the contents within each subdirectory will
will be also be copied. also be copied.
For example, a package method for copying everything in the ``tests`` For example, a package method for copying everything in the ``tests``
subdirectory plus the ``foo.c`` and ``bar.c`` files from ``examples`` subdirectory plus the ``foo.c`` and ``bar.c`` files from ``examples``
@ -4378,8 +4378,13 @@ can be implemented as shown below.
.. note:: .. note::
The ``run_after`` directive ensures associated files are copied The method name ``copy_test_sources`` here is for illustration
**after** the package is installed by the build process. purposes. You are free to use a name that is more suited to your
package.
The key to copying the files at build time for stand-alone testing
is use of the ``run_after`` directive, which ensures the associated
files are copied **after** the provided build stage.
.. code-block:: python .. code-block:: python
@ -4396,18 +4401,13 @@ can be implemented as shown below.
In this case, the method copies the associated files from the build In this case, the method copies the associated files from the build
stage **after** the software is installed to the package's metadata stage **after** the software is installed to the package's metadata
directory. The result is the directory and files will be cached in directory. The result is the directory and files will be cached in
paths under ``self.install_test_root`` as follows: a special test subdirectory under the installation prefix.
* ``join_path(self.install_test_root, 'tests')`` along with its files
and subdirectories
* ``join_path(self.install_test_root, 'examples', 'foo.c')``
* ``join_path(self.install_test_root, 'examples', 'bar.c')``
These paths are **automatically copied** to the test stage directory These paths are **automatically copied** to the test stage directory
where they are available to the package's ``test`` method through the during stand-alone testing. The package's ``test`` method can access
``self.test_suite.current_test_cache_dir`` property. In our example, them using the ``self.test_suite.current_test_cache_dir`` property.
the method can access the directory and files using the following In our example, the method would use the following paths to reference
paths: the copy of each entry listed in ``srcs``, respectively:
* ``join_path(self.test_suite.current_test_cache_dir, 'tests')`` * ``join_path(self.test_suite.current_test_cache_dir, 'tests')``
* ``join_path(self.test_suite.current_test_cache_dir, 'examples', 'foo.c')`` * ``join_path(self.test_suite.current_test_cache_dir, 'examples', 'foo.c')``
@ -4415,9 +4415,8 @@ paths:
.. note:: .. note::
Library developers will want to build the associated tests under Library developers will want to build the associated tests
the ``self.test_suite.current_test_cache_dir`` and against their against their **installed** libraries before running them.
**installed** libraries before running them.
.. note:: .. note::
@ -4427,11 +4426,6 @@ paths:
would be appropriate for ensuring the installed software continues would be appropriate for ensuring the installed software continues
to work as the underlying system evolves. to work as the underlying system evolves.
.. note::
You are free to use a method name that is more suitable for
your package.
.. _cache_custom_files: .. _cache_custom_files:
""""""""""""""""""" """""""""""""""""""
@ -4510,7 +4504,8 @@ can retrieve the expected output from ``examples/foo.out`` using:
def test(self): def test(self):
.. ..
filename = join_path(self.install_test_root, 'examples', 'foo.out') filename = join_path(self.test_suite.current_test_cache_dir,
'examples', 'foo.out')
expected = get_escaped_text_output(filename) expected = get_escaped_text_output(filename)
.. ..
@ -4678,9 +4673,6 @@ directory paths are provided in the table below.
* - Test Suite Stage Files * - Test Suite Stage Files
- ``self.test_suite.stage`` - ``self.test_suite.stage``
- ``join_path(self.test_suite.stage, 'results.txt')`` - ``join_path(self.test_suite.stage, 'results.txt')``
* - Cached Build-time Files
- ``self.install_test_root``
- ``join_path(self.install_test_root, 'examples', 'foo.c')``
* - Staged Cached Build-time Files * - Staged Cached Build-time Files
- ``self.test_suite.current_test_cache_dir`` - ``self.test_suite.current_test_cache_dir``
- ``join_path(self.test_suite.current_test_cache_dir, 'examples', 'foo.c')`` - ``join_path(self.test_suite.current_test_cache_dir, 'examples', 'foo.c')``