Add ipython shell tests

This commit is contained in:
ZyX 2014-08-06 17:18:42 +04:00
parent 42a9a5a5fc
commit c403eef434
6 changed files with 86 additions and 50 deletions

View File

@ -12,7 +12,7 @@ if python -c 'import sys; sys.exit(1 * (sys.version_info[0] != 2))' ; then
pip install unittest2 argparse
fi
fi
sudo apt-get install -qq screen zsh tcsh mksh busybox
sudo apt-get install -qq screen zsh tcsh mksh busybox ipython
# Travis has too outdated fish. It cannot be used for tests.
# sudo apt-get install fish
true

View File

@ -0,0 +1,7 @@
print ('cd ' + 'tests/shell/3rd') # Start of the test marker
bool 42
bool 44
class Test(object):
pass
exit

View File

@ -0,0 +1,14 @@
 In [2]  bool 42
     2>  bool(42)
 Out[2]  True
 In [3]  bool 44
     3>  bool(44)
 Out[3]  True
 In [4]  class Test(object):
          pass
         
 In [5]  exit

View File

@ -0,0 +1,3 @@
c = get_config()
c.InteractiveShellApp.extensions = ['powerline.bindings.ipython.post_0_11']
c.TerminalInteractiveShell.autocall = 1

View File

@ -15,8 +15,11 @@ new_fname = os.path.join('tests', 'shell', shell + '.' + test_type + '.log')
pid_fname = os.path.join('tests', 'shell', '3rd', 'pid')
with open(pid_fname, 'r') as P:
pid = P.read().strip()
try:
with open(pid_fname, 'r') as P:
pid = P.read().strip()
except IOError:
pid = None
hostname = socket.gethostname()
user = os.environ['USER']
@ -34,7 +37,8 @@ with codecs.open(fname, 'r', encoding='utf-8') as R:
})
line = line.replace(hostname, 'HOSTNAME')
line = line.replace(user, 'USER')
line = line.replace(pid, 'PID')
if pid is not None:
line = line.replace(pid, 'PID')
if shell == 'fish':
try:
start = line.index('\033[0;')

View File

@ -120,60 +120,68 @@ mkdir tests/shell/3rd/'$(echo)'
mkdir tests/shell/3rd/'`echo`'
mkdir tests/shell/fish_home
cp -r tests/test_shells/ipython_home tests/shell
export XDG_CONFIG_HOME="$PWD/tests/shell/fish_home"
export IPYTHONDIR="$PWD/tests/shell/ipython_home"
unset ENV
powerline-daemon -k || true
sleep 1s
if test "x${ONLY_SHELL%sh}" != "x${ONLY_SHELL}" || test "x${ONLY_SHELL}" = xbb ; then
powerline-daemon -k || true
sleep 1s
scripts/powerline-config shell command
scripts/powerline-config shell command
for TEST_TYPE in "daemon" "nodaemon" ; do
if test $TEST_TYPE == daemon ; then
sh -c 'echo $$ > tests/shell/daemon_pid; ./scripts/powerline-daemon -f &>tests/shell/daemon_log' &
fi
if ! run_test $TEST_TYPE bash --norc --noprofile -i ; then
FAILED=1
fi
if ! run_test $TEST_TYPE zsh -f -i ; then
FAILED=1
fi
if ! run_test $TEST_TYPE fish -i ; then
FAILED=1
fi
if ! run_test $TEST_TYPE tcsh -f -i ; then
FAILED=1
fi
if ! run_test $TEST_TYPE bb -i ; then
FAILED=1
fi
if ! run_test $TEST_TYPE mksh -i ; then
FAILED=1
fi
if ! run_test $TEST_TYPE dash -i ; then
# dash tests are not stable, see #931
# FAILED=1
true
fi
if test $TEST_TYPE == daemon ; then
./scripts/powerline-daemon -k
wait $(cat tests/shell/daemon_pid)
if ! test -z "$(cat tests/shell/daemon_log)" ; then
echo '____________________________________________________________'
echo "Daemon log:"
echo '============================================================'
cat tests/shell/daemon_log
for TEST_TYPE in "daemon" "nodaemon" ; do
if test $TEST_TYPE == daemon ; then
sh -c 'echo $$ > tests/shell/daemon_pid; ./scripts/powerline-daemon -f &>tests/shell/daemon_log' &
fi
if ! run_test $TEST_TYPE bash --norc --noprofile -i ; then
FAILED=1
fi
fi
done
if ! run_test $TEST_TYPE zsh -f -i ; then
FAILED=1
fi
if ! run_test $TEST_TYPE fish -i ; then
FAILED=1
fi
if ! run_test $TEST_TYPE tcsh -f -i ; then
FAILED=1
fi
if ! run_test $TEST_TYPE bb -i ; then
FAILED=1
fi
if ! run_test $TEST_TYPE mksh -i ; then
FAILED=1
fi
if ! run_test $TEST_TYPE dash -i ; then
# dash tests are not stable, see #931
# FAILED=1
true
fi
if test $TEST_TYPE == daemon ; then
./scripts/powerline-daemon -k
wait $(cat tests/shell/daemon_pid)
if ! test -z "$(cat tests/shell/daemon_log)" ; then
echo '____________________________________________________________'
echo "Daemon log:"
echo '============================================================'
cat tests/shell/daemon_log
FAILED=1
fi
fi
done
fi
if ! run_test ipython ipython ; then
FAILED=1
fi
test "x$ONLY_SHELL" = "x" && rm -r tests/shell
exit $FAILED