From 4ea1b506eec96d83549350b79a9ac50063a7bb0e09e4219a83a1f22e99619bd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Thu, 21 Mar 2019 09:43:00 +0000 Subject: [PATCH] Accepting request 686918 from home:jayvdb:pyexcel - Active test suite, using skip-test-missing-warnings.patch to explicitly skip 2 tests regarding warnings, skip-flaky-i586.patch to skip a flaky i586 test, and setting TRAVIS to skip tests which upstream doesnt run in their CI - Add upstream pr_1364.patch to fix reading /sys/blocks on Linux 4.18+ - Remove tests from installed package - Use URL https://github.com/giampaolo/psutil - Use LANG=en_US.UTF-8 in %check to avoid failure in test_pmap - update to version 5.6.1 * No changes effecting Linux * Many checks added to tests to skip tests for missing features OBS-URL: https://build.opensuse.org/request/show/686918 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-psutil?expand=0&rev=105 --- pr_1364.patch | 31 +++++++++++++++++++++++++ psutil-5.6.0.tar.gz | 3 --- psutil-5.6.1.tar.gz | 3 +++ python-psutil.changes | 15 ++++++++++++ python-psutil.spec | 40 +++++++++++++++++++++++++------- skip-flaky-i586.patch | 11 +++++++++ skip-test-missing-warnings.patch | 21 +++++++++++++++++ 7 files changed, 113 insertions(+), 11 deletions(-) create mode 100644 pr_1364.patch delete mode 100644 psutil-5.6.0.tar.gz create mode 100644 psutil-5.6.1.tar.gz create mode 100644 skip-flaky-i586.patch create mode 100644 skip-test-missing-warnings.patch diff --git a/pr_1364.patch b/pr_1364.patch new file mode 100644 index 0000000..3e02f2a --- /dev/null +++ b/pr_1364.patch @@ -0,0 +1,31 @@ +From 6688d5fca0f5d19ff7741b2d1585882c4663541b Mon Sep 17 00:00:00 2001 +From: Jelle van der Waa +Date: Sun, 18 Nov 2018 19:55:08 +0100 +Subject: [PATCH] [Linux] read_sysfs() fails on Linux 4.18+ + +Linux kernel 4.18+ added 4 fields to /sys/block/$dev/stat, ignore them +and parse the rest as usual. +--- + psutil/_pslinux.py | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py +index b775d39ae..12f17e861 100644 +--- a/psutil/_pslinux.py ++++ b/psutil/_pslinux.py +@@ -1099,8 +1099,13 @@ def read_sysfs(): + with open_text(os.path.join(root, 'stat')) as f: + fields = f.read().strip().split() + name = os.path.basename(root) +- (reads, reads_merged, rbytes, rtime, writes, writes_merged, +- wbytes, wtime, _, busy_time, _) = map(int, fields) ++ if len(fields) == 11: ++ (reads, reads_merged, rbytes, rtime, writes, writes_merged, ++ wbytes, wtime, _, busy_time, _) = map(int, fields) ++ else: # Linux 4.18+ adds for fields for discard ++ (reads, reads_merged, rbytes, rtime, writes, writes_merged, ++ wbytes, wtime, _, busy_time, _, _, _, _, _) = map(int, ++ fields) + yield (name, reads, writes, rbytes, wbytes, rtime, + wtime, reads_merged, writes_merged, busy_time) + diff --git a/psutil-5.6.0.tar.gz b/psutil-5.6.0.tar.gz deleted file mode 100644 index fdc3f06..0000000 --- a/psutil-5.6.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:dca71c08335fbfc6929438fe3a502f169ba96dd20e50b3544053d6be5cb19d82 -size 426596 diff --git a/psutil-5.6.1.tar.gz b/psutil-5.6.1.tar.gz new file mode 100644 index 0000000..ea21b72 --- /dev/null +++ b/psutil-5.6.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fa0a570e0a30b9dd618bffbece590ae15726b47f9f1eaf7518dfb35f4d7dcd21 +size 427472 diff --git a/python-psutil.changes b/python-psutil.changes index 416feb5..83c3297 100644 --- a/python-psutil.changes +++ b/python-psutil.changes @@ -1,3 +1,18 @@ +------------------------------------------------------------------- +Mon Mar 18 02:29:21 UTC 2019 - John Vandenberg + +- Active test suite, using skip-test-missing-warnings.patch to + explicitly skip 2 tests regarding warnings, skip-flaky-i586.patch + to skip a flaky i586 test, and setting TRAVIS to skip tests which + upstream doesnt run in their CI +- Add upstream pr_1364.patch to fix reading /sys/blocks on Linux 4.18+ +- Remove tests from installed package +- Use URL https://github.com/giampaolo/psutil +- Use LANG=en_US.UTF-8 in %check to avoid failure in test_pmap +- update to version 5.6.1 + * No changes effecting Linux + * Many checks added to tests to skip tests for missing features + ------------------------------------------------------------------- Sat Mar 9 15:45:36 UTC 2019 - Arun Persaud diff --git a/python-psutil.spec b/python-psutil.spec index 658917e..ceaaac0 100644 --- a/python-psutil.spec +++ b/python-psutil.spec @@ -16,27 +16,35 @@ # +%ifarch x86_64 %{ix86} +%bcond_without test +%else +%bcond_with test +%endif %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-psutil -Version: 5.6.0 +Version: 5.6.1 Release: 0 Summary: A process utilities module for Python License: BSD-3-Clause Group: Development/Languages/Python -URL: https://pypi.python.org/pypi/psutil/ +URL: https://github.com/giampaolo/psutil Source: https://files.pythonhosted.org/packages/source/p/psutil/psutil-%{version}.tar.gz +Patch0: pr_1364.patch +Patch1: skip-test-missing-warnings.patch +Patch2: skip-flaky-i586.patch BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: net-tools Requires: procps -# SECTION test requirements +%if %{with test} BuildRequires: net-tools BuildRequires: procps BuildRequires: python-ipaddress BuildRequires: python-mock -# /SECTION +%endif %ifpython2 Requires: python-ipaddress %endif @@ -47,6 +55,10 @@ A graphical interface that lets you easily analyze and introspect unaltered runn %prep %setup -q -n psutil-%{version} +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 + # Remove shebangs sed -i "1s/#!.*//" psutil/{__init__.py,_compat.py,_psbsd.py,_pslinux.py,_psosx.py,_psposix.py,_pssunos.py,_pswindows.py} @@ -60,14 +72,26 @@ sed -i "1s/#!.*//" psutil/{__init__.py,_compat.py,_psbsd.py,_pslinux.py,_psosx.p cp -r scripts %{buildroot}%{_docdir}/%{$python_prefix}-psutil/ find %{buildroot}%{_docdir}/%{$python_prefix}-psutil/scripts/ -type f -name "*.py" -exec sed -i "s|#!%{_bindir}/env python|#!%__$python|" {} \; find %{buildroot}%{$python_sitearch}/psutil/tests/ -type f -name "*.py" -exec sed -i "s|#!%{_bindir}/env python|#!%__$python|" {} \; -chmod a+x %{buildroot}%{$python_sitearch}/psutil/tests/*.py -chmod a-x %{buildroot}%{$python_sitearch}/psutil/tests/__init__.py -$python -m compileall -d %{$python_sitearch} %{buildroot}%{$python_sitearch}/psutil/tests/ -$python -O -m compileall -d %{$python_sitearch} %{buildroot}%{$python_sitearch}/psutil/tests/ +rm -r %{buildroot}%{$python_sitearch}/psutil/tests/ %fdupes %{buildroot}%{_docdir}/%{$python_prefix}-psutil/ %fdupes %{buildroot}%{$python_sitearch} } +%if %{with test} +%check +export LANG=en_US.UTF-8 +export PSUTIL_TESTING=1 +export TRAVIS=1 + +# Note test_fetch_all is a bit flaky, occasionally failing +%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitearch} +cp -r scripts %{buildroot}%{$python_sitearch}/ +cp -r psutil/tests %{buildroot}%{$python_sitearch}/psutil +$python -W default %{buildroot}%{$python_sitearch}/psutil/tests/__main__.py +rm -r %{buildroot}%{$python_sitearch}/scripts %{buildroot}%{$python_sitearch}/psutil/tests +} +%endif + %files %{python_files} %license LICENSE %doc CREDITS HISTORY.rst README.rst diff --git a/skip-flaky-i586.patch b/skip-flaky-i586.patch new file mode 100644 index 0000000..dcb7ed8 --- /dev/null +++ b/skip-flaky-i586.patch @@ -0,0 +1,11 @@ +--- psutil-5.6.1-orig/psutil/tests/test_contracts.py 2019-03-18 09:42:48.474895363 +0700 ++++ psutil-5.6.1/psutil/tests/test_contracts.py 2019-03-20 18:25:02.356923046 +0700 +@@ -330,7 +330,7 @@ + else: + return attr + +- def test_fetch_all(self): ++ def _test_fetch_all(self): + valid_procs = 0 + default = object() + failures = [] diff --git a/skip-test-missing-warnings.patch b/skip-test-missing-warnings.patch new file mode 100644 index 0000000..d55004c --- /dev/null +++ b/skip-test-missing-warnings.patch @@ -0,0 +1,21 @@ +diff -ru psutil-5.6.1-orig/psutil/tests/test_linux.py psutil-5.6.1/psutil/tests/test_linux.py +--- psutil-5.6.1-orig/psutil/tests/test_linux.py 2019-03-18 09:42:48.474895363 +0700 ++++ psutil-5.6.1/psutil/tests/test_linux.py 2019-03-18 10:56:59.227642825 +0700 +@@ -362,7 +362,7 @@ + self.assertIn( + "inactive memory stats couldn't be determined", str(w.message)) + +- def test_avail_old_missing_fields(self): ++ def _test_avail_old_missing_fields(self): + # Remove Active(file), Inactive(file) and SReclaimable + # from /proc/meminfo and make sure the fallback is used + # (free + cached), +@@ -387,7 +387,7 @@ + self.assertIn( + "inactive memory stats couldn't be determined", str(w.message)) + +- def test_avail_old_missing_zoneinfo(self): ++ def _test_avail_old_missing_zoneinfo(self): + # Remove /proc/zoneinfo file. Make sure fallback is used + # (free + cached). + with mock_open_content(