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
26 BuildRequires: rpm-pythonprov
27 BuildRequires: rpmbuild(macros) >= 1.714
29 BuildRequires: sphinx-pdg-3
31 Requires: python3-modules >= 1:3.6
33 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
36 mock is a library for testing in Python. It allows you to replace
37 parts of your system under test with mock objects and make assertions
38 about how they have been used.
40 mock provides a core `MagicMock` class removing the need to create a
41 host of stubs throughout your test suite. After performing an action,
42 you can make assertions about which methods/attributes were used and
43 arguments they were called with. You can also specify return values
44 and set needed attributes in the normal way.
46 The mock module also provides utility functions/objects to assist with
47 testing, particularly monkey patching.
49 %description -l pl.UTF-8
50 mock to biblioteka do testowania w Pythonie. Pozwala na zastępowanie
51 części testowanego systemu obiektami "mock" oraz sprawdzania zapewnień
52 (assert) o tym, jak zostały użyte.
54 mock udostępnia klasę główną "MagicMock", dzięki której nie trzeba
55 tworzyć systemu zaślepek do testów. W czasie wykonywania akcji można
56 kontrolować, czy odpowiednie metody/atrybuty zostały użyte i z jakimi
57 argumentami. Można określić zwracane wartości i w zwykły sposób
58 ustawiać potrzebne atrybuty.
60 Moduł mock udostępnia także funkcje/obiekty narzędziowe pomagające
61 przy testowaniu, w szczególności łataniu.
64 Summary: API documentation for mock module
65 Summary(pl.UTF-8): Dokumentacja API modułu mock
69 API documentation for mock module.
71 %description apidocs -l pl.UTF-8
72 Dokumentacja API modułu mock.
75 %setup -q -n %{module}-%{version}
81 # disable plugins (e.g. pytest-mock) to avoid changing assert output
82 PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
83 %{__python3} -m pytest mock/tests
87 PYTHONPATH=. sphinx-build-3 -b html docs html
91 rm -rf $RPM_BUILD_ROOT
96 rm -rf $RPM_BUILD_ROOT
99 %defattr(644,root,root,755)
100 %doc CHANGELOG.rst LICENSE.txt README.rst
101 %{py3_sitescriptdir}/mock
102 %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
106 %defattr(644,root,root,755)
107 %doc html/{_static,*.html,*.js}