]> git.pld-linux.org Git - packages/python3-mock.git/blob - python3-mock.spec
- updated to 3.0.5 (latest version supporting python 2.7)
[packages/python3-mock.git] / python3-mock.spec
1 #
2 # Conditional build:
3 %bcond_without  doc     # Sphinx documentation
4 %bcond_without  tests   # unit tests
5
6 %define         module  mock
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}
10 Version:        4.0.3
11 Release:        1
12 License:        BSD
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
23 %if %{with tests}
24 BuildRequires:  python3-pytest
25 BuildRequires:  python3-six >= 1.9
26 %endif
27 BuildRequires:  rpm-pythonprov
28 BuildRequires:  rpmbuild(macros) >= 1.714
29 %if %{with doc}
30 BuildRequires:  python3-six >= 1.9
31 BuildRequires:  sphinx-pdg-3
32 %endif
33 Requires:       python3-modules >= 1:3.6
34 BuildArch:      noarch
35 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
36
37 %description
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.
41
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.
47
48 The mock module also provides utility functions/objects to assist with
49 testing, particularly monkey patching.
50
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
62 Moduł mock udostępnia także funkcje/obiekty narzędziowe pomagające
63 przy testowaniu, w szczególności łataniu.
64
65 %package apidocs
66 Summary:        API documentation for mock module
67 Summary(pl.UTF-8):      Dokumentacja API modułu mock
68 Group:          Documentation
69
70 %description apidocs
71 API documentation for mock module.
72
73 %description apidocs -l pl.UTF-8
74 Dokumentacja API modułu mock.
75
76 %prep
77 %setup -q -n %{module}-%{version}
78
79 %build
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
87
88 %if %{with doc}
89 PYTHONPATH=. sphinx-build-3 -b html docs html
90 %endif
91
92 %install
93 rm -rf $RPM_BUILD_ROOT
94
95 %py3_install
96
97 %clean
98 rm -rf $RPM_BUILD_ROOT
99
100 %files
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
105
106 %if %{with doc}
107 %files apidocs
108 %defattr(644,root,root,755)
109 %doc html/{_static,*.html,*.js}
110 %endif
This page took 0.090261 seconds and 3 git commands to generate.