]>
Commit | Line | Data |
---|---|---|
bd571570 JB |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without doc # HTML documentation build | |
08c08cc1 | 4 | %bcond_without python2 # CPython 2.x module |
e4983238 | 5 | %bcond_without python3 # CPython 3.x module |
65ffd36d | 6 | %bcond_without tests # unit tests |
e4983238 | 7 | |
65ffd36d | 8 | %define pylib_version 1.5.0 |
e4983238 | 9 | %define module pytest |
bd571570 JB |
10 | Summary: Simple and popular testing tool for Python |
11 | Summary(pl.UTF-8): Proste i popularne narzędzie testujące dla Pythona | |
e4983238 | 12 | Name: python-%{module} |
aa356db6 JB |
13 | Version: 4.6.9 |
14 | Release: 1 | |
bd571570 JB |
15 | License: MIT |
16 | Group: Development/Languages/Python | |
65ffd36d | 17 | #Source0Download: https://pypi.org/simple/pytest/ |
c4594506 | 18 | Source0: https://files.pythonhosted.org/packages/source/p/pytest/pytest-%{version}.tar.gz |
aa356db6 | 19 | # Source0-md5: d0457c5ddd0438e3b68b7939339d915f |
65ffd36d | 20 | Patch0: %{name}-tests.patch |
bd571570 | 21 | URL: http://pytest.org/ |
08c08cc1 | 22 | %if %{with python2} |
65ffd36d JB |
23 | BuildRequires: python-devel >= 1:2.7 |
24 | BuildRequires: python-modules >= 1:2.7 | |
e4983238 | 25 | BuildRequires: python-py >= %{pylib_version} |
95f20b73 | 26 | BuildRequires: python-setuptools >= 1:40.0 |
65ffd36d JB |
27 | BuildRequires: python-setuptools_scm |
28 | %if %{with tests} | |
12e2dfa7 | 29 | BuildRequires: pydoc >= 1:2.7 |
aa356db6 | 30 | BuildRequires: python-argcomplete |
65ffd36d JB |
31 | BuildRequires: python-atomicwrites >= 1.0 |
32 | BuildRequires: python-attrs >= 17.4.0 | |
aa356db6 | 33 | BuildRequires: python-funcsigs >= 1.0 |
65ffd36d | 34 | BuildRequires: python-hypothesis >= 3.56 |
aa356db6 | 35 | BuildRequires: python-importlib_metadata >= 0.12 |
65ffd36d | 36 | BuildRequires: python-mock |
9c502aa4 | 37 | BuildRequires: python-more_itertools >= 4.0.0 |
65ffd36d | 38 | BuildRequires: python-nose |
9c502aa4 | 39 | BuildRequires: python-pathlib2 >= 2.2.0 |
aa356db6 | 40 | BuildRequires: python-pluggy >= 0.12 |
65ffd36d JB |
41 | BuildRequires: python-requests |
42 | BuildRequires: python-six >= 1.10.0 | |
aa356db6 | 43 | BuildRequires: python-wcwidth |
0537ae48 | 44 | BuildConflicts: python-backports.unittest_mock |
26bd69b5 | 45 | BuildConflicts: python-pyfakefs |
aa356db6 | 46 | BuildConflicts: python-pytest-benchmark < 3.2.1 |
65ffd36d JB |
47 | BuildConflicts: python-pytest-catchlog |
48 | # with xdist requires various modules source | |
49 | BuildConflicts: python-pytest-xdist | |
50 | %endif | |
bd571570 | 51 | %endif |
e4983238 | 52 | %if %{with python3} |
65ffd36d JB |
53 | BuildRequires: python3-devel >= 1:3.4 |
54 | BuildRequires: python3-modules >= 1:3.4 | |
e4983238 | 55 | BuildRequires: python3-py >= %{pylib_version} |
95f20b73 | 56 | BuildRequires: python3-setuptools >= 1:40.0 |
65ffd36d JB |
57 | BuildRequires: python3-setuptools_scm |
58 | %if %{with tests} | |
12e2dfa7 | 59 | BuildRequires: pydoc3 >= 1:3.4 |
aa356db6 | 60 | BuildRequires: python3-argcomplete |
65ffd36d JB |
61 | BuildRequires: python3-atomicwrites >= 1.0 |
62 | BuildRequires: python3-attrs >= 17.4.0 | |
63 | BuildRequires: python3-hypothesis >= 3.56 | |
aa356db6 JB |
64 | %if "%{py3_ver}" < "3.8" |
65 | BuildRequires: python3-importlib_metadata >= 0.12 | |
66 | %endif | |
9c502aa4 | 67 | BuildRequires: python3-more_itertools >= 4.0.0 |
65ffd36d | 68 | BuildRequires: python3-nose |
9c502aa4 JB |
69 | %if "%{py3_ver}" < "3.6" |
70 | BuildRequires: python3-pathlib2 >= 2.2.0 | |
71 | %endif | |
aa356db6 | 72 | BuildRequires: python3-pluggy >= 0.12 |
65ffd36d JB |
73 | BuildRequires: python3-requests |
74 | BuildRequires: python3-six >= 1.10.0 | |
aa356db6 | 75 | BuildRequires: python3-wcwidth |
26bd69b5 | 76 | BuildConflicts: python3-pyfakefs |
aa356db6 | 77 | BuildConflicts: python3-pytest-benchmark < 3.2.1 |
65ffd36d | 78 | BuildConflicts: python3-pytest-catchlog |
0537ae48 | 79 | BuildConflicts: python3-pytest-xdist |
65ffd36d | 80 | %endif |
e4983238 | 81 | %endif |
08c08cc1 JB |
82 | BuildRequires: rpm-pythonprov |
83 | BuildRequires: rpmbuild(macros) >= 1.714 | |
84 | BuildRequires: sed >= 4.0 | |
85 | %if %{with doc} | |
65ffd36d JB |
86 | BuildRequires: python3-sphinxcontrib-trio |
87 | BuildRequires: sphinx-pdg-3 >= 1.0 | |
08c08cc1 | 88 | %endif |
95f20b73 | 89 | Requires: python-modules >= 1:2.7 |
84b7690d | 90 | Requires: python-setuptools |
fd6ab041 | 91 | Obsoletes: python-pytest-cache |
65ffd36d | 92 | Obsoletes: python-pytest-catchlog |
bd571570 JB |
93 | BuildArch: noarch |
94 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
95 | ||
96 | %description | |
97 | py.test is a simple and popular testing tool for Python. | |
98 | ||
99 | %description -l pl.UTF-8 | |
100 | py.test to proste i popularne narzędzie testujące dla Pythona. | |
101 | ||
e4983238 ER |
102 | %package -n python3-pytest |
103 | Summary: Simple powerful testing with Python | |
6b847094 | 104 | Summary(pl.UTF-8): Proste, ale funkcjonalne narzędzie testujące dla Pythona |
e4983238 | 105 | Group: Development/Languages |
95f20b73 | 106 | Requires: python3-devel-tools >= 1:3.4 |
84b7690d | 107 | Requires: python3-setuptools |
fd6ab041 | 108 | Obsoletes: python3-pytest-cache |
65ffd36d | 109 | Obsoletes: python3-pytest-catchlog |
e4983238 ER |
110 | |
111 | %description -n python3-pytest | |
112 | py.test provides simple, yet powerful testing for Python. | |
113 | ||
6b847094 JB |
114 | %description -n python3-pytest -l pl.UTF-8 |
115 | py.test to proste, ale bardzo funkcjonalne narzędzie testujące dla | |
116 | Pythona. | |
117 | ||
c4594506 JB |
118 | %package apidocs |
119 | Summary: Documentation for py.test Pythona package | |
120 | Summary(pl.UTF-8): Dokumentacja pakietu Pythona py.test | |
121 | Group: Documentation | |
122 | ||
123 | %description apidocs | |
124 | Documentation for py.test Pythona package. | |
125 | ||
126 | %description apidocs -l pl.UTF-8 | |
127 | Dokumentacja pakietu Pythona py.test. | |
128 | ||
bd571570 | 129 | %prep |
e4983238 | 130 | %setup -q -n %{module}-%{version} |
65ffd36d | 131 | %patch0 -p1 |
e4983238 | 132 | |
bd571570 | 133 | %build |
08c08cc1 | 134 | %if %{with python2} |
ac22139b | 135 | %py_build |
65ffd36d JB |
136 | |
137 | %if %{with tests} | |
aa356db6 JB |
138 | # FIXME: 25 failed; |
139 | # - some because of warnings | |
140 | # - ValueError: no option named u'--tb' (why? it's provided by _pytest/terminal.py) | |
9c502aa4 | 141 | # test_pdb_custom_cls_with_settrace fails without preinstalled pytest |
65ffd36d | 142 | PYTHONPATH=$(pwd)/src \ |
26bd69b5 | 143 | %{__python} -m pytest -k 'not test_pdb and not TestTerminal and not test_request_garbage' testing |
65ffd36d | 144 | %endif |
08c08cc1 | 145 | %endif |
bd571570 | 146 | |
e4983238 | 147 | %if %{with python3} |
ac22139b | 148 | %py3_build |
65ffd36d JB |
149 | |
150 | %if %{with tests} | |
9c502aa4 JB |
151 | # test_pdb_custom_cls_with_settrace fails without preinstalled pytest |
152 | # test_pdb_* which spawn pdb hang under some unclear conditions | |
26bd69b5 | 153 | # test_request_garbage fails sometimes |
65ffd36d | 154 | PYTHONPATH=$(pwd)/src \ |
aa356db6 | 155 | %{__python3} -m pytest -k 'not test_pdb and not TestTerminal and not test_request_garbage' testing |
65ffd36d | 156 | %endif |
e4983238 ER |
157 | %endif |
158 | ||
bd571570 | 159 | %if %{with doc} |
e4983238 | 160 | for l in doc/*; do |
65ffd36d JB |
161 | PYTHONPATH=$(pwd)/src \ |
162 | %{__make} -C $l html \ | |
163 | SPHINXBUILD=sphinx-build-3 | |
e4983238 | 164 | done |
bd571570 JB |
165 | %endif |
166 | ||
167 | %install | |
168 | rm -rf $RPM_BUILD_ROOT | |
ac22139b JK |
169 | |
170 | %if %{with python3} | |
171 | %py3_install | |
84b7690d JB |
172 | |
173 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/py.test{,-3} | |
174 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/pytest{,-3} | |
ac22139b JK |
175 | %endif |
176 | ||
08c08cc1 | 177 | %if %{with python2} |
ac22139b | 178 | %py_install |
bd571570 | 179 | |
84b7690d JB |
180 | ln $RPM_BUILD_ROOT%{_bindir}/py.test{,-2} |
181 | ln $RPM_BUILD_ROOT%{_bindir}/pytest{,-2} | |
182 | ||
08c08cc1 JB |
183 | # pytest.py source seems required for "monkeypatching" tests |
184 | %py_postclean -x pytest.py | |
185 | %endif | |
bd571570 JB |
186 | |
187 | %clean | |
188 | rm -rf $RPM_BUILD_ROOT | |
189 | ||
08c08cc1 | 190 | %if %{with python2} |
bd571570 JB |
191 | %files |
192 | %defattr(644,root,root,755) | |
c4594506 | 193 | %doc AUTHORS CHANGELOG.rst LICENSE README.rst |
bd571570 | 194 | %attr(755,root,root) %{_bindir}/py.test |
84b7690d JB |
195 | %attr(755,root,root) %{_bindir}/py.test-2 |
196 | %attr(755,root,root) %{_bindir}/pytest | |
197 | %attr(755,root,root) %{_bindir}/pytest-2 | |
08c08cc1 | 198 | %{py_sitescriptdir}/pytest.py* |
bd571570 JB |
199 | %{py_sitescriptdir}/_pytest |
200 | %{py_sitescriptdir}/pytest-%{version}-py*.egg-info | |
08c08cc1 | 201 | %endif |
e4983238 ER |
202 | |
203 | %if %{with python3} | |
204 | %files -n python3-pytest | |
205 | %defattr(644,root,root,755) | |
c4594506 | 206 | %doc AUTHORS CHANGELOG.rst LICENSE README.rst |
84b7690d JB |
207 | %attr(755,root,root) %{_bindir}/py.test-3 |
208 | %attr(755,root,root) %{_bindir}/pytest-3 | |
6b847094 | 209 | %{py3_sitescriptdir}/pytest.py |
e4983238 | 210 | %{py3_sitescriptdir}/_pytest |
6b847094 | 211 | %{py3_sitescriptdir}/__pycache__/pytest.*.py[co] |
e4983238 ER |
212 | %{py3_sitescriptdir}/pytest-%{version}-py*.egg-info |
213 | %endif | |
c4594506 JB |
214 | |
215 | %if %{with doc} | |
216 | %files apidocs | |
217 | %defattr(644,root,root,755) | |
65ffd36d | 218 | %doc doc/en/_build/html/{_images,_modules,_static,announce,example,proposals,*.html,*.js} |
c4594506 | 219 | %endif |