diff --git a/.travis.yml b/.travis.yml index 04e570f25..2bb738e5b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,15 @@ +dist: xenial + +sudo: required + language: python + python: - "2.7" - "3.4" - "3.5" - "3.6" + - "3.7" before_install: - which python @@ -43,4 +49,4 @@ services: - postgresql addons: - postgresql: "9.3" + postgresql: "9.6" diff --git a/changelog.rst b/changelog.rst index 06c115d5c..d249aaa0f 100644 --- a/changelog.rst +++ b/changelog.rst @@ -8,7 +8,13 @@ Bug fixes: * Fix for "no attribute KeyringLocked" (#1040). (Thanks: `Irina Truong`_) * Pgcli no longer works with password containing spaces (#1043). (Thanks: `Irina Truong`_) * Load keyring only when keyring is enabled in the config file (#1041). (Thanks: `Zhaolong Zhu`_) -* No longer depend on sqlparse as being less than 0.3.0 with the release of sqlparse 0.3.0. (`VVelox`) +* No longer depend on sqlparse as being less than 0.3.0 with the release of sqlparse 0.3.0. (Thanks: `VVelox`_) +* Fix the broken support for pgservice . (Thanks: `Xavier Francisco`_) + +Internal: +--------- + +* Add python 3.7 to travis build matrix. (Thanks: `Irina Truong`_) 2.1.0 ===== @@ -965,4 +971,5 @@ Improvements: .. _`Nathan Verzemnieks`: https://github.com/njvrzm .. _`raylu`: https://github.com/raylu .. _`Zhaolong Zhu`: https://github.com/zzl0 - +.. _`Xavier Francisco`: https://github.com/Qu4tro +.. _`VVelox`: https://github.com/VVelox diff --git a/pgcli/pgexecute.py b/pgcli/pgexecute.py index 8e5616f71..93c8de423 100644 --- a/pgcli/pgexecute.py +++ b/pgcli/pgexecute.py @@ -233,14 +233,22 @@ def connect(self, database=None, user=None, password=None, host=None, 'dsn': dsn, } new_params.update(kwargs) + + if new_params['dsn']: + new_params = { + 'dsn': new_params['dsn'], + 'password': new_params['password'] + } + + if new_params['password']: + new_params['dsn'] = "{0} password={1}".format( + new_params['dsn'], new_params.pop('password') + ) + conn_params.update({ - k: unicode2utf8(v) for k, v in new_params.items() if v is not None + k: unicode2utf8(v) for k, v in new_params.items() if v }) - if 'password' in conn_params and 'dsn' in conn_params: - conn_params['dsn'] = make_dsn( - conn_params['dsn'], password=conn_params.pop('password')) - conn = psycopg2.connect(**conn_params) cursor = conn.cursor() conn.set_client_encoding('utf8') diff --git a/setup.py b/setup.py index 2cf93f792..775c46ef1 100644 --- a/setup.py +++ b/setup.py @@ -62,6 +62,7 @@ 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', 'Programming Language :: SQL', 'Topic :: Database', 'Topic :: Database :: Front-Ends', diff --git a/tox.ini b/tox.ini index 712db9cbc..c8c755176 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,10 @@ [tox] -envlist = py27, py34, py35, py36 +envlist = py27, py34, py35, py36, py37 [testenv] -deps = pytest - mock - pgspecial - humanize - psycopg2 +deps = pytest>=2.7.0,<=3.0.7 + mock>=1.0.1 + behave>=1.2.4 + pexpect==3.3 commands = py.test behave tests/features passenv = PGHOST