A py.test plugin for grunnur

This package contains a collection of helpers useful for testing grunnur-based libraries and applications. See the Grunnur docs for more details about the main package.

Indices and tables

Public API

Py.Test hooks

These are invoked automatically if you use pytest_grunnur as a py.test plugin.

pytest_grunnur.plugin.pytest_addoption(parser: Parser) None[source]

Adds the following command-line options:

  • --api: select a specific API to test (out of returned by grunnur.all_api_ids()).

  • --platform-include-mask: run tests only on platforms whose names matches the mask.

  • --platform-exclude-mask: exclude platforms whose names matches the mask from the tests.

  • --device-include-mask: run tests only on devices whose names matches the mask.

  • --device-exclude-mask: exclude devices whose names matches the mask from the tests.

  • --include-duplicate-devices: if there are devices with the same name in the platform, run tests on all of them.

  • --include-pure-parallel-devices: include pure parallel devices in the tests (that is, those not supporting synchronization within a block/work group).

pytest_grunnur.plugin.pytest_report_header(config: Config) None[source]

Adds a header to the test report, listing all the GPGPU devices the tests are run on, including their short numerical IDs (appearing in the test parameters).

pytest_grunnur.plugin.pytest_generate_tests(metafunc: Metafunc) None[source]

Seeds the parameters for the fixtures provided by this plugin (see the fixture list for details).

Fixtures

pytest_grunnur.plugin.api(request: FixtureRequest) API[source]

Yields the elements of the return value of get_apis().

pytest_grunnur.plugin.platform(request: FixtureRequest) Platform[source]

Yields the elements of the return value of get_platforms().

pytest_grunnur.plugin.device(request: FixtureRequest) Device[source]

Yields the elements of the return value of get_devices().

pytest_grunnur.plugin.context(device: Device) Context[source]

A single-device context for each device yielded by device().

pytest_grunnur.plugin.some_device(request: FixtureRequest) Device[source]

Yields one element of the return value of get_devices().

pytest_grunnur.plugin.some_context(some_device: Device) Context[source]

A single-device context initialized with the return value of some_device().

pytest_grunnur.plugin.multi_device_set(request: FixtureRequest) list[Device][source]

Yields the elements of the return value of get_multi_device_sets().

pytest_grunnur.plugin.multi_device_context(multi_device_set: list[Device]) Context[source]

A multi-device context for each device set yielded by multi_device_set().

Utility functions

pytest_grunnur.get_apis(config: Config) list[API][source]

Returns the list of APIs filtered by the test configuration.

pytest_grunnur.get_platforms(config: Config) list[Platform][source]

Returns the list of platforms filtered by the test configuration (concatenated for all filtered APIs).

pytest_grunnur.get_devices(config: Config) list[Device][source]

Returns the list of devices filtered by the test configuration (concatenated for all filtered platforms and APIs).

pytest_grunnur.get_multi_device_sets(config: Config) list[list[Device]][source]

Returns a list where each element is a list with two or more devices belonging to the same API and platform, where APIs, platforms, and devices are filtered by the test configuration.

Version history

0.3.0 (25 Jul 2024)

Changed

  • Bumped Python version to 3.10. (PR_1)

0.2.1 (5 Feb 2023)

Fixed

  • Switched back to static versioning.

0.2.0 (4 Feb 2023)

All the fixtures are now explicitly defined.

0.1.0 (29 Jan 2023)

Initial version