Skip to content

Commit fde4f2b

Browse files
authored
Merge branch 'master' into master
2 parents 07420f0 + 5abae48 commit fde4f2b

11 files changed

+23
-19
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ matrix:
1212

1313
install:
1414
- pip install -r requirements-dev.txt
15-
- pip install -e .
15+
- pip install --no-cache-dir -e .
1616
- sudo rm -f /etc/mysql/conf.d/performance-schema.cnf
1717
- sudo service mysql restart
1818

changelog.md

+7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ Features:
77
* Add an option `--init-command` to execute SQL after connecting (Thanks: [KITAGAWA Yasutaka]).
88
* Use InputMode.REPLACE_SINGLE
99

10+
Bug Fixes:
11+
----------
12+
* Fixed compatibility with sqlparse 0.4 (Thanks: [mtorromeo]).
13+
* Fixed iPython magic (Thanks: [mwcm]).
14+
1015
1.22.2
1116
======
1217

@@ -786,3 +791,5 @@ Bug Fixes:
786791
[Georgy Frolov]: https://github.com/pasenor
787792
[Zach DeCook]: https://zachdecook.com
788793
[laixintao]: https://github.com/laixintao
794+
[mtorromeo]: https://github.com/mtorromeo
795+
[mwcm]: https://github.com/mwcm

mycli/AUTHORS

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ Contributors:
7676
* kevinhwang91
7777
* KITAGAWA Yasutaka
7878
* bitkeen
79+
* Morgan Mitchell
80+
* Massimiliano Torromeo
7981

8082
Creator:
8183
--------

mycli/magic.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def load_ipython_extension(ipython):
1919
def mycli_line_magic(line):
2020
_logger.debug('mycli magic called: %r', line)
2121
parsed = sql.parse.parse(line, {})
22-
conn = sql.connection.Connection.get(parsed['connection'])
22+
conn = sql.connection.Connection(parsed['connection'])
2323

2424
try:
2525
# A corresponding mycli object already exists

mycli/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def __init__(self, sqlexecute=None, prompt=None,
152152
c['main'].as_bool('auto_vertical_output')
153153

154154
# Write user config if system config wasn't the last config loaded.
155-
if c.filename not in self.system_config_files:
155+
if c.filename not in self.system_config_files and not os.path.exists(myclirc):
156156
write_default_config(self.default_config_file, myclirc)
157157

158158
# audit log

mycli/packages/completion_engine.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import sys
33
import sqlparse
44
from sqlparse.sql import Comparison, Identifier, Where
5-
from sqlparse.compat import text_type
65
from .parseutils import last_word, extract_tables, find_prev_keyword
76
from .special import parse_special_command
87

@@ -55,7 +54,7 @@ def suggest_type(full_text, text_before_cursor):
5554
stmt_start, stmt_end = 0, 0
5655

5756
for statement in parsed:
58-
stmt_len = len(text_type(statement))
57+
stmt_len = len(str(statement))
5958
stmt_start, stmt_end = stmt_end, stmt_end + stmt_len
6059

6160
if stmt_end >= current_pos:

requirements-dev.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ pytest!=3.3.0
33
pytest-cov==2.4.0
44
tox
55
twine==1.12.1
6-
behave
7-
pexpect
6+
behave>=1.2.4
7+
pexpect==3.3
88
coverage==5.0.4
99
codecov==2.0.9
1010
autopep8==1.3.3

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class test(TestCommand):
6565
def initialize_options(self):
6666
TestCommand.initialize_options(self)
6767
self.pytest_args = ''
68-
self.behave_args = ''
68+
self.behave_args = '--no-capture'
6969

7070
def run_tests(self):
7171
unit_test_errno = subprocess.call(

test/features/environment.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def before_all(context):
1616
os.environ['LINES'] = "100"
1717
os.environ['COLUMNS'] = "100"
1818
os.environ['EDITOR'] = 'ex'
19-
os.environ['LC_ALL'] = 'en_US.utf8'
19+
os.environ['LC_ALL'] = 'en_US.UTF-8'
2020
os.environ['PROMPT_TOOLKIT_NO_CPR'] = '1'
2121

2222
test_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
@@ -118,11 +118,12 @@ def after_scenario(context, _):
118118
host = context.conf['host']
119119
dbname = context.currentdb
120120
context.cli.expect_exact(
121-
'{0}@{1}:{2}> '.format(
121+
'{0}@{1}:{2}>'.format(
122122
user, host, dbname
123123
),
124124
timeout=5
125125
)
126+
context.cli.sendcontrol('c')
126127
context.cli.sendcontrol('d')
127128
context.cli.expect_exact(pexpect.EOF, timeout=5)
128129

test/features/steps/crud_database.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,13 @@ def step_see_prompt(context):
6464
user = context.conf['user']
6565
host = context.conf['host']
6666
dbname = context.currentdb
67-
wrappers.expect_exact(context, '{0}@{1}:{2}> '.format(
68-
user, host, dbname), timeout=5)
69-
context.atprompt = True
67+
wrappers.wait_prompt(context, '{0}@{1}:{2}> '.format(user, host, dbname))
7068

7169

7270
@then('we see help output')
7371
def step_see_help(context):
7472
for expected_line in context.fixture_data['help_commands.txt']:
75-
wrappers.expect_exact(context, expected_line + '\r\n', timeout=1)
73+
wrappers.expect_exact(context, expected_line, timeout=1)
7674

7775

7876
@then('we see database created')
@@ -96,10 +94,7 @@ def step_see_db_dropped_no_default(context):
9694
context.currentdb = None
9795

9896
wrappers.expect_exact(context, 'Query OK, 0 rows affected', timeout=2)
99-
wrappers.expect_exact(context, '{0}@{1}:{2}> '.format(
100-
user, host, database), timeout=5)
101-
102-
context.atprompt = True
97+
wrappers.wait_prompt(context, '{0}@{1}:{2}>'.format(user, host, database))
10398

10499

105100
@then('we see database connected')

test/features/steps/wrappers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def wait_prompt(context, prompt=None):
8888
user = context.conf['user']
8989
host = context.conf['host']
9090
dbname = context.currentdb
91-
prompt = '{0}@{1}:{2}> '.format(
91+
prompt = '{0}@{1}:{2}>'.format(
9292
user, host, dbname),
9393
expect_exact(context, prompt, timeout=5)
9494
context.atprompt = True

0 commit comments

Comments
 (0)