summaryrefslogtreecommitdiff
path: root/python-pytest-odoo.spec
blob: 490fdec1a354730c7903ba69752c079b64d988e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
%global _empty_manifest_terminate_build 0
Name:		python-pytest-odoo
Version:	0.9.1
Release:	1
Summary:	py.test plugin to run Odoo tests
License:	AGPLv3
URL:		https://github.com/camptocamp/pytest-odoo
Source0:	https://mirrors.nju.edu.cn/pypi/web/packages/90/5a/5cba6755a3a33345275d6b31dd24e61b4ef335f8cd9988722a3c5ca543f6/pytest-odoo-0.9.1.tar.gz
BuildArch:	noarch

Requires:	python3-pytest

%description
pytest plugin to run Odoo tests
This lib allows to run the tests built in Odoo addons which are using Python's `unittest <https://docs.python.org/3/library/unittest.html>`_, but with the comfort of the `pytest <https://docs.pytest.org/>`_ CLI. 
Also allowing to run tests without updating given module.
Odoo's `--test-enable` machinery and pytest-odoo do not cover exactly the same scope. The Odoo's test runner runs the tests during
the upgrades of the addons, that's why they need the "at install" and "post install" markers.
Running tests during upgrades of addons is waaay too slow to work efficiently in a TDD mode, that's where pytest-odoo shines.
Consider that all the tests are running `post-install` with pytest-odoo, as you must run the upgrade of the addon before (but only when needed vs each run).
At the end of the day, its beneficial to run the Odoo tests with `--test-enable` because, as in very rare conditions,
a test can pass with pytest-odoo but not with the "at install" tests run during the upgrade (or the oposite).
Pytest-odoo can be considered a development tool, but not the tool that should replace entirely `--test-enable` in a CI.
See also the `official Odoo documentation <https://www.odoo.com/documentation/15.0/developer/reference/backend/testing.html#testing-python-code>`_ on writing tests.

%package -n python3-pytest-odoo
Summary:	py.test plugin to run Odoo tests
Provides:	python-pytest-odoo
BuildRequires:	python3-devel
BuildRequires:	python3-setuptools
BuildRequires:	python3-pip
%description -n python3-pytest-odoo
pytest plugin to run Odoo tests
This lib allows to run the tests built in Odoo addons which are using Python's `unittest <https://docs.python.org/3/library/unittest.html>`_, but with the comfort of the `pytest <https://docs.pytest.org/>`_ CLI. 
Also allowing to run tests without updating given module.
Odoo's `--test-enable` machinery and pytest-odoo do not cover exactly the same scope. The Odoo's test runner runs the tests during
the upgrades of the addons, that's why they need the "at install" and "post install" markers.
Running tests during upgrades of addons is waaay too slow to work efficiently in a TDD mode, that's where pytest-odoo shines.
Consider that all the tests are running `post-install` with pytest-odoo, as you must run the upgrade of the addon before (but only when needed vs each run).
At the end of the day, its beneficial to run the Odoo tests with `--test-enable` because, as in very rare conditions,
a test can pass with pytest-odoo but not with the "at install" tests run during the upgrade (or the oposite).
Pytest-odoo can be considered a development tool, but not the tool that should replace entirely `--test-enable` in a CI.
See also the `official Odoo documentation <https://www.odoo.com/documentation/15.0/developer/reference/backend/testing.html#testing-python-code>`_ on writing tests.

%package help
Summary:	Development documents and examples for pytest-odoo
Provides:	python3-pytest-odoo-doc
%description help
pytest plugin to run Odoo tests
This lib allows to run the tests built in Odoo addons which are using Python's `unittest <https://docs.python.org/3/library/unittest.html>`_, but with the comfort of the `pytest <https://docs.pytest.org/>`_ CLI. 
Also allowing to run tests without updating given module.
Odoo's `--test-enable` machinery and pytest-odoo do not cover exactly the same scope. The Odoo's test runner runs the tests during
the upgrades of the addons, that's why they need the "at install" and "post install" markers.
Running tests during upgrades of addons is waaay too slow to work efficiently in a TDD mode, that's where pytest-odoo shines.
Consider that all the tests are running `post-install` with pytest-odoo, as you must run the upgrade of the addon before (but only when needed vs each run).
At the end of the day, its beneficial to run the Odoo tests with `--test-enable` because, as in very rare conditions,
a test can pass with pytest-odoo but not with the "at install" tests run during the upgrade (or the oposite).
Pytest-odoo can be considered a development tool, but not the tool that should replace entirely `--test-enable` in a CI.
See also the `official Odoo documentation <https://www.odoo.com/documentation/15.0/developer/reference/backend/testing.html#testing-python-code>`_ on writing tests.

%prep
%autosetup -n pytest-odoo-0.9.1

%build
%py3_build

%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
	find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
	find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
	find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
	find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
	find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .

%files -n python3-pytest-odoo -f filelist.lst
%dir %{python3_sitelib}/*

%files help -f doclist.lst
%{_docdir}/*

%changelog
* Tue May 30 2023 Python_Bot <Python_Bot@openeuler.org> - 0.9.1-1
- Package Spec generated