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