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