# [pytest-plugin: crosszip\_parametrize](<#pytest-plugin-crosszip_parametrize>)

Pytest plugin for cross-product parametrization.

## [`pytest_configure(config)`](<#crosszip.plugin.pytest_configure>)

Register the `crosszip_parametrize` marker with pytest.

This pytest hook registers the `crosszip_parametrize` marker with pytest. The marker is used to parametrize tests with the Cartesian product of parameter values.

## [`pytest_generate_tests(metafunc)`](<#crosszip.plugin.pytest_generate_tests>)

Generate parametrized tests using the cross-product of parameter values.

This pytest hook parametrizes tests based on the `crosszip_parametrize` marker. It extracts parameter names and their corresponding lists of values, computes their Cartesian product, and parametrizes the test function accordingly.

Parameters:

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `metafunc` | `Metafunc` | The test function's metadata provided by pytest. | *required* |

> [!NOTE]
>
> **Example**
>
> ```python
> import math
> import crosszip
> import pytest
>
>
> @pytest.mark.crosszip_parametrize(
>     "base",
>     [2, 10],
>     "exponent",
>     [-1, 0, 1],
> )
> def test_power_function(base, exponent):
>     result = math.pow(base, exponent)
>     assert result == base**exponent
>
>
> @pytest.mark.crosszip_parametrize()
> def test_example():
>     pass
>
>
> # Error: Parameter names and values must be provided.
>
>
> @pytest.mark.crosszip_parametrize(
>     "x",
>     1,
>     "y",
>     [3, 4],
> )
> def test_example(x, y):
>     pass
>
>
> # Error: All parameter values must be non-empty sequences.
> ```

## [`validate_parameters(param_names, param_values)`](<#crosszip.plugin.validate_parameters>)

Validate marker parameter names and their corresponding values.

Parameters:

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `param_names` | `Sequence[Any]` | Names parsed from alternating marker arguments. | *required* |
| `param_values` | `Sequence[Any]` | Value collections paired with the parameter names. | *required* |

Raises:

| Type | Description |
| --- | --- |
| `CrosszipValueError` | If names or values are missing or their counts differ. |
| `CrosszipTypeError` | If names are not strings or a value collection is empty. |
