diff options
author | CoprDistGit <infra@openeuler.org> | 2023-04-12 07:05:03 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-04-12 07:05:03 +0000 |
commit | 96c4cad98153bb96f0b40f405839a7b20c07bc4b (patch) | |
tree | b0df8196918dcba97bd6c826e58c4fa71f0a0b64 | |
parent | 250006c704c18420f8aad5431be363999b9c36e9 (diff) |
automatic import of python-junit-reportopeneuler20.03
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-junit-report.spec | 312 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 314 insertions, 0 deletions
@@ -0,0 +1 @@ +/junit-report-0.2.7.tar.gz diff --git a/python-junit-report.spec b/python-junit-report.spec new file mode 100644 index 0000000..fcaa805 --- /dev/null +++ b/python-junit-report.spec @@ -0,0 +1,312 @@ +%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 +<?xml version="1.0" ?> +<testsuites disabled="0" errors="0" failures="1" tests="4" time="0.000301361083984375"> + <testsuite disabled="0" errors="0" failures="1" name="TestSomeThing_test_suite" skipped="0" tests="4" time="0.000301361083984375"> + <testcase name="my_fixture" time="0.000163" classname="TestSomeThing" class="fixture"/> + <testcase name="nested_case" time="0.000034" classname="module_name.test" class="function"/> + <testcase name="my_first_test_case" time="0.000017" classname="TestSomeThing" class="function"/> + <testcase name="my_second_test_case" time="0.000087" classname="TestSomeThing" class="function"> + <failure type="ValueError" message="Invalid name John">Traceback (most recent call last): ... ValueError: Invalid name John</failure> + </testcase> + </testsuite> +</testsuites> +``` + +## 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 +<?xml version="1.0" ?> +<testsuites disabled="0" errors="0" failures="1" tests="4" time="0.000301361083984375"> + <testsuite disabled="0" errors="0" failures="1" name="TestSomeThing_test_suite" skipped="0" tests="4" time="0.000301361083984375"> + <testcase name="my_fixture" time="0.000163" classname="TestSomeThing" class="fixture"/> + <testcase name="nested_case" time="0.000034" classname="module_name.test" class="function"/> + <testcase name="my_first_test_case" time="0.000017" classname="TestSomeThing" class="function"/> + <testcase name="my_second_test_case" time="0.000087" classname="TestSomeThing" class="function"> + <failure type="ValueError" message="Invalid name John">Traceback (most recent call last): ... ValueError: Invalid name John</failure> + </testcase> + </testsuite> +</testsuites> +``` + +## 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 +<?xml version="1.0" ?> +<testsuites disabled="0" errors="0" failures="1" tests="4" time="0.000301361083984375"> + <testsuite disabled="0" errors="0" failures="1" name="TestSomeThing_test_suite" skipped="0" tests="4" time="0.000301361083984375"> + <testcase name="my_fixture" time="0.000163" classname="TestSomeThing" class="fixture"/> + <testcase name="nested_case" time="0.000034" classname="module_name.test" class="function"/> + <testcase name="my_first_test_case" time="0.000017" classname="TestSomeThing" class="function"/> + <testcase name="my_second_test_case" time="0.000087" classname="TestSomeThing" class="function"> + <failure type="ValueError" message="Invalid name John">Traceback (most recent call last): ... ValueError: Invalid name John</failure> + </testcase> + </testsuite> +</testsuites> +``` + +## 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 <Python_Bot@openeuler.org> - 0.2.7-1 +- Package Spec generated @@ -0,0 +1 @@ +df60f264f9ebef80b74a5a2ca8e3c713 junit-report-0.2.7.tar.gz |