summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2020-02-13 23:28:57 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2020-02-13 23:28:57 +0100
commit29846dab6fdb1d7a9e46fb644417217cedffd115 (patch)
treef43c587f6684514bea3461203dc6313ad2d57d26
parent2ec9eee4dc1291f291f8ef25474d82f37b43f133 (diff)
downloadpsutil-29846dab6fdb1d7a9e46fb644417217cedffd115.tar.gz
#1681, revert 00a3398
-rw-r--r--HISTORY.rst1
-rw-r--r--docs/index.rst2
-rw-r--r--psutil/_pslinux.py25
-rwxr-xr-xpsutil/tests/test_linux.py19
4 files changed, 0 insertions, 47 deletions
diff --git a/HISTORY.rst b/HISTORY.rst
index 539c6fd4..7341b6d7 100644
--- a/HISTORY.rst
+++ b/HISTORY.rst
@@ -17,7 +17,6 @@ XXXX-XX-XX
- 1677_: [Windows] process exe() will succeed for all process PIDs (instead of
raising AccessDenied).
- 1679_: [Windows] net_connections() and Process.connections() are 10% faster.
-- 1681_: [Linux] disk_partitions() now also shows swap partitions.
- 1686_: [Windows] added support for PyPy on Windows.
- 1693_: [Windows] boot_time() and Process.create_time() now have the precision
of a micro second (before the precision was of a second).
diff --git a/docs/index.rst b/docs/index.rst
index e60058cd..ea5f15bd 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -405,8 +405,6 @@ Disks
[sdiskpart(device='/dev/sda3', mountpoint='/', fstype='ext4', opts='rw,errors=remount-ro'),
sdiskpart(device='/dev/sda7', mountpoint='/home', fstype='ext4', opts='rw')]
- .. versionchanged:: 5.7.0 swap partitions are shown on Linux.
-
.. function:: disk_usage(path)
Return disk usage statistics about the partition which contains the given
diff --git a/psutil/_pslinux.py b/psutil/_pslinux.py
index 1bd8e987..9e32f25e 100644
--- a/psutil/_pslinux.py
+++ b/psutil/_pslinux.py
@@ -1179,31 +1179,6 @@ def disk_partitions(all=False):
ntuple = _common.sdiskpart(device, mountpoint, fstype, opts)
retlist.append(ntuple)
- # swap
- if all:
- try:
- f = open_text("%s/swaps" % procfs_path)
- except FileNotFoundError:
- pass
- else:
- with f:
- f.readline() # header
- for line in f.readlines():
- fields = line.split('\t')
- device = fields[0].split()[0]
- mountp = None
- fstype = 'swap'
- # The priority column is useful when multiple swap
- # files are in use. The lower the priority, the
- # more likely the swap file is to be used.
- prio = fields[-1].strip()
- if re.match(r'(-)?\d+', prio):
- opts = "priority=" + prio
- else:
- opts = ''
- ntuple = _common.sdiskpart(device, mountp, fstype, opts)
- retlist.append(ntuple)
-
return retlist
diff --git a/psutil/tests/test_linux.py b/psutil/tests/test_linux.py
index 5a48a445..97946a0b 100755
--- a/psutil/tests/test_linux.py
+++ b/psutil/tests/test_linux.py
@@ -1067,25 +1067,6 @@ class TestSystemDiskPartitions(unittest.TestCase):
finally:
psutil.PROCFS_PATH = "/proc"
- @unittest.skipIf(not os.path.exists('/proc/swaps'),
- "/proc/swaps not available")
- def test_swap(self):
- with open('/proc/swaps') as f:
- if not f.readline() or not f.readlines():
- raise self.skipTest("/proc/swaps is empty")
- types = [x.fstype for x in psutil.disk_partitions(all=False)]
- self.assertNotIn('swap', types)
- types = [x.fstype for x in psutil.disk_partitions(all=True)]
- self.assertIn('swap', types)
- for part in psutil.disk_partitions(all=True):
- if part.fstype == 'swap':
- assert os.path.exists(part.device), part
- self.assertIsNone(part.mountpoint)
- if part.opts:
- assert part.opts.startswith('priority=')
- prio = part.opts.split('=')[1]
- int(prio)
-
@unittest.skipIf(not LINUX, "LINUX only")
class TestSystemDiskIoCounters(unittest.TestCase):