Skip to content

Commit 8240bd5

Browse files
committed
Moved examples to top level
1 parent f96d53f commit 8240bd5

File tree

3 files changed

+23
-14
lines changed

3 files changed

+23
-14
lines changed

examples/__init__.py

Whitespace-only changes.

test/test_examples.py renamed to examples/test_examples.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,16 @@
2626
# end::minimal-example-import[]
2727

2828

29-
class MinimalWorkingExampleTestCase(TestCase):
29+
class FreshDatabaseTestCase(TestCase):
3030

3131
def setUp(self):
3232
session = GraphDatabase.driver("bolt://localhost").session()
3333
session.run("MATCH (n) DETACH DELETE n").close()
3434
session.close()
3535

36+
37+
class MinimalWorkingExampleTestCase(FreshDatabaseTestCase):
38+
3639
def test_minimal_working_example(self):
3740
# tag::minimal-example[]
3841
driver = GraphDatabase.driver("bolt://localhost")
@@ -49,12 +52,7 @@ def test_minimal_working_example(self):
4952
# end::minimal-example[]
5053

5154

52-
class ExamplesTestCase(TestCase):
53-
54-
def setUp(self):
55-
session = GraphDatabase.driver("bolt://localhost").session()
56-
session.run("MATCH (n) DETACH DELETE n").close()
57-
session.close()
55+
class ExamplesTestCase(FreshDatabaseTestCase):
5856

5957
def test_construct_driver(self):
6058
# tag::construct-driver[]

runtests.sh

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ echo "Running tests with $(python --version)"
6262
pip install --upgrade -r ${DRIVER_HOME}/test_requirements.txt
6363
echo ""
6464
TEST_RUNNER="coverage run -m ${UNITTEST} discover -vfs ${TEST}"
65+
EXAMPLES_RUNNER="coverage run -m ${UNITTEST} discover -vfs examples"
6566
BEHAVE_RUNNER="behave test/tck"
6667
if [ ${RUNNING} -eq 1 ]
6768
then
@@ -70,15 +71,25 @@ then
7071
else
7172
neokit/neorun ${NEORUN_OPTIONS} "${TEST_RUNNER}" ${VERSIONS}
7273
EXIT_STATUS=$?
73-
if [ ${EXIT_STATUS} -eq 0 ]
74+
if [ ${EXIT_STATUS} -ne 0 ]
7475
then
75-
coverage report --show-missing
76-
python -c 'from test.tck.configure_feature_files import *; set_up()'
77-
echo "Feature files downloaded"
78-
neokit/neorun ${NEORUN_OPTIONS} "${BEHAVE_RUNNER}" ${VERSIONS}
79-
python -c 'from test.tck.configure_feature_files import *; clean_up()'
80-
echo "Feature files removed"
76+
exit ${EXIT_STATUS}
8177
fi
78+
79+
neokit/neorun ${NEORUN_OPTIONS} "${EXAMPLES_RUNNER}" ${VERSIONS}
80+
EXIT_STATUS=$?
81+
if [ ${EXIT_STATUS} -ne 0 ]
82+
then
83+
exit ${EXIT_STATUS}
84+
fi
85+
86+
coverage report --show-missing
87+
python -c 'from test.tck.configure_feature_files import *; set_up()'
88+
echo "Feature files downloaded"
89+
neokit/neorun ${NEORUN_OPTIONS} "${BEHAVE_RUNNER}" ${VERSIONS}
90+
python -c 'from test.tck.configure_feature_files import *; clean_up()'
91+
echo "Feature files removed"
92+
8293
fi
8394

8495
# Exit correctly

0 commit comments

Comments
 (0)