Metadata-Version: 2.1
Name: allure-subtests
Version: 0.1.3
Summary: allure-subtests is a Python library that can generate subtest results in an Allure report.
Author: zhoukai83
Requires-Python: >=3.8
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Dist: allure-pytest (>=2.1)
Requires-Dist: loguru (>=0.4)
Requires-Dist: pytest (>=7.0)
Requires-Dist: pytest-check (>=2.3.1,<3.0.0)
Requires-Dist: requests (>=2.32.3,<3.0.0)
Description-Content-Type: text/markdown

# allure-subtests

## Introduction
Allure-subtests is a Python library that can generate subtest results in an Allure report.

## Usage
I run below code under:
- Python3.12

```python
from loguru import logger


class TestSubTest:
    def test_demo(self, allure_subtests):
        for i in range(3):
            with allure_subtests.test(subtest_name=f"custom message:{i=}", i=i):
                logger.info(f'test {i=}')
                assert i % 2 == 0

                if i == 2:
                    raise ValueError(f'custom error {i=}')

```


## Why do I need this?
If we want to parameterize test cases, we have 2 ways: pytest parametrize or pytest-subtests
### pytest parametrize:
demo like below:
```python
import pytest
from loguru import logger

@pytest.mark.parametrize('i', range(3))
def test_parametrize(i):
    logger.info(f'test {i=}')
```

There are some disadvantages of this way:
- the 2nd parameter in pytest.mark.parametrize is a function, it will execute when module import, even test is not executed, if it is complex and time waste, will need a long time
- pytest.mark.parametrize can only pass simple data type to the test function, it is a little hard to use complex data type

### pytest-subtests
use pytest-subtests in https://pypi.org/project/pytest-subtests/

I find there is disadvantage in this way:
- It is not compatible with Allure, it will generate an Allure report with no subtest results


I want some ways both have the advantages of pytest-subtests and allure.

So this library is born based on pytest-subtests and allure.

