]>
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 |
ac0b7cbd | 16 | Release: 3 |
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 |
84b7690d | 102 | Requires: python-setuptools |
9179728f JB |
103 | Obsoletes: python-pytest-cache < 1.1 |
104 | Obsoletes: python-pytest-catchlog < 1.2.3 | |
bd571570 JB |
105 | BuildArch: noarch |
106 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
107 | ||
108 | %description | |
109 | py.test is a simple and popular testing tool for Python. | |
110 | ||
111 | %description -l pl.UTF-8 | |
112 | py.test to proste i popularne narzędzie testujące dla Pythona. | |
113 | ||
e4983238 ER |
114 | %package -n python3-pytest |
115 | Summary: Simple powerful testing with Python | |
6b847094 | 116 | Summary(pl.UTF-8): Proste, ale funkcjonalne narzędzie testujące dla Pythona |
e4983238 | 117 | Group: Development/Languages |
95f20b73 | 118 | Requires: python3-devel-tools >= 1:3.4 |
84b7690d | 119 | Requires: python3-setuptools |
9179728f JB |
120 | Obsoletes: python3-pytest-cache < 1.1 |
121 | Obsoletes: python3-pytest-catchlog < 1.2.3 | |
e4983238 ER |
122 | |
123 | %description -n python3-pytest | |
124 | py.test provides simple, yet powerful testing for Python. | |
125 | ||
6b847094 JB |
126 | %description -n python3-pytest -l pl.UTF-8 |
127 | py.test to proste, ale bardzo funkcjonalne narzędzie testujące dla | |
128 | Pythona. | |
129 | ||
c4594506 JB |
130 | %package apidocs |
131 | Summary: Documentation for py.test Pythona package | |
132 | Summary(pl.UTF-8): Dokumentacja pakietu Pythona py.test | |
133 | Group: Documentation | |
134 | ||
135 | %description apidocs | |
136 | Documentation for py.test Pythona package. | |
137 | ||
138 | %description apidocs -l pl.UTF-8 | |
139 | Dokumentacja pakietu Pythona py.test. | |
140 | ||
bd571570 | 141 | %prep |
e4983238 | 142 | %setup -q -n %{module}-%{version} |
65ffd36d | 143 | %patch0 -p1 |
e4983238 | 144 | |
bd571570 | 145 | %build |
7359165f | 146 | export PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 |
08c08cc1 | 147 | %if %{with python2} |
ac22139b | 148 | %py_build |
65ffd36d JB |
149 | |
150 | %if %{with tests} | |
9c502aa4 | 151 | # test_pdb_custom_cls_with_settrace fails without preinstalled pytest |
e920318a JB |
152 | # test_cache_writefail_permissions, test_cache_failure_warns makes tests unreliable due to post-test cleanup failures |
153 | # test_pytester.py, test_terminal.py, test_unittest.py need ptys to spawn processes with terminal | |
65ffd36d | 154 | PYTHONPATH=$(pwd)/src \ |
e920318a | 155 | %{__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 | 156 | %endif |
08c08cc1 | 157 | %endif |
bd571570 | 158 | |
e4983238 | 159 | %if %{with python3} |
ac22139b | 160 | %py3_build |
65ffd36d JB |
161 | |
162 | %if %{with tests} | |
9c502aa4 JB |
163 | # test_pdb_custom_cls_with_settrace fails without preinstalled pytest |
164 | # test_pdb_* which spawn pdb hang under some unclear conditions | |
e920318a JB |
165 | # test_cache_writefail_permissions, test_cache_failure_warns makes tests unreliable due to post-test cleanup failures |
166 | # test_pytester.py, test_terminal.py, test_unittest.py need ptys to spawn processes with terminal | |
65ffd36d | 167 | PYTHONPATH=$(pwd)/src \ |
e920318a | 168 | %{__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 | 169 | %endif |
e4983238 ER |
170 | %endif |
171 | ||
bd571570 | 172 | %if %{with doc} |
e4983238 | 173 | for l in doc/*; do |
65ffd36d JB |
174 | PYTHONPATH=$(pwd)/src \ |
175 | %{__make} -C $l html \ | |
176 | SPHINXBUILD=sphinx-build-3 | |
e4983238 | 177 | done |
bd571570 JB |
178 | %endif |
179 | ||
180 | %install | |
181 | rm -rf $RPM_BUILD_ROOT | |
ac22139b | 182 | |
08c08cc1 | 183 | %if %{with python2} |
ac22139b | 184 | %py_install |
bd571570 | 185 | |
23d34d20 JB |
186 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/py.test{,-2} |
187 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/pytest{,-2} | |
84b7690d | 188 | |
08c08cc1 JB |
189 | # pytest.py source seems required for "monkeypatching" tests |
190 | %py_postclean -x pytest.py | |
191 | %endif | |
bd571570 | 192 | |
23d34d20 JB |
193 | %if %{with python3} |
194 | %py3_install | |
195 | ||
196 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/py.test{,-3} | |
197 | %{__mv} $RPM_BUILD_ROOT%{_bindir}/pytest{,-3} | |
198 | %endif | |
199 | ||
bd571570 JB |
200 | %clean |
201 | rm -rf $RPM_BUILD_ROOT | |
202 | ||
08c08cc1 | 203 | %if %{with python2} |
bd571570 JB |
204 | %files |
205 | %defattr(644,root,root,755) | |
c4594506 | 206 | %doc AUTHORS CHANGELOG.rst LICENSE README.rst |
84b7690d | 207 | %attr(755,root,root) %{_bindir}/py.test-2 |
84b7690d | 208 | %attr(755,root,root) %{_bindir}/pytest-2 |
08c08cc1 | 209 | %{py_sitescriptdir}/pytest.py* |
bd571570 JB |
210 | %{py_sitescriptdir}/_pytest |
211 | %{py_sitescriptdir}/pytest-%{version}-py*.egg-info | |
08c08cc1 | 212 | %endif |
e4983238 ER |
213 | |
214 | %if %{with python3} | |
215 | %files -n python3-pytest | |
216 | %defattr(644,root,root,755) | |
c4594506 | 217 | %doc AUTHORS CHANGELOG.rst LICENSE README.rst |
84b7690d JB |
218 | %attr(755,root,root) %{_bindir}/py.test-3 |
219 | %attr(755,root,root) %{_bindir}/pytest-3 | |
6b847094 | 220 | %{py3_sitescriptdir}/pytest.py |
e4983238 | 221 | %{py3_sitescriptdir}/_pytest |
6b847094 | 222 | %{py3_sitescriptdir}/__pycache__/pytest.*.py[co] |
e4983238 ER |
223 | %{py3_sitescriptdir}/pytest-%{version}-py*.egg-info |
224 | %endif | |
c4594506 JB |
225 | |
226 | %if %{with doc} | |
227 | %files apidocs | |
228 | %defattr(644,root,root,755) | |
65ffd36d | 229 | %doc doc/en/_build/html/{_images,_modules,_static,announce,example,proposals,*.html,*.js} |
c4594506 | 230 | %endif |