From 1c796ccec49ab34936889a794925fce5f44c2a74 Mon Sep 17 00:00:00 2001 From: Peter Balland Date: Tue, 13 Aug 2013 14:12:38 -0700 Subject: [PATCH] Add test wrapper to work around PYTHONPATH Change-Id: I39df23800a583aa09ade7c8e544257fe602fc669 --- README | 2 +- scripts/run_tests | 20 ++++++++++++++++++++ src/policy/tests/test_compiler.py | 2 ++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100755 scripts/run_tests diff --git a/README b/README index 89877e912..1ed91b14f 100644 --- a/README +++ b/README @@ -15,5 +15,5 @@ Copyright (c) 2013 VMware, Inc. All rights reserved. 3. Run the unit tests - from the root directory - nosetests + ./scripts/run_tests diff --git a/scripts/run_tests b/scripts/run_tests new file mode 100755 index 000000000..c56f11676 --- /dev/null +++ b/scripts/run_tests @@ -0,0 +1,20 @@ +#!/bin/sh +# Copyright (c) 2013 VMware, Inc. All rights reserved. +# + +# Usage: run_tests + +# TODO(pjb): Run from a build (rather than source) dir +SRCSCRIPT=`readlink -f $0` +SCRIPTDIR=`dirname $SRCSCRIPT` +ROOTDIR=`dirname $SCRIPTDIR` + +PYSRCDIR=$ROOTDIR/src +THIRDPARTYDIR=$ROOTDIR/thirdparty + +export PYTHONPATH=$SRCDIR:$THIRDPARTYDIR + +# Use nosetests to find all unitests in tree +ARGS="$@" +cd $ROOTDIR +nosetests $ARGS diff --git a/src/policy/tests/test_compiler.py b/src/policy/tests/test_compiler.py index fa01b0f41..4293d8244 100644 --- a/src/policy/tests/test_compiler.py +++ b/src/policy/tests/test_compiler.py @@ -3,6 +3,8 @@ import unittest +from policy import CongressParser + class TestCompiler(unittest.TestCase):