tests.test_manifest
Module Contents
Classes
ManifestInclusionTestSuite is a test suite focused on validating the contents of the source distribution (sdist) for a package, ensuring that it includes required files while excluding unwanted ones. |
Data
API
- tests.test_manifest.__module__[source]
‘tests’
- class tests.test_manifest.ManifestInclusionTestSuite(methodName='runTest')[source][source]
Bases:
context.BasicUsageTestSuiteManifestInclusionTestSuite is a test suite focused on validating the contents of the source distribution (sdist) for a package, ensuring that it includes required files while excluding unwanted ones.
This test suite extends the BasicUsageTestSuite provided by the
contextmodule, implementing tests to verify the correct inclusion and exclusion of files as specified in the package manifest.Attributes: module (str): Module identifier name (str): Full class name
Methods: _build_sdist_and_get_members(): Builds the source distribution for the package and retrieves the list of files included in the resulting archive along with the package version. It temporarily modifies the umask to allow file creations and performs necessary assertions on the build outcome.
test_sdist_includes_required_files(): Tests that the source distribution contains all mandatory files specified for the package by validating their presence in the built tar archive. test_sdist_excludes_unwanted_files(): Tests that certain undesired files and directories are excluded from the source distribution by asserting their absence in the built tar archive.Returns: tuple: Each test method retrieves a tuple containing the list of member file paths and the package version string from the
_build_sdist_and_get_membersmethod.Raises: AssertionError: - In
_build_sdist_and_get_members, if the build command does not execute successfully or if no files are found in the ‘dist’ directory. - Intest_sdist_includes_required_files, if any expected file is missing from the sdist. - Intest_sdist_excludes_unwanted_files, if any unwanted file is found in the sdist.Notes: The tests require a functioning environment that can build the source distribution and may depend on the presence of specific files and directories as dictated by the package’s structure. The tests should be run in an appropriate context where the build tooling and dependencies are available.
Usage: This test suite can be instantiated and executed within a testing framework that supports the discovery and execution of test cases, allowing for thorough validation of the source distribution’s contents.
Initialization
Create an instance of the class that will use the named test method when executed. Raises a ValueError if the instance does not have a method with the specified name.
- __module__[source]
‘tests.test_manifest’
- __name__[source]
‘tests.test_manifest.ManifestInclusionTestSuite’
- _build_sdist_and_get_members()[source][source]
Build the source distribution and return the list of member files and package version.
This helper method runs the command to create a source distribution (sdist) of the package and then extracts the list of files included in the archive.
Returns: tuple: A tuple containing the list of member file paths and the package version string.
Raises: AssertionError: If the build command does not run successfully or if no files are found in the ‘dist’ directory.