mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-31 02:01:13 +00:00
parent
2a166a7dec
commit
7b7c150bb7
@ -30,6 +30,11 @@ class TestRerun(object):
|
|||||||
actual = rerun.get_output('', '')
|
actual = rerun.get_output('', '')
|
||||||
assert actual == expected
|
assert actual == expected
|
||||||
|
|
||||||
|
@patch('thefuck.output_readers.rerun._wait_output')
|
||||||
|
def test_get_output_unicode_misspell(self, wait_output_mock):
|
||||||
|
rerun.get_output(u'pácman', u'pácman')
|
||||||
|
wait_output_mock.assert_called_once()
|
||||||
|
|
||||||
def test_wait_output_is_slow(self, settings):
|
def test_wait_output_is_slow(self, settings):
|
||||||
assert rerun._wait_output(Mock(), True)
|
assert rerun._wait_output(Mock(), True)
|
||||||
self.proc_mock.wait.assert_called_once_with(settings.wait_slow_command)
|
self.proc_mock.wait.assert_called_once_with(settings.wait_slow_command)
|
||||||
|
@ -40,6 +40,9 @@ def _group_by_calls(log):
|
|||||||
|
|
||||||
|
|
||||||
def _get_script_group_lines(grouped, script):
|
def _get_script_group_lines(grouped, script):
|
||||||
|
if six.PY2:
|
||||||
|
script = script.encode('utf-8')
|
||||||
|
|
||||||
parts = shlex.split(script)
|
parts = shlex.split(script)
|
||||||
|
|
||||||
for script_line, lines in reversed(grouped):
|
for script_line, lines in reversed(grouped):
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import os
|
import os
|
||||||
import shlex
|
import shlex
|
||||||
|
import six
|
||||||
from subprocess import Popen, PIPE, STDOUT
|
from subprocess import Popen, PIPE, STDOUT
|
||||||
from psutil import AccessDenied, Process, TimeoutExpired
|
from psutil import AccessDenied, Process, TimeoutExpired
|
||||||
from .. import logs
|
from .. import logs
|
||||||
@ -53,6 +54,9 @@ def get_output(script, expanded):
|
|||||||
env = dict(os.environ)
|
env = dict(os.environ)
|
||||||
env.update(settings.env)
|
env.update(settings.env)
|
||||||
|
|
||||||
|
if six.PY2:
|
||||||
|
expanded = expanded.encode('utf-8')
|
||||||
|
|
||||||
split_expand = shlex.split(expanded)
|
split_expand = shlex.split(expanded)
|
||||||
is_slow = split_expand[0] in settings.slow_commands if split_expand else False
|
is_slow = split_expand[0] in settings.slow_commands if split_expand else False
|
||||||
with logs.debug_time(u'Call: {}; with env: {}; is slow: {}'.format(
|
with logs.debug_time(u'Call: {}; with env: {}; is slow: {}'.format(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user