Commit cac09a20 authored by Jameson Rollins's avatar Jameson Rollins

tests: update tests to python3

parent efbc58a8
......@@ -8,13 +8,13 @@ PGIT_REQ=2.0
newest() {
echo -e "$1\n$2" | sort -V | tail -n1
}
if ! PGIT_VERS=$(python -c 'import git; print(git.__version__)') ; then
if ! PGIT_VERS=$($PYTHON -c 'import git; print(git.__version__)') ; then
echo " MISSING PYTHON PACKAGE: git"
echo " TEST SKIPPED"
test_done
fi
if [[ $(newest "$PGIT_VERS" "$PGIT_REQ") == "$PGIT_REQ" ]] ; then
echo " VERSION INCOMPATIBILITY: python git ($PGIT_VERS < $PGIT_REQ)"
echo " VERSION INCOMPATIBILITY: $PYTHON git ($PGIT_VERS < $PGIT_REQ)"
echo " TEST SKIPPED"
test_done
fi
......@@ -24,7 +24,7 @@ export GUARD_ARCHIVE_ROOT="$TMP_DIRECTORY"/node_repos
################################################################
test_begin_subtest "commit logs"
python - <<EOF >COMMIT
$PYTHON - <<EOF >COMMIT
import os
from guardian import GuardSystem
from guardian.archive import SystemArchiveGit
......@@ -39,7 +39,7 @@ with SystemArchiveGit(archive_path) as repo:
# registered
msg1 = 'COMMIT 1'
id1 = repo.commit(sys, msg1)
print id0, msg0
print(id0, msg0)
EOF
(cd "$GUARD_ARCHIVE_ROOT"/TEST0 \
&& git log --reverse --pretty=oneline) >INSPECT
......@@ -47,7 +47,7 @@ test_expect_equal_file COMMIT INSPECT
test_begin_subtest "commit system"
> TEST1.py
python - <<EOF
$PYTHON - <<EOF
import os
from guardian import GuardSystem
from guardian.archive import SystemArchiveGit
......@@ -87,7 +87,7 @@ import sys
import foo
from bar import baz
EOF
python - <<EOF
$PYTHON - <<EOF
import os
from guardian import GuardSystem
from guardian.archive import SystemArchiveGit
......@@ -114,7 +114,7 @@ cat <<EOF >TEST1.py
import sys
from bar import baz
EOF
python - <<EOF
$PYTHON - <<EOF
import os
from guardian import GuardSystem
from guardian.archive import SystemArchiveGit
......
#!/bin/bash
. $(dirname $0)/../lib/test-local.sh
export EPICS_CAS_INTF_ADDR_LIST=localhost
export EPICS_CAS_SERVER_PORT=${PORT:=58901}
exec python -u -m guardian "$@"
exec $PYTHON -u -m guardian "$@"
#!/bin/bash
. $(dirname $0)/../lib/test-local.sh
export EPICS_CAS_INTF_ADDR_LIST=localhost
export EPICS_CAS_SERVER_PORT=${PORT:=58900}
exec $(dirname $0)/testioc.py "$@"
exec $PYTHON $(dirname $0)/testioc.py "$@"
#!/usr/bin/env python
import sys
import pcaspy
from pprint import pprint
......
......@@ -7,13 +7,13 @@ test_description='system imports'
################################################################
genout() {
python - <<EOF | sed -e "s|$GUARD_MODULE_PATH|MOD_PATH|" -e "s|$TMP_DIRECTORY|TMP_PATH|"
$PYTHON - <<EOF | sed -e "s|$GUARD_MODULE_PATH|MOD_PATH|" -e "s|$TMP_DIRECTORY|TMP_PATH|"
import guardian
sys = guardian.GuardSystem('./module.py')
sys.load()
print sys.path
print(sys.path)
for code in sorted(sys.usercode):
print code
print(code)
EOF
}
......
......@@ -104,9 +104,6 @@ do
with_dashes=t; shift ;;
--no-color)
color=; shift ;;
--no-python)
# noop now...
shift ;;
--va|--val|--valg|--valgr|--valgri|--valgrin|--valgrind)
valgrind=t; verbose=t; shift ;;
--tee)
......@@ -304,8 +301,8 @@ test_expect_equal_file ()
# canonicalized before diff'ing. If an argument cannot be parsed, it
# is used unchanged so that there's something to diff against.
test_expect_equal_json () {
output=$(echo "$1" | python -mjson.tool || echo "$1")
expected=$(echo "$2" | python -mjson.tool || echo "$2")
output=$(echo "$1" | python3 -mjson.tool || echo "$1")
expected=$(echo "$2" | python3 -mjson.tool || echo "$2")
shift 2
test_expect_equal "$output" "$expected" "$@"
}
......@@ -654,7 +651,7 @@ test_done () {
test_python() {
(echo "import sys; _orig_stdout=sys.stdout; sys.stdout=open('OUTPUT', 'w')"; cat) \
| python -
| python3 -
}
test_reset_state_ () {
......
# declare prerequisites for external binaries used in tests
# test_declare_external_prereq python
# test_declare_external_prereq python2
if [ -z "$TEST_DIRECTORY" ] ; then
TEST_DIRECTORY=$(cd $(dirname $0)/.. && pwd)
......@@ -10,6 +9,7 @@ export SRC_DIRECTORY=$(cd "$TEST_DIRECTORY"/.. && pwd)
export TEST_BIN=$(cd "$TEST_DIRECTORY"/bin && pwd)
export PATH="$TEST_BIN":"$SRC_DIRECTORY"/bin:/usr/bin:/bin
export PYTHONPATH="$SRC_DIRECTORY"/lib:$PYTHONPATH
export PYTHON=python3
export EPICS_CA_ADDR_LIST='localhost:58900 localhost:58901 localhost:58902 localhost:58903 localhost:58904'
export EPICS_CA_AUTO_ADDR_LIST=NO
......@@ -23,7 +23,7 @@ export EZCA_TIMEOUT=1
################################################################
guardutil() {
exec python -u -m guardian.guardutil "$@"
exec $PYTHON -u -m guardian.guardutil "$@"
}
export guardutil
......@@ -73,7 +73,7 @@ node_dump_state() {
}
node_git_hex() {
python -c "print hex($1)[2:].zfill(7)"
$PYTHON -c "print(hex($1)[2:].zfill(7))"
}
kill_jobs() {
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment