]> git.pld-linux.org Git - SPECS.git/blob - python-pytest-mock.spec
SPECS updated Sun 1 Aug 11:02:02 CEST 2021
[SPECS.git] / python-pytest-mock.spec
1 # NOTE: for versions >= 3 see python3-pytest-mock.spec
2 #
3 # Conditional build:
4 %bcond_without  tests   # py.test tests
5 %bcond_without  python2 # CPython 2.x module
6 %bcond_with     python3 # CPython 3.x module (built from python3-pytest-mock.spec)
7
8 Summary:        Thin-wrapper around the mock package for easier use with py.test
9 Summary(pl.UTF-8):      Cienka warstwa obudowująca pakiet mock, ułatwiająca używanie wraz z py.test
10 Name:           python-pytest-mock
11 # keep 2.x here for python2 support
12 Version:        2.0.0
13 Release:        2
14 License:        MIT
15 Group:          Libraries/Python
16 #Source0Download: https://pypi.org/simple/pytest-mock/
17 Source0:        https://files.pythonhosted.org/packages/source/p/pytest-mock/pytest-mock-%{version}.tar.gz
18 # Source0-md5:  b6bcfb98b922b666d9a0db21a38f9d8a
19 URL:            https://pypi.org/project/pytest-mock/
20 %if %{with python2}
21 BuildRequires:  python-modules >= 1:2.7
22 BuildRequires:  python-setuptools
23 BuildRequires:  python-setuptools_scm
24 %if %{with tests}
25 BuildRequires:  python-mock
26 BuildRequires:  python-pytest >= 2.7
27 %endif
28 %endif
29 %if %{with python3}
30 BuildRequires:  python3-modules >= 1:3.4
31 BuildRequires:  python3-setuptools
32 BuildRequires:  python3-setuptools_scm
33 %if %{with tests}
34 BuildRequires:  python3-pytest >= 2.7
35 # there is py3 test which relies on "mock" standalone module not being installed
36 BuildConflicts: python3-mock
37 %endif
38 %endif
39 BuildRequires:  rpm-pythonprov
40 BuildRequires:  rpmbuild(macros) >= 1.714
41 BuildRequires:  sed >= 4.0
42 Requires:       python-modules >= 1:2.7
43 BuildArch:      noarch
44 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
45
46 %description
47 This plugin installs a mocker fixture which is a thin-wrapper around
48 the patching API provided by the mock package, but with the benefit of
49 not having to worry about undoing patches at the end of a test.
50
51 %description -l pl.UTF-8
52 Ta wtyczka instaluje osprzęt (fixture) do tworzenia atrap, będący
53 cienką warstwą ponad API dostarczane przez pakiet mock, ale
54 pozwalający nie martwić się o wycofywanie łat na końcu testu.
55
56 %package -n python3-pytest-mock
57 Summary:        Thin-wrapper around the mock package for easier use with py.test
58 Summary(pl.UTF-8):      Cienka warstwa obudowująca pakiet mock, ułatwiająca używanie wraz z py.test
59 Group:          Libraries/Python
60 Requires:       python3-modules >= 1:3.4
61
62 %description -n python3-pytest-mock
63 This plugin installs a mocker fixture which is a thin-wrapper around
64 the patching API provided by the mock package, but with the benefit of
65 not having to worry about undoing patches at the end of a test.
66
67 %description -n python3-pytest-mock -l pl.UTF-8
68 Ta wtyczka instaluje osprzęt (fixture) do tworzenia atrap, będący
69 cienką warstwą ponad API dostarczane przez pakiet mock, ale
70 pozwalający nie martwić się o wycofywanie łat na końcu testu.
71
72 %prep
73 %setup -q -n pytest-mock-%{version}
74
75 %build
76 %if %{with python2}
77 %py_build
78
79 %if %{with tests}
80 PYTHONPATH=$(pwd)/src \
81 PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
82 PYTEST_PLUGINS="pytest_mock" \
83 %{__python} -m pytest tests
84 %endif
85 %endif
86
87 %if %{with python3}
88 %py3_build
89
90 %if %{with tests}
91 PYTHONPATH=$(pwd)/src \
92 PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
93 PYTEST_PLUGINS="pytest_mock" \
94 %{__python3} -m pytest tests
95 %endif
96 %endif
97
98 %install
99 rm -rf $RPM_BUILD_ROOT
100
101 %if %{with python2}
102 %py_install
103
104 %py_postclean
105 %endif
106
107 %if %{with python3}
108 %py3_install
109 %endif
110
111 %clean
112 rm -rf $RPM_BUILD_ROOT
113
114 %if %{with python2}
115 %files
116 %defattr(644,root,root,755)
117 %doc CHANGELOG.rst LICENSE README.rst
118 %{py_sitescriptdir}/pytest_mock
119 %{py_sitescriptdir}/pytest_mock-%{version}-py*.egg-info
120 %endif
121
122 %if %{with python3}
123 %files -n python3-pytest-mock
124 %defattr(644,root,root,755)
125 %doc CHANGELOG.rst LICENSE README.rst
126 %{py3_sitescriptdir}/pytest_mock
127 %{py3_sitescriptdir}/pytest_mock-%{version}-py*.egg-info
128 %endif
This page took 0.103585 seconds and 3 git commands to generate.