Merge pull request #963 from ZyX-I/ipython-tests
Add ipython shell tests
This commit is contained in:
commit
0853f60391
|
@ -4,12 +4,22 @@ pip install psutil
|
||||||
if python -c 'import sys; sys.exit(1 * (sys.version_info[0] != 2))' ; then
|
if python -c 'import sys; sys.exit(1 * (sys.version_info[0] != 2))' ; then
|
||||||
# Python 2
|
# Python 2
|
||||||
if python -c 'import platform, sys; sys.exit(1 - (platform.python_implementation() == "CPython"))' ; then
|
if python -c 'import platform, sys; sys.exit(1 - (platform.python_implementation() == "CPython"))' ; then
|
||||||
|
# PyPy
|
||||||
pip install mercurial
|
pip install mercurial
|
||||||
pip install --allow-external bzr --allow-unverified bzr bzr
|
pip install --allow-external bzr --allow-unverified bzr bzr
|
||||||
fi
|
fi
|
||||||
if python -c 'import sys; sys.exit(1 * (sys.version_info[1] >= 7))' ; then
|
if python -c 'import sys; sys.exit(1 * (sys.version_info[1] >= 7))' ; then
|
||||||
# Python 2.6
|
# Python 2.6
|
||||||
pip install unittest2 argparse
|
pip install unittest2 argparse
|
||||||
|
else
|
||||||
|
# Python 2.7
|
||||||
|
pip install ipython
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Python 3
|
||||||
|
if python -c 'import sys; sys.exit(1 * (sys.version_info < (3, 3)))' ; then
|
||||||
|
# Python 3.3+
|
||||||
|
pip install ipython
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
sudo apt-get install -qq screen zsh tcsh mksh busybox
|
sudo apt-get install -qq screen zsh tcsh mksh busybox
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
print ('cd ' + 'tests/shell/3rd') # Start of the test marker
|
||||||
|
bool 42
|
||||||
|
bool 44
|
||||||
|
class Test(object):
|
||||||
|
pass
|
||||||
|
|
||||||
|
exit
|
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
[0;38;5;250;48;5;240m In [[0;38;5;231;48;5;240m2[0;38;5;250;48;5;240m] [0;38;5;240;49;22m [0mbool 42
|
||||||
|
[0;38;5;250;48;5;240m [0;38;5;231;48;5;240m2[0;38;5;250;48;5;240m> [0;38;5;240;49;22m [0mbool(42)
|
||||||
|
[0;38;5;250;48;5;240m Out[[0;38;5;231;48;5;240m2[0;38;5;250;48;5;240m] [0;38;5;240;49;22m [0mTrue
|
||||||
|
|
||||||
|
[0;38;5;250;48;5;240m In [[0;38;5;231;48;5;240m3[0;38;5;250;48;5;240m] [0;38;5;240;49;22m [0mbool 44
|
||||||
|
[0;38;5;250;48;5;240m [0;38;5;231;48;5;240m3[0;38;5;250;48;5;240m> [0;38;5;240;49;22m [0mbool(44)
|
||||||
|
[0;38;5;250;48;5;240m Out[[0;38;5;231;48;5;240m3[0;38;5;250;48;5;240m] [0;38;5;240;49;22m [0mTrue
|
||||||
|
|
||||||
|
[0;38;5;250;48;5;240m In [[0;38;5;231;48;5;240m4[0;38;5;250;48;5;240m] [0;38;5;240;49;22m [0mclass Test(object):
|
||||||
|
[0;38;5;250;48;5;240m [0;38;5;240;49;22m [0m pass
|
||||||
|
[0;38;5;250;48;5;240m [0;38;5;240;49;22m [0m
|
||||||
|
|
||||||
|
[0;38;5;250;48;5;240m In [[0;38;5;231;48;5;240m5[0;38;5;250;48;5;240m] [0;38;5;240;49;22m [0mexit
|
|
@ -0,0 +1,17 @@
|
||||||
|
c = get_config()
|
||||||
|
c.InteractiveShellApp.extensions = ['powerline.bindings.ipython.post_0_11']
|
||||||
|
c.TerminalInteractiveShell.autocall = 1
|
||||||
|
c.Powerline.theme_overrides = {
|
||||||
|
'in': {
|
||||||
|
'segment_data': {
|
||||||
|
'virtualenv': {
|
||||||
|
'display': False
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
c.Powerline.config_overrides = {
|
||||||
|
'common': {
|
||||||
|
'default_top_theme': 'ascii'
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,8 +15,11 @@ new_fname = os.path.join('tests', 'shell', shell + '.' + test_type + '.log')
|
||||||
pid_fname = os.path.join('tests', 'shell', '3rd', 'pid')
|
pid_fname = os.path.join('tests', 'shell', '3rd', 'pid')
|
||||||
|
|
||||||
|
|
||||||
with open(pid_fname, 'r') as P:
|
try:
|
||||||
|
with open(pid_fname, 'r') as P:
|
||||||
pid = P.read().strip()
|
pid = P.read().strip()
|
||||||
|
except IOError:
|
||||||
|
pid = None
|
||||||
hostname = socket.gethostname()
|
hostname = socket.gethostname()
|
||||||
user = os.environ['USER']
|
user = os.environ['USER']
|
||||||
|
|
||||||
|
@ -34,6 +37,7 @@ with codecs.open(fname, 'r', encoding='utf-8') as R:
|
||||||
})
|
})
|
||||||
line = line.replace(hostname, 'HOSTNAME')
|
line = line.replace(hostname, 'HOSTNAME')
|
||||||
line = line.replace(user, 'USER')
|
line = line.replace(user, 'USER')
|
||||||
|
if pid is not None:
|
||||||
line = line.replace(pid, 'PID')
|
line = line.replace(pid, 'PID')
|
||||||
if shell == 'fish':
|
if shell == 'fish':
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -120,16 +120,19 @@ mkdir tests/shell/3rd/'$(echo)'
|
||||||
mkdir tests/shell/3rd/'`echo`'
|
mkdir tests/shell/3rd/'`echo`'
|
||||||
|
|
||||||
mkdir tests/shell/fish_home
|
mkdir tests/shell/fish_home
|
||||||
|
cp -r tests/test_shells/ipython_home tests/shell
|
||||||
export XDG_CONFIG_HOME="$PWD/tests/shell/fish_home"
|
export XDG_CONFIG_HOME="$PWD/tests/shell/fish_home"
|
||||||
|
export IPYTHONDIR="$PWD/tests/shell/ipython_home"
|
||||||
|
|
||||||
unset ENV
|
unset ENV
|
||||||
|
|
||||||
powerline-daemon -k || true
|
if test "x${ONLY_SHELL%sh}" != "x${ONLY_SHELL}" || test "x${ONLY_SHELL}" = xbb ; then
|
||||||
sleep 1s
|
powerline-daemon -k || true
|
||||||
|
sleep 1s
|
||||||
|
|
||||||
scripts/powerline-config shell command
|
scripts/powerline-config shell command
|
||||||
|
|
||||||
for TEST_TYPE in "daemon" "nodaemon" ; do
|
for TEST_TYPE in "daemon" "nodaemon" ; do
|
||||||
if test $TEST_TYPE == daemon ; then
|
if test $TEST_TYPE == daemon ; then
|
||||||
sh -c 'echo $$ > tests/shell/daemon_pid; ./scripts/powerline-daemon -f &>tests/shell/daemon_log' &
|
sh -c 'echo $$ > tests/shell/daemon_pid; ./scripts/powerline-daemon -f &>tests/shell/daemon_log' &
|
||||||
fi
|
fi
|
||||||
|
@ -173,7 +176,12 @@ for TEST_TYPE in "daemon" "nodaemon" ; do
|
||||||
FAILED=1
|
FAILED=1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! run_test ipython ipython ; then
|
||||||
|
FAILED=1
|
||||||
|
fi
|
||||||
|
|
||||||
test "x$ONLY_SHELL" = "x" && rm -r tests/shell
|
test "x$ONLY_SHELL" = "x" && rm -r tests/shell
|
||||||
exit $FAILED
|
exit $FAILED
|
||||||
|
|
Loading…
Reference in New Issue