3 %bcond_without doc # Sphinx documentation
4 %bcond_without tests # unit tests
7 Summary: Rolling backport of unittest.mock for all Pythons
8 Summary(pl.UTF-8): Podążający backport modułu unittest.mock dla wszystkich wersji Pythona
9 Name: python3-%{module}
13 Group: Development/Languages/Python
14 ##Source0Download: https://pypi.org/simple/mock/
15 #Source0: https://files.pythonhosted.org/packages/source/m/mock/%{module}-%{version}.tar.gz
16 # pypi dist misses docs and tests, use github archive
17 #Source0Download: https://github.com/testing-cabal/mock/releases
18 Source0: https://github.com/testing-cabal/mock/archive/%{version}/%{module}-%{version}.tar.gz
19 # Source0-md5: d2a1233e27b830742ad8f6999f3573c0
20 URL: http://python-mock.sourceforge.net/
21 BuildRequires: python3-modules >= 1:3.6
22 BuildRequires: python3-setuptools >= 17.1
24 BuildRequires: python3-pytest
25 BuildRequires: python3-six >= 1.9
27 BuildRequires: rpm-pythonprov
28 BuildRequires: rpmbuild(macros) >= 1.714
30 BuildRequires: python3-six >= 1.9
31 BuildRequires: sphinx-pdg-3
33 Requires: python3-modules >= 1:3.6
35 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
38 mock is a library for testing in Python. It allows you to replace
39 parts of your system under test with mock objects and make assertions
40 about how they have been used.
42 mock provides a core `MagicMock` class removing the need to create a
43 host of stubs throughout your test suite. After performing an action,
44 you can make assertions about which methods/attributes were used and
45 arguments they were called with. You can also specify return values
46 and set needed attributes in the normal way.
48 The mock module also provides utility functions/objects to assist with
49 testing, particularly monkey patching.
51 %description -l pl.UTF-8
52 mock to biblioteka do testowania w Pythonie. Pozwala na zastępowanie
53 części testowanego systemu obiektami "mock" oraz sprawdzania zapewnień
54 (assert) o tym, jak zostały użyte.
56 mock udostępnia klasę główną "MagicMock", dzięki której nie trzeba
57 tworzyć systemu zaślepek do testów. W czasie wykonywania akcji można
58 kontrolować, czy odpowiednie metody/atrybuty zostały użyte i z jakimi
59 argumentami. Można określić zwracane wartości i w zwykły sposób
60 ustawiać potrzebne atrybuty.
62 Moduł mock udostępnia także funkcje/obiekty narzędziowe pomagające
63 przy testowaniu, w szczególności łataniu.
66 Summary: API documentation for mock module
67 Summary(pl.UTF-8): Dokumentacja API modułu mock
71 API documentation for mock module.
73 %description apidocs -l pl.UTF-8
74 Dokumentacja API modułu mock.
77 %setup -q -n %{module}-%{version}
83 # disable plugins (e.g. pytest-mock) to avoid changing assert output
84 PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
85 %{__python3} -m pytest mock/tests
89 PYTHONPATH=. sphinx-build-3 -b html docs html
93 rm -rf $RPM_BUILD_ROOT
98 rm -rf $RPM_BUILD_ROOT
101 %defattr(644,root,root,755)
102 %doc CHANGELOG.rst LICENSE.txt README.rst
103 %{py3_sitescriptdir}/mock
104 %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
108 %defattr(644,root,root,755)
109 %doc html/{_static,*.html,*.js}