diff --git a/pg_view/models/collector_partition.py b/pg_view/models/collector_partition.py index 97d209e..9922e66 100644 --- a/pg_view/models/collector_partition.py +++ b/pg_view/models/collector_partition.py @@ -1,14 +1,18 @@ +import os import time from multiprocessing import Process -import os import psutil +import sys from pg_view.consts import RD, TICK_LENGTH, SECTOR_SIZE from pg_view.formatters import StatusFormatter, FnFormatter from pg_view.models.collector_base import BaseStatCollector, logger from pg_view.models.displayers import COLALIGN +if sys.hexversion >= 0x03000000: + long = int + class PartitionStatCollector(BaseStatCollector): """Collect statistics about PostgreSQL partitions """ diff --git a/setup.py b/setup.py index 043dece..c011aa5 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ def read_module(path): data = {} with open(path, 'r') as fd: - exec (fd.read(), data) + exec(fd.read(), data) return data diff --git a/tests/common.py b/tests/common.py index 1bac869..9710f76 100644 --- a/tests/common.py +++ b/tests/common.py @@ -1,4 +1,7 @@ -from StringIO import StringIO +try: + from io import StringIO +except ImportError: + from StringIO import StringIO import os diff --git a/tests/test_models_pg.py b/tests/test_models_pg.py index 26c27db..3498ee8 100644 --- a/tests/test_models_pg.py +++ b/tests/test_models_pg.py @@ -158,7 +158,7 @@ def test__read_proc_should_return_data_when_process_ok(self, mocked_psutil_proce 'guest_time': 0.0, 'starttime': datetime.datetime.fromtimestamp(1480777289.0), - 'delayacct_blkio_ticks': 0L, + 'delayacct_blkio_ticks': 0, 'cmdline': 'backend' } self.assertEqual(expected_proc_stats, proc_stats)