1
0
Fork 0

Deprecate Python2.7. (#1153)

* deprecate Python2.7.

So we can use latest version of prompt-toolit.
Relate: https://github.com/dbcli/pgcli/pull/1149

* black format, remove 2.7 support.

* using version py35 for black.

* Revert "black format, remove 2.7 support."

This reverts commit 4b6d0496cc.

* deprecated py27 using black.

* remove 2.7 from travis.

* update setup.py: delete python 2.7 support.
This commit is contained in:
赖信涛 2020-03-10 11:14:51 +08:00 committed by GitHub
parent 91263c37b9
commit fd77549754
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 24 additions and 24 deletions

View File

@ -5,7 +5,6 @@ sudo: required
language: python
python:
- "2.7"
- "3.5"
- "3.6"
- "3.7"

View File

@ -281,6 +281,8 @@ choice:
In [3]: my_result = _
Pgcli only runs on Python3.6+ since 2.2.0, if you use an old version of Python,
you should use install ``pgcli <= 2.2.0``.
Thanks:
-------

View File

@ -16,6 +16,7 @@ Internal:
---------
* Drop Python3.4 support. (Thanks: `laixintao`_)
* Drop Python2.7 support. (Thanks: `laixintao`_)
* Fix dead link in development guide. (Thanks: `BrownShibaDog`_)

View File

@ -363,7 +363,7 @@ class PGCli(object):
user=user,
host=host,
port=port,
**self.pgexecute.extra_args
**self.pgexecute.extra_args,
)
except OperationalError as e:
click.secho(str(e), err=True, fg="red")

View File

@ -1,6 +1,6 @@
[tool.black]
line-length = 88
target-version = ['py27']
target-version = ['py35']
include = '\.pyi?$'
exclude = '''
/(

View File

@ -47,8 +47,6 @@ setup(
"License :: OSI Approved :: BSD License",
"Operating System :: Unix",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",

View File

@ -240,10 +240,10 @@ def expanded(request):
@dbtest
def test_unicode_support_in_output(executor, expanded):
run(executor, "create table unicodechars(t text)")
run(executor, u"insert into unicodechars (t) values ('é')")
run(executor, "insert into unicodechars (t) values ('é')")
# See issue #24, this raises an exception without proper handling
assert u"é" in run(
assert "é" in run(
executor, "select * from unicodechars", join=True, expanded=expanded
)
@ -304,10 +304,10 @@ def test_multiple_queries_with_special_command_same_line(executor, pgspecial):
def test_multiple_queries_same_line_syntaxerror(executor, exception_formatter):
result = run(
executor,
u"select 'fooé'; invalid syntax é",
"select 'fooé'; invalid syntax é",
exception_formatter=exception_formatter,
)
assert u"fooé" in result[3]
assert "fooé" in result[3]
assert 'syntax error at or near "invalid"' in result[-1]
@ -319,8 +319,8 @@ def pgspecial():
@dbtest
def test_special_command_help(executor, pgspecial):
result = run(executor, "\\?", pgspecial=pgspecial)[1].split("|")
assert u"Command" in result[1]
assert u"Description" in result[2]
assert "Command" in result[1]
assert "Description" in result[2]
@dbtest
@ -328,42 +328,42 @@ def test_bytea_field_support_in_output(executor):
run(executor, "create table binarydata(c bytea)")
run(executor, "insert into binarydata (c) values (decode('DEADBEEF', 'hex'))")
assert u"\\xdeadbeef" in run(executor, "select * from binarydata", join=True)
assert "\\xdeadbeef" in run(executor, "select * from binarydata", join=True)
@dbtest
def test_unicode_support_in_unknown_type(executor):
assert u"日本語" in run(executor, u"SELECT '日本語' AS japanese;", join=True)
assert "日本語" in run(executor, "SELECT '日本語' AS japanese;", join=True)
@dbtest
def test_unicode_support_in_enum_type(executor):
run(executor, u"CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy', '日本語')")
run(executor, u"CREATE TABLE person (name TEXT, current_mood mood)")
run(executor, u"INSERT INTO person VALUES ('Moe', '日本語')")
assert u"日本語" in run(executor, u"SELECT * FROM person", join=True)
run(executor, "CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy', '日本語')")
run(executor, "CREATE TABLE person (name TEXT, current_mood mood)")
run(executor, "INSERT INTO person VALUES ('Moe', '日本語')")
assert "日本語" in run(executor, "SELECT * FROM person", join=True)
@requires_json
def test_json_renders_without_u_prefix(executor, expanded):
run(executor, u"create table jsontest(d json)")
run(executor, u"""insert into jsontest (d) values ('{"name": "Éowyn"}')""")
run(executor, "create table jsontest(d json)")
run(executor, """insert into jsontest (d) values ('{"name": "Éowyn"}')""")
result = run(
executor, u"SELECT d FROM jsontest LIMIT 1", join=True, expanded=expanded
executor, "SELECT d FROM jsontest LIMIT 1", join=True, expanded=expanded
)
assert u'{"name": "Éowyn"}' in result
assert '{"name": "Éowyn"}' in result
@requires_jsonb
def test_jsonb_renders_without_u_prefix(executor, expanded):
run(executor, "create table jsonbtest(d jsonb)")
run(executor, u"""insert into jsonbtest (d) values ('{"name": "Éowyn"}')""")
run(executor, """insert into jsonbtest (d) values ('{"name": "Éowyn"}')""")
result = run(
executor, "SELECT d FROM jsonbtest LIMIT 1", join=True, expanded=expanded
)
assert u'{"name": "Éowyn"}' in result
assert '{"name": "Éowyn"}' in result
@dbtest

View File

@ -1,5 +1,5 @@
[tox]
envlist = py27, py35, py36, py37
envlist = py35, py36, py37
[testenv]
deps = pytest>=2.7.0,<=3.0.7
mock>=1.0.1