summaryrefslogtreecommitdiff
path: root/check
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-03-05 13:51:03 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2014-03-06 19:01:32 +0000
commit032aa01054fe2d3313c56adc41467e1fdd1c7571 (patch)
tree8609a8eec65244bf3fee3189c013f01b6033b337 /check
parente9e9baa045ae45bb99aecbc5850823480592e9f4 (diff)
downloadmorph-032aa01054fe2d3313c56adc41467e1fdd1c7571.tar.gz
Pass in user's PYTHONPATH to morph when run from yarns
We carefully _add_ to PYTHONPATH in ./check, if it was set by the user. However, yarn cleans the environment when it runs tests, so we tell it to add PYTHONPATH from ./check to the test environment. Additionally, we change yarns/morph.shell-lib so it doesn't override PYTHONPATH, but adds to it. All of this is necessary to get morph, when run by yarn steps, to have the right PYTHONPATH, which can be (and currently is) to allow the user to specify un-installed versions of dependencies, such as cliapp.
Diffstat (limited to 'check')
-rwxr-xr-xcheck15
1 files changed, 13 insertions, 2 deletions
diff --git a/check b/check
index c0d1683d..3aa83fe4 100755
--- a/check
+++ b/check
@@ -2,7 +2,7 @@
#
# Run test suite for morph.
#
-# Copyright (C) 2011-2013 Codethink Limited
+# Copyright (C) 2011-2014 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -71,10 +71,21 @@ fi
python setup.py clean check
# Run scenario tests with yarn, if yarn is available.
+#
+# Yarn cleans up the environment when it runs tests, and this removes
+# PYTHONPATH from the environment. However, we need our tests to have
+# the PYTHONPATH, so that we can get them to, for example, use the right
+# versions of updated dependencies. The immediate current need is to
+# be able to get them to use an updated version of cliapp, but it is
+# a general need.
+#
+# We solve this by using the yarn --env option, allowing us to tell yarn
+# explicitly which environment variables to set in addition to the set
+# it sets anyway.
if command -v yarn > /dev/null
then
- yarn -s yarns/morph.shell-lib yarns/*.yarn
+ yarn --env "PYTHONPATH=$PYTHONPATH" -s yarns/morph.shell-lib yarns/*.yarn
fi
# cmdtest tests.