]>
Commit | Line | Data |
---|---|---|
632ea2bb | 1 | # NOTE: for version >= 4.0.0 (for python 3.6+) see python3-mock.spec |
8458ad63 | 2 | # |
a9c81cc9 | 3 | # Conditional build: |
0d282d8d | 4 | %bcond_without doc # Sphinx documentation |
a9c81cc9 | 5 | %bcond_without python2 # CPython 2.x module |
632ea2bb | 6 | %bcond_with python3 # CPython 3.x module (built from python3-mock.spec) |
8847a643 | 7 | %bcond_without tests # unit tests |
a9c81cc9 | 8 | |
deb91033 | 9 | %define module mock |
8847a643 JB |
10 | Summary: Rolling backport of unittest.mock for all Pythons |
11 | Summary(pl.UTF-8): Podążający backport modułu unittest.mock dla wszystkich wersji Pythona | |
abd23d0c | 12 | Name: python-%{module} |
8847a643 JB |
13 | # keep 3.x here for python2 support |
14 | Version: 3.0.5 | |
15 | Release: 1 | |
16 | License: BSD | |
abd23d0c | 17 | Group: Development/Languages/Python |
8847a643 JB |
18 | ##Source0Download: https://pypi.org/simple/mock/ |
19 | #Source0: https://files.pythonhosted.org/packages/source/m/mock/%{module}-%{version}.tar.gz | |
20 | # pypi dist misses docs and tests, use github archive | |
21 | #Source0Download: https://github.com/testing-cabal/mock/releases | |
22 | Source0: https://github.com/testing-cabal/mock/archive/%{version}/%{module}-%{version}.tar.gz | |
23 | # Source0-md5: 4026d6ad2a518ae05b993f5ea28ede75 | |
abd23d0c | 24 | URL: http://python-mock.sourceforge.net/ |
a9c81cc9 | 25 | %if %{with python2} |
8847a643 | 26 | BuildRequires: python-modules >= 1:2.7 |
0d282d8d | 27 | BuildRequires: python-setuptools >= 17.1 |
32e3a440 | 28 | %if %{with tests} |
5515b7a0 | 29 | BuildRequires: python-funcsigs >= 1 |
8847a643 | 30 | BuildRequires: python-pytest |
5515b7a0 | 31 | BuildRequires: python-six >= 1.9 |
32e3a440 | 32 | %endif |
a9c81cc9 JK |
33 | %endif |
34 | %if %{with python3} | |
8847a643 | 35 | BuildRequires: python3-modules >= 1:3.4 |
0d282d8d | 36 | BuildRequires: python3-setuptools >= 17.1 |
8847a643 JB |
37 | %if %{with tests} |
38 | BuildRequires: python3-pytest | |
5515b7a0 | 39 | BuildRequires: python3-six >= 1.9 |
32e3a440 | 40 | %endif |
a9c81cc9 | 41 | %endif |
8847a643 JB |
42 | BuildRequires: rpm-pythonprov |
43 | BuildRequires: rpmbuild(macros) >= 1.714 | |
32e3a440 | 44 | %if %{with doc} |
8847a643 | 45 | BuildRequires: python3-six >= 1.9 |
32e3a440 JB |
46 | BuildRequires: sphinx-pdg-3 |
47 | %endif | |
abd23d0c | 48 | BuildArch: noarch |
49 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
50 | ||
51 | %description | |
8bab2895 JB |
52 | mock is a library for testing in Python. It allows you to replace |
53 | parts of your system under test with mock objects and make assertions | |
54 | about how they have been used. | |
abd23d0c | 55 | |
8bab2895 JB |
56 | mock provides a core `MagicMock` class removing the need to create a |
57 | host of stubs throughout your test suite. After performing an action, | |
58 | you can make assertions about which methods/attributes were used and | |
59 | arguments they were called with. You can also specify return values | |
60 | and set needed attributes in the normal way. | |
abd23d0c | 61 | |
8bab2895 | 62 | The mock module also provides utility functions/objects to assist with |
abd23d0c | 63 | testing, particularly monkey patching. |
64 | ||
8bab2895 JB |
65 | %description -l pl.UTF-8 |
66 | mock to biblioteka do testowania w Pythonie. Pozwala na zastępowanie | |
67 | części testowanego systemu obiektami "mock" oraz sprawdzania zapewnień | |
68 | (assert) o tym, jak zostały użyte. | |
69 | ||
70 | mock udostępnia klasę główną "MagicMock", dzięki której nie trzeba | |
71 | tworzyć systemu zaślepek do testów. W czasie wykonywania akcji można | |
72 | kontrolować, czy odpowiednie metody/atrybuty zostały użyte i z jakimi | |
73 | argumentami. Można określić zwracane wartości i w zwykły sposób | |
74 | ustawiać potrzebne atrybuty. | |
75 | ||
8bab2895 JB |
76 | Moduł mock udostępnia także funkcje/obiekty narzędziowe pomagające |
77 | przy testowaniu, w szczególności łataniu. | |
78 | ||
a9c81cc9 | 79 | %package -n python3-%{module} |
8847a643 JB |
80 | Summary: Rolling backport of unittest.mock for all Pythons |
81 | Summary(pl.UTF-8): Podążający backport modułu unittest.mock dla wszystkich wersji Pythona | |
a9c81cc9 JK |
82 | Group: Development/Languages/Python |
83 | ||
84 | %description -n python3-%{module} | |
85 | mock is a library for testing in Python. It allows you to replace | |
86 | parts of your system under test with mock objects and make assertions | |
87 | about how they have been used. | |
88 | ||
89 | mock provides a core `MagicMock` class removing the need to create a | |
90 | host of stubs throughout your test suite. After performing an action, | |
91 | you can make assertions about which methods/attributes were used and | |
92 | arguments they were called with. You can also specify return values | |
93 | and set needed attributes in the normal way. | |
94 | ||
a9c81cc9 JK |
95 | The mock module also provides utility functions/objects to assist with |
96 | testing, particularly monkey patching. | |
97 | ||
98 | %description -n python3-%{module} -l pl.UTF-8 | |
99 | mock to biblioteka do testowania w Pythonie. Pozwala na zastępowanie | |
100 | części testowanego systemu obiektami "mock" oraz sprawdzania zapewnień | |
101 | (assert) o tym, jak zostały użyte. | |
102 | ||
103 | mock udostępnia klasę główną "MagicMock", dzięki której nie trzeba | |
104 | tworzyć systemu zaślepek do testów. W czasie wykonywania akcji można | |
105 | kontrolować, czy odpowiednie metody/atrybuty zostały użyte i z jakimi | |
106 | argumentami. Można określić zwracane wartości i w zwykły sposób | |
107 | ustawiać potrzebne atrybuty. | |
108 | ||
a9c81cc9 JK |
109 | Moduł mock udostępnia także funkcje/obiekty narzędziowe pomagające |
110 | przy testowaniu, w szczególności łataniu. | |
111 | ||
8458ad63 | 112 | %package apidocs |
0d282d8d JB |
113 | Summary: API documentation for mock module |
114 | Summary(pl.UTF-8): Dokumentacja API modułu mock | |
8458ad63 ER |
115 | Group: Documentation |
116 | ||
117 | %description apidocs | |
0d282d8d | 118 | API documentation for mock module. |
8458ad63 ER |
119 | |
120 | %description apidocs -l pl.UTF-8 | |
0d282d8d | 121 | Dokumentacja API modułu mock. |
a9c81cc9 | 122 | |
abd23d0c | 123 | %prep |
124 | %setup -q -n %{module}-%{version} | |
125 | ||
126 | %build | |
a9c81cc9 | 127 | %if %{with python2} |
8847a643 JB |
128 | %py_build |
129 | ||
130 | %if %{with tests} | |
131 | # disable plugins (e.g. pytest-mock) to avoid changing assert output | |
132 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ | |
133 | %{__python} -m pytest mock/tests | |
134 | %endif | |
a9c81cc9 JK |
135 | %endif |
136 | ||
137 | %if %{with python3} | |
8847a643 JB |
138 | %py3_build |
139 | ||
140 | %if %{with tests} | |
141 | # disable plugins (e.g. pytest-mock) to avoid changing assert output | |
142 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ | |
143 | %{__python3} -m pytest mock/tests | |
144 | %endif | |
0d282d8d JB |
145 | %endif |
146 | ||
147 | %if %{with doc} | |
32e3a440 | 148 | PYTHONPATH=. sphinx-build-3 -b html docs html |
0d282d8d | 149 | %{__rm} -r html/{_sources,.doctrees,.buildinfo} |
a9c81cc9 | 150 | %endif |
abd23d0c | 151 | |
152 | %install | |
153 | rm -rf $RPM_BUILD_ROOT | |
a9c81cc9 JK |
154 | |
155 | %if %{with python2} | |
ec928db2 | 156 | %py_install |
abd23d0c | 157 | |
158 | %py_postclean | |
a9c81cc9 JK |
159 | %endif |
160 | ||
161 | %if %{with python3} | |
ec928db2 | 162 | %py3_install |
a9c81cc9 | 163 | %endif |
abd23d0c | 164 | |
165 | %clean | |
166 | rm -rf $RPM_BUILD_ROOT | |
167 | ||
a9c81cc9 | 168 | %if %{with python2} |
abd23d0c | 169 | %files |
170 | %defattr(644,root,root,755) | |
8847a643 | 171 | %doc CHANGELOG.rst LICENSE.txt README.rst |
0d282d8d | 172 | %{py_sitescriptdir}/mock |
8bab2895 | 173 | %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info |
abd23d0c | 174 | %endif |
a9c81cc9 JK |
175 | |
176 | %if %{with python3} | |
177 | %files -n python3-%{module} | |
178 | %defattr(644,root,root,755) | |
8847a643 | 179 | %doc CHANGELOG.rst LICENSE.txt README.rst |
0d282d8d JB |
180 | %{py3_sitescriptdir}/mock |
181 | %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info | |
a9c81cc9 | 182 | %endif |
8458ad63 ER |
183 | |
184 | %if %{with doc} | |
185 | %files apidocs | |
186 | %defattr(644,root,root,755) | |
8847a643 | 187 | %doc html/{_static,*.html,*.js} |
8458ad63 | 188 | %endif |