]>
Commit | Line | Data |
---|---|---|
8458ad63 | 1 | # |
a9c81cc9 | 2 | # Conditional build: |
0d282d8d | 3 | %bcond_without doc # Sphinx documentation |
8847a643 | 4 | %bcond_without tests # unit tests |
a9c81cc9 | 5 | |
deb91033 | 6 | %define module mock |
8847a643 JB |
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 | |
5bb8711c JB |
9 | Name: python3-%{module} |
10 | Version: 4.0.3 | |
8847a643 JB |
11 | Release: 1 |
12 | License: BSD | |
abd23d0c | 13 | Group: Development/Languages/Python |
8847a643 JB |
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 | |
5bb8711c | 19 | # Source0-md5: d2a1233e27b830742ad8f6999f3573c0 |
abd23d0c | 20 | URL: http://python-mock.sourceforge.net/ |
5bb8711c | 21 | BuildRequires: python3-modules >= 1:3.6 |
0d282d8d | 22 | BuildRequires: python3-setuptools >= 17.1 |
8847a643 JB |
23 | %if %{with tests} |
24 | BuildRequires: python3-pytest | |
5515b7a0 | 25 | BuildRequires: python3-six >= 1.9 |
32e3a440 | 26 | %endif |
8847a643 JB |
27 | BuildRequires: rpm-pythonprov |
28 | BuildRequires: rpmbuild(macros) >= 1.714 | |
32e3a440 | 29 | %if %{with doc} |
8847a643 | 30 | BuildRequires: python3-six >= 1.9 |
32e3a440 JB |
31 | BuildRequires: sphinx-pdg-3 |
32 | %endif | |
5bb8711c | 33 | Requires: python3-modules >= 1:3.6 |
abd23d0c | 34 | BuildArch: noarch |
35 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
36 | ||
37 | %description | |
8bab2895 JB |
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. | |
abd23d0c | 41 | |
8bab2895 JB |
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. | |
abd23d0c | 47 | |
8bab2895 | 48 | The mock module also provides utility functions/objects to assist with |
abd23d0c | 49 | testing, particularly monkey patching. |
50 | ||
8bab2895 JB |
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. | |
55 | ||
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. | |
61 | ||
8bab2895 JB |
62 | Moduł mock udostępnia także funkcje/obiekty narzędziowe pomagające |
63 | przy testowaniu, w szczególności łataniu. | |
64 | ||
8458ad63 | 65 | %package apidocs |
0d282d8d JB |
66 | Summary: API documentation for mock module |
67 | Summary(pl.UTF-8): Dokumentacja API modułu mock | |
8458ad63 ER |
68 | Group: Documentation |
69 | ||
70 | %description apidocs | |
0d282d8d | 71 | API documentation for mock module. |
8458ad63 ER |
72 | |
73 | %description apidocs -l pl.UTF-8 | |
0d282d8d | 74 | Dokumentacja API modułu mock. |
a9c81cc9 | 75 | |
abd23d0c | 76 | %prep |
77 | %setup -q -n %{module}-%{version} | |
78 | ||
79 | %build | |
8847a643 JB |
80 | %py3_build |
81 | ||
82 | %if %{with tests} | |
83 | # disable plugins (e.g. pytest-mock) to avoid changing assert output | |
84 | PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ | |
85 | %{__python3} -m pytest mock/tests | |
86 | %endif | |
0d282d8d JB |
87 | |
88 | %if %{with doc} | |
32e3a440 | 89 | PYTHONPATH=. sphinx-build-3 -b html docs html |
a9c81cc9 | 90 | %endif |
abd23d0c | 91 | |
92 | %install | |
93 | rm -rf $RPM_BUILD_ROOT | |
a9c81cc9 | 94 | |
ec928db2 | 95 | %py3_install |
abd23d0c | 96 | |
97 | %clean | |
98 | rm -rf $RPM_BUILD_ROOT | |
99 | ||
abd23d0c | 100 | %files |
101 | %defattr(644,root,root,755) | |
8847a643 | 102 | %doc CHANGELOG.rst LICENSE.txt README.rst |
0d282d8d JB |
103 | %{py3_sitescriptdir}/mock |
104 | %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info | |
8458ad63 ER |
105 | |
106 | %if %{with doc} | |
107 | %files apidocs | |
108 | %defattr(644,root,root,755) | |
8847a643 | 109 | %doc html/{_static,*.html,*.js} |
8458ad63 | 110 | %endif |