1 # NOTE: for version >= 4.0.0 (for python 3.6+) see python3-mock.spec
4 %bcond_without doc # Sphinx documentation
5 %bcond_without python2 # CPython 2.x module
6 %bcond_with python3 # CPython 3.x module (built from python3-mock.spec)
7 %bcond_without tests # unit tests
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
12 Name: python-%{module}
13 # keep 3.x here for python2 support
17 Group: Development/Languages/Python
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
24 URL: http://python-mock.sourceforge.net/
26 BuildRequires: python-modules >= 1:2.7
27 BuildRequires: python-setuptools >= 17.1
29 BuildRequires: python-funcsigs >= 1
30 BuildRequires: python-pytest
31 BuildRequires: python-six >= 1.9
35 BuildRequires: python3-modules >= 1:3.4
36 BuildRequires: python3-setuptools >= 17.1
38 BuildRequires: python3-pytest
39 BuildRequires: python3-six >= 1.9
42 BuildRequires: rpm-pythonprov
43 BuildRequires: rpmbuild(macros) >= 1.714
45 BuildRequires: python3-six >= 1.9
46 BuildRequires: sphinx-pdg-3
49 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
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.
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.
62 The mock module also provides utility functions/objects to assist with
63 testing, particularly monkey patching.
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.
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.
76 Moduł mock udostępnia także funkcje/obiekty narzędziowe pomagające
77 przy testowaniu, w szczególności łataniu.
79 %package -n python3-%{module}
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
82 Group: Development/Languages/Python
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.
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.
95 The mock module also provides utility functions/objects to assist with
96 testing, particularly monkey patching.
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.
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.
109 Moduł mock udostępnia także funkcje/obiekty narzędziowe pomagające
110 przy testowaniu, w szczególności łataniu.
113 Summary: API documentation for mock module
114 Summary(pl.UTF-8): Dokumentacja API modułu mock
118 API documentation for mock module.
120 %description apidocs -l pl.UTF-8
121 Dokumentacja API modułu mock.
124 %setup -q -n %{module}-%{version}
131 # disable plugins (e.g. pytest-mock) to avoid changing assert output
132 PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
133 %{__python} -m pytest mock/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
148 PYTHONPATH=. sphinx-build-3 -b html docs html
149 %{__rm} -r html/{_sources,.doctrees,.buildinfo}
153 rm -rf $RPM_BUILD_ROOT
166 rm -rf $RPM_BUILD_ROOT
170 %defattr(644,root,root,755)
171 %doc CHANGELOG.rst LICENSE.txt README.rst
172 %{py_sitescriptdir}/mock
173 %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info
177 %files -n python3-%{module}
178 %defattr(644,root,root,755)
179 %doc CHANGELOG.rst LICENSE.txt README.rst
180 %{py3_sitescriptdir}/mock
181 %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
186 %defattr(644,root,root,755)
187 %doc html/{_static,*.html,*.js}