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
This commit is contained in:
Tomáš Chvátal
2020-08-17 06:22:38 +00:00
committed by Git OBS Bridge
commit 427e620b30
6 changed files with 129 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -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

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8e488e4bf2c0c2d3badba6b530eb18d3ef264710e44b150030a5fa1cafb74f60
size 3900

View File

@@ -0,0 +1,4 @@
-------------------------------------------------------------------
Sun Aug 16 02:04:45 PM UTC 2020 - John Vandenberg <jayvdb@gmail.com>
- Initial spec for v0.1.2

View File

@@ -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

36
test_percent.py Normal file
View File

@@ -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