public inbox for [email protected]
help / color / mirror / Atom feedRemove python 2.6 specific code
2+ messages / 2 participants
[nested] [flat]
* Remove python 2.6 specific code
@ 2019-01-30 19:50 Cyril Jouve <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Cyril Jouve @ 2019-01-30 19:50 UTC (permalink / raw)
To: pgadmin-hackers
Hi,
Since python 2.6 is deprecated
<https://www.postgresql.org/message-id/E1gZuQV-0000jX-2O%40gothos.postgresql.org;,
this patch removes python 2.6 specific code.
Regards,
Cyril
Attachments:
[application/octet-stream] 0001-remove-python-2.6-compatibility-code.patch (10.3K, 3-0001-remove-python-2.6-compatibility-code.patch)
download | inline diff:
From ddcafe4d97d8bc8cf739d6757a13b63635dfde2e Mon Sep 17 00:00:00 2001
From: Cyril Jouve <[email protected]>
Date: Wed, 30 Jan 2019 20:37:18 +0100
Subject: [PATCH] remove python 2.6 compatibility code
---
pkg/pip/setup_pip.py | 20 ------------
requirements.txt | 31 +++++--------------
.../tools/backup/tests/test_batch_process.py | 5 +--
.../tests/test_batch_process_maintenance.py | 5 +--
.../tools/restore/tests/test_batch_process.py | 5 +--
web/pgadmin/utils/route.py | 5 +--
.../utils/sqlautocomplete/autocomplete.py | 6 +---
web/regression/requirements.txt | 12 +------
web/regression/runtests.py | 15 ++++-----
9 files changed, 20 insertions(+), 84 deletions(-)
diff --git a/pkg/pip/setup_pip.py b/pkg/pip/setup_pip.py
index a69b6f6e..f1bb4af4 100644
--- a/pkg/pip/setup_pip.py
+++ b/pkg/pip/setup_pip.py
@@ -66,7 +66,6 @@ setup(
'Development Status :: 5 - Production/Stable',
# Supported programming languages
- 'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
@@ -85,28 +84,9 @@ setup(
install_requires=required,
extras_require={
- # ...
- ":python_version<'2.7'": [
- "psycopg2==2.7.3.2",
- "Flask-Script==2.0.5",
- "ordereddict",
- "python-dateutil==2.5.0",
- "SQLAlchemy==1.0.14",
- "Flask-Security==1.7.5",
- "Flask-BabelEx==0.9.3"
- ],
":python_version<='2.7'": [
"importlib==1.0.3"
],
- ":python_version>='2.7'": [
- "psycopg2>=2.7.4",
- "python-dateutil>=2.7.1",
- "htmlmin==0.1.12",
- "Flask-HTMLmin==1.3.2",
- "SQLAlchemy>=1.2.5",
- "Flask-Security>=3.0.0",
- "sshtunnel>=0.1.3"
- ]
},
# Specify data files to be included.
diff --git a/requirements.txt b/requirements.txt
index 92eae7dd..e4232191 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -29,30 +29,15 @@ sqlparse==0.2.4
WTForms==2.1
Flask-Paranoid==0.2.0
psutil==5.4.7
-
-################################################################
-# Modules specifically requires for Python2.7 or greater version
-################################################################
-psycopg2>=2.7.4; python_version >= '2.7'
-python-dateutil>=2.7.1; python_version >= '2.7'
-htmlmin==0.1.12; python_version >= '2.7'
-Flask-HTMLmin==1.3.2; python_version >= '2.7'
-SQLAlchemy>=1.2.5; python_version >= '2.7'
-Flask-Security>=3.0.0; python_version >= '2.7'
-sshtunnel>=0.1.3; python_version >= '2.7'
+psycopg2>=2.7.4
+python-dateutil>=2.7.1
+htmlmin==0.1.12
+Flask-HTMLmin==1.3.2
+SQLAlchemy>=1.2.5
+Flask-Security>=3.0.0
+sshtunnel>=0.1.3
###############################################################
-# Modules specifically required for Python2.7 or lesser version
+# Modules specifically required for Python2.7
###############################################################
importlib==1.0.3; python_version <= '2.7'
-
-###############################################################
-# Modules required for Python2.6
-###############################################################
-psycopg2==2.7.3.2; python_version < '2.7'
-Flask-Script==2.0.5; python_version < '2.7'
-ordereddict; python_version < '2.7'
-python-dateutil==2.5.0; python_version < '2.7'
-SQLAlchemy==1.0.14; python_version < '2.7'
-Flask-Security==1.7.5; python_version < '2.7'
-Flask-BabelEx==0.9.3; python_version < '2.7'
diff --git a/web/pgadmin/tools/backup/tests/test_batch_process.py b/web/pgadmin/tools/backup/tests/test_batch_process.py
index 8a51bce6..15fb9448 100644
--- a/web/pgadmin/tools/backup/tests/test_batch_process.py
+++ b/web/pgadmin/tools/backup/tests/test_batch_process.py
@@ -119,10 +119,7 @@ class BatchProcessTest(BaseTestGenerator):
current_app_mock.PGADMIN_RUNTIME = False
def db_session_add_mock(j):
- if sys.version_info < (2, 7):
- cmd_obj = loads(str(j.desc))
- else:
- cmd_obj = loads(j.desc)
+ cmd_obj = loads(j.desc)
self.assertTrue(isinstance(cmd_obj, IProcessDesc))
self.assertEqual(cmd_obj.backup_type, self.class_params['type'])
self.assertEqual(cmd_obj.bfile, self.class_params['bfile'])
diff --git a/web/pgadmin/tools/maintenance/tests/test_batch_process_maintenance.py b/web/pgadmin/tools/maintenance/tests/test_batch_process_maintenance.py
index 8a238e7c..242698a2 100644
--- a/web/pgadmin/tools/maintenance/tests/test_batch_process_maintenance.py
+++ b/web/pgadmin/tools/maintenance/tests/test_batch_process_maintenance.py
@@ -73,10 +73,7 @@ class BatchProcessTest(BaseTestGenerator):
self.port = port
def db_session_add_mock(j):
- if sys.version_info < (2, 7):
- cmd_obj = loads(str(j.desc))
- else:
- cmd_obj = loads(j.desc)
+ cmd_obj = loads(j.desc)
self.assertTrue(isinstance(cmd_obj, IProcessDesc))
self.assertEqual(cmd_obj.query, self.class_params['cmd'])
self.assertEqual(cmd_obj.message, self.expected_msg)
diff --git a/web/pgadmin/tools/restore/tests/test_batch_process.py b/web/pgadmin/tools/restore/tests/test_batch_process.py
index 674eca07..39836133 100644
--- a/web/pgadmin/tools/restore/tests/test_batch_process.py
+++ b/web/pgadmin/tools/restore/tests/test_batch_process.py
@@ -64,10 +64,7 @@ class BatchProcessTest(BaseTestGenerator):
current_app_mock.PGADMIN_RUNTIME = False
def db_session_add_mock(j):
- if sys.version_info < (2, 7):
- cmd_obj = loads(str(j.desc))
- else:
- cmd_obj = loads(j.desc)
+ cmd_obj = loads(j.desc)
self.assertTrue(isinstance(cmd_obj, IProcessDesc))
self.assertEqual(cmd_obj.bfile, self.class_params['bfile'])
self.assertEqual(cmd_obj.cmd,
diff --git a/web/pgadmin/utils/route.py b/web/pgadmin/utils/route.py
index e45e06b7..e67f0195 100644
--- a/web/pgadmin/utils/route.py
+++ b/web/pgadmin/utils/route.py
@@ -16,10 +16,7 @@ import six
from werkzeug.utils import find_modules
from pgadmin.utils import server_utils
-if sys.version_info < (2, 7):
- import unittest2 as unittest
-else:
- import unittest
+import unittest
class TestsGeneratorRegistry(ABCMeta):
diff --git a/web/pgadmin/utils/sqlautocomplete/autocomplete.py b/web/pgadmin/utils/sqlautocomplete/autocomplete.py
index 4ad928c7..da97e607 100644
--- a/web/pgadmin/utils/sqlautocomplete/autocomplete.py
+++ b/web/pgadmin/utils/sqlautocomplete/autocomplete.py
@@ -14,11 +14,7 @@ import operator
import sys
from itertools import count, repeat, chain
from .completion import Completion
-from collections import namedtuple, defaultdict
-if sys.version_info < (2, 7):
- from ordereddict import OrderedDict
-else:
- from collections import OrderedDict
+from collections import namedtuple, defaultdict, OrderedDict
from .sqlcompletion import (
FromClauseItem, suggest_type, Database, Schema, Table,
diff --git a/web/regression/requirements.txt b/web/regression/requirements.txt
index 25bbe989..77044c05 100644
--- a/web/regression/requirements.txt
+++ b/web/regression/requirements.txt
@@ -11,17 +11,7 @@ pyperclip~=1.6.0
testscenarios==0.5.0
testtools==2.3.0
traceback2==1.4.0
-unittest2==1.1.0
-
-################################################################
-# Modules specifically requires for Python2.7 or greater version
-################################################################
-selenium==3.11.0; python_version >= '2.7'
-
-###############################################################
-# Modules required for Python2.6
-###############################################################
-selenium==3.3.3; python_version < '2.7'
+selenium==3.11.0
###############################################################
# Modules specifically required for Python3.3 or lesser version
diff --git a/web/regression/runtests.py b/web/regression/runtests.py
index b023703d..d920157f 100644
--- a/web/regression/runtests.py
+++ b/web/regression/runtests.py
@@ -25,10 +25,7 @@ from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
-if sys.version_info < (2, 7):
- import unittest2 as unit_test
-else:
- import unittest as unit_test
+import unittest
if sys.version_info[0] >= 3:
import builtins
@@ -119,9 +116,9 @@ app.PGADMIN_RUNTIME = True
if config.SERVER_MODE is True:
app.PGADMIN_RUNTIME = False
-setattr(unit_test.result.TestResult, "passed", [])
+setattr(unittest.result.TestResult, "passed", [])
-unit_test.runner.TextTestResult.addSuccess = test_utils.add_success
+unittest.runner.TextTestResult.addSuccess = test_utils.add_success
# Override apply_scenario method as we need custom test description/name
scenarios.apply_scenario = test_utils.apply_scenario
@@ -143,7 +140,7 @@ def get_suite(module_list, test_server, test_app_client, server_information,
:rtype: TestSuite
"""
modules = []
- pgadmin_suite = unit_test.TestSuite()
+ pgadmin_suite = unittest.TestSuite()
# Get the each test module and add into list
for key, klass in module_list:
@@ -423,7 +420,7 @@ if __name__ == '__main__':
server,
test_client,
server_information, test_db_name)
- tests = unit_test.TextTestRunner(stream=sys.stderr,
+ tests = unittest.TextTestRunner(stream=sys.stderr,
descriptions=True,
verbosity=2).run(suite)
@@ -434,7 +431,7 @@ if __name__ == '__main__':
# Set empty list for 'passed' parameter for each testRun.
# So that it will not append same test case name
- unit_test.result.TestResult.passed = []
+ unittest.result.TestResult.passed = []
if len(failed_cases) > 0:
failure = True
--
2.20.1
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: Remove python 2.6 specific code
@ 2019-01-31 12:48 Dave Page <[email protected]>
parent: Cyril Jouve <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Dave Page @ 2019-01-31 12:48 UTC (permalink / raw)
To: Cyril Jouve <[email protected]>; +Cc: pgadmin-hackers
Thanks - patch applied with a minor change for PEP8 compliance.
On Wed, Jan 30, 2019 at 8:51 PM Cyril Jouve <[email protected]> wrote:
>
> Hi,
>
> Since python 2.6 is deprecated, this patch removes python 2.6 specific code.
>
> Regards,
> Cyril
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2019-01-31 12:48 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-01-30 19:50 Remove python 2.6 specific code Cyril Jouve <[email protected]>
2019-01-31 12:48 ` Dave Page <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox