commit 427e620b30036cb0a8d7e7ce67ac92cc5106ea7eded8b47474ca9fd3c9dc355b Author: Tomáš Chvátal Date: Mon Aug 17 06:22:38 2020 +0000 Accepting request 827070 from home:jayvdb:pytest Another way to handle flaky tests on OBS OBS-URL: https://build.opensuse.org/request/show/827070 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-percent?expand=0&rev=1 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/pytest-percent-0.1.2.tar.gz b/pytest-percent-0.1.2.tar.gz new file mode 100644 index 0000000..dfae7bc --- /dev/null +++ b/pytest-percent-0.1.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8e488e4bf2c0c2d3badba6b530eb18d3ef264710e44b150030a5fa1cafb74f60 +size 3900 diff --git a/python-pytest-percent.changes b/python-pytest-percent.changes new file mode 100644 index 0000000..6e20a3a --- /dev/null +++ b/python-pytest-percent.changes @@ -0,0 +1,4 @@ +------------------------------------------------------------------- +Sun Aug 16 02:04:45 PM UTC 2020 - John Vandenberg + +- Initial spec for v0.1.2 diff --git a/python-pytest-percent.spec b/python-pytest-percent.spec new file mode 100644 index 0000000..8b4afae --- /dev/null +++ b/python-pytest-percent.spec @@ -0,0 +1,62 @@ +# +# spec file for package python-pytest-percent +# +# Copyright (c) 2020 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%{?!python_module:%define python_module() python-%{**} python3-%{**}} +Name: python-pytest-percent +Version: 0.1.2 +Release: 0 +Summary: Pytest plugin to exit successfully when a required percent of tests pass +License: MIT +Group: Development/Languages/Python +URL: https://github.com/dillonm197/pytest.percent +Source: https://files.pythonhosted.org/packages/source/p/pytest-percent/pytest-percent-%{version}.tar.gz +Source1: https://raw.githubusercontent.com/dillonm197/pytest.percent/master/tests/test_percent.py +BuildRequires: %{python_module setuptools} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: python-pytest >= 5.2.0 +BuildArch: noarch +# SECTION test requirements +BuildRequires: %{python_module pytest >= 5.2.0} +# /SECTION +%python_subpackages + +%description +Change the exit code of pytest test sessions when a required percent of tests pass. + +%prep +%setup -q -n pytest-percent-%{version} +cp %{SOURCE1} . +printf "[pytest]\naddopts = --required-percent=80" > pytest.ini + +%build +%python_build + +%install +%python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%pytest + +%files %{python_files} +%doc README.md +%license LICENSE +%{python_sitelib}/* + +%changelog diff --git a/test_percent.py b/test_percent.py new file mode 100644 index 0000000..1b65b3c --- /dev/null +++ b/test_percent.py @@ -0,0 +1,36 @@ +import pytest + + +def test_1(required_percent): + assert isinstance(required_percent, int) + + +def test_2(): + assert True + + +def test_3(): + assert True + + +def test_4(): + assert True + + +def test_5(): + assert False + + +@pytest.mark.skip +def test_6(): + pass + + +@pytest.mark.xfail +def test_7(): + assert False + + +@pytest.mark.xfail +def test_8(): + assert True