Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "neokit"]
path = neokit
url = git@github.com:nigelsmall/neokit.git
163 changes: 0 additions & 163 deletions neoget.sh

This file was deleted.

1 change: 1 addition & 0 deletions neokit
Submodule neokit added at 0f5a11
126 changes: 46 additions & 80 deletions runtests.sh
Original file line number Diff line number Diff line change
@@ -1,83 +1,39 @@
#!/usr/bin/env bash

if [[ $0 == /* ]]
then
HOME=$(dirname $0)
else
HOME=$(pwd)/$(dirname $0)
fi
cd ${HOME}

DOT_TEST=${HOME}/.test
NEOGET=${HOME}/neoget.sh
# Copyright (c) 2002-2015 "Neo Technology,"
# Network Engine for Objects in Lund AB [http://neotechnology.com]
#
# This file is part of Neo4j.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

DRIVER_HOME=$(dirname $0)

FORCE_DOWNLOAD=0
RUNNING=0

function runserverandtests {

PYTHON_VERSION=$(python --version)
NEO_VERSION=$1

echo "======================================================================"
echo "Running with ${PYTHON_VERSION} against Neo4j ${NEO_VERSION}"
echo "----------------------------------------------------------------------"

cd ${HOME}

if [ ${FORCE_DOWNLOAD} -ne 0 ]
then
rm -rf ${DOT_TEST}
fi
mkdir -p ${DOT_TEST} 2> /dev/null

pushd ${DOT_TEST} > /dev/null
tar xf $(${NEOGET} ${NEOGET_ARGS})
NEO_HOME=$(ls -1Ft | grep "/$" | head -1) # finds the newest directory relative to .test
echo "xx.bolt.enabled=true" >> ${NEO_HOME}/conf/neo4j-server.properties
${NEO_HOME}/bin/neo4j start
STATUS=$?
if [ ${STATUS} -ne 0 ]
then
exit ${STATUS}
fi
popd > /dev/null

echo -n "Testing"
coverage run -m unittest "${TESTS}"

pushd ${DOT_TEST} > /dev/null
${NEO_HOME}/bin/neo4j stop
rm -rf ${NEO_HOME}
popd > /dev/null

coverage report --show-missing

echo "======================================================================"
echo ""

}

function runtests {

PYTHON_VERSION=$(python --version)

echo "======================================================================"
echo "Running with ${PYTHON_VERSION} against running Neo4j instance"
echo "----------------------------------------------------------------------"

cd ${HOME}

echo -n "Testing"
coverage run -m unittest test

coverage report --show-missing

echo "======================================================================"
echo ""
if [ -z "${TEST}" ]
then
TEST="test"
fi

}
VERSIONS=$*
if [ "${VERSIONS}" == "" ]
then
VERSIONS="nightly"
fi

# Parse options
while getopts ":dr" OPTION
do
case ${OPTION} in
Expand All @@ -93,16 +49,26 @@ do
esac
done

TESTS=$1
if [ "${TESTS}" == "" ]
# Run tests
echo "Running tests with $(python --version)"
pip install --upgrade -r ${DRIVER_HOME}/test_requirements.txt
echo ""
TEST_RUNNER="coverage run -m unittest discover -vfs ${TEST}"
if [ ${RUNNING} -eq 1 ]
then
TESTS="test"
${TEST_RUNNER}
EXIT_STATUS=$?
else
neokit/neorun "${TEST_RUNNER}" ${VERSIONS}
EXIT_STATUS=$?
if [ ${EXIT_STATUS} -eq 0 ]
then
coverage report --show-missing
fi
fi

if [ ${RUNNING} -eq 1 ]
# Exit correctly
if [ ${EXIT_STATUS} -ne 0 ]
then
runtests
else
NEOGET_ARGS="-eax"
runserverandtests "3.0.0-M01"
exit ${EXIT_STATUS}
fi
23 changes: 0 additions & 23 deletions test/__init__.py
Original file line number Diff line number Diff line change
@@ -1,23 +0,0 @@
#!/usr/bin/env python
# -*- encoding: utf-8 -*-

# Copyright (c) 2002-2015 "Neo Technology,"
# Network Engine for Objects in Lund AB [http://neotechnology.com]
#
# This file is part of Neo4j.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from .session_test import *
from .packstream_test import *
from .typesystem_test import *
7 changes: 2 additions & 5 deletions test/packstream_test.py → test/test_packstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.


from collections import OrderedDict
from io import BytesIO
from math import pi
import struct
from unittest import main, TestCase
from unittest import TestCase

from neo4j.packstream import Packer, Unpacker, packb

Expand Down Expand Up @@ -270,7 +271,3 @@ def test_empty_struct(self):

def test_tiny_struct(self):
assert_packable((b"Z", (u"A", 1)), b"\xB2Z\x81A\x01")


if __name__ == "__main__":
main()
Loading