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