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