%global _empty_manifest_terminate_build 0
Name: python-junit-report
Version: 0.2.7
Release: 1
Summary: Export your test suites and cases to JUnit report using decorators
License: MIT
URL: https://github.com/eliorerz/junit-report
Source0: https://mirrors.nju.edu.cn/pypi/web/packages/9d/35/270ff1cb960d079be49c2c82c3d2df2a48b47a917eb3f561688bb7782192/junit-report-0.2.7.tar.gz
BuildArch: noarch
Requires: python3-pytest
Requires: python3-decorator
Requires: python3-junit-xml
%description
# Junit-Report
This Python package adds more control to your tests by decorating your functions and pytest fixtures and exporting them as JUnit xml.
**Table of contents**
- [Junit-Report](#junit-report)
- [Installation](#installation)
- [Usage](#usage)
- [OS parameters used for configuration](#os-parameters-used-for-configuration)
## Installation
```bash
pip install junit-report
```
## Usage
```python
import pytest
from junit_report import JunitTestSuite, JunitTestCase, JunitFixtureTestCase
class TestSomeThing:
@pytest.fixture
@JunitFixtureTestCase()
def my_fixture(self):
# do stuff ..
@JunitTestCase()
def nested_case():
pass
yield nested_case
@JunitTestCase()
def my_first_test_case(self):
pass
@JunitTestCase()
def my_second_test_case(self, name: str):
raise ValueError(f"Invalid name {name}")
@JunitTestSuite()
def test_suite(self, my_fixture):
my_fixture()
self.my_first_test_case()
self.my_second_test_case("John")
```
### Output
```xml
Traceback (most recent call last): ... ValueError: Invalid name John
```
## OS parameters used for configuration
| Variable | Description |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| JUNIT_REPORT_DIR | Reports directory where the reports will be extracted. If it does not exist - create it. |
%package -n python3-junit-report
Summary: Export your test suites and cases to JUnit report using decorators
Provides: python-junit-report
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-pip
%description -n python3-junit-report
# Junit-Report
This Python package adds more control to your tests by decorating your functions and pytest fixtures and exporting them as JUnit xml.
**Table of contents**
- [Junit-Report](#junit-report)
- [Installation](#installation)
- [Usage](#usage)
- [OS parameters used for configuration](#os-parameters-used-for-configuration)
## Installation
```bash
pip install junit-report
```
## Usage
```python
import pytest
from junit_report import JunitTestSuite, JunitTestCase, JunitFixtureTestCase
class TestSomeThing:
@pytest.fixture
@JunitFixtureTestCase()
def my_fixture(self):
# do stuff ..
@JunitTestCase()
def nested_case():
pass
yield nested_case
@JunitTestCase()
def my_first_test_case(self):
pass
@JunitTestCase()
def my_second_test_case(self, name: str):
raise ValueError(f"Invalid name {name}")
@JunitTestSuite()
def test_suite(self, my_fixture):
my_fixture()
self.my_first_test_case()
self.my_second_test_case("John")
```
### Output
```xml
Traceback (most recent call last): ... ValueError: Invalid name John
```
## OS parameters used for configuration
| Variable | Description |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| JUNIT_REPORT_DIR | Reports directory where the reports will be extracted. If it does not exist - create it. |
%package help
Summary: Development documents and examples for junit-report
Provides: python3-junit-report-doc
%description help
# Junit-Report
This Python package adds more control to your tests by decorating your functions and pytest fixtures and exporting them as JUnit xml.
**Table of contents**
- [Junit-Report](#junit-report)
- [Installation](#installation)
- [Usage](#usage)
- [OS parameters used for configuration](#os-parameters-used-for-configuration)
## Installation
```bash
pip install junit-report
```
## Usage
```python
import pytest
from junit_report import JunitTestSuite, JunitTestCase, JunitFixtureTestCase
class TestSomeThing:
@pytest.fixture
@JunitFixtureTestCase()
def my_fixture(self):
# do stuff ..
@JunitTestCase()
def nested_case():
pass
yield nested_case
@JunitTestCase()
def my_first_test_case(self):
pass
@JunitTestCase()
def my_second_test_case(self, name: str):
raise ValueError(f"Invalid name {name}")
@JunitTestSuite()
def test_suite(self, my_fixture):
my_fixture()
self.my_first_test_case()
self.my_second_test_case("John")
```
### Output
```xml
Traceback (most recent call last): ... ValueError: Invalid name John
```
## OS parameters used for configuration
| Variable | Description |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| JUNIT_REPORT_DIR | Reports directory where the reports will be extracted. If it does not exist - create it. |
%prep
%autosetup -n junit-report-0.2.7
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-junit-report -f filelist.lst
%dir %{python3_sitelib}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Wed Apr 12 2023 Python_Bot - 0.2.7-1
- Package Spec generated