summaryrefslogtreecommitdiff
path: root/indra/llcommon
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2011-07-15 17:20:27 -0400
committerNat Goodspeed <nat@lindenlab.com>2011-07-15 17:20:27 -0400
commit15c36ee9b39624a29303b6e0cf434c9758657ded (patch)
tree3ad55238790f4853620a1a1bf87c66091f5e5606 /indra/llcommon
parente41c4c90f0d8c935fa8e4de6a8439d00283c3206 (diff)
If we're going to need indra.base.llsd, have to munge sys.path.
And at that point, the Python logic needed to bring in the llsd module is big enough to warrant capturing it in a separate string variable common to multiple tests.
Diffstat (limited to 'indra/llcommon')
-rw-r--r--indra/llcommon/tests/llsdserialize_test.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/indra/llcommon/tests/llsdserialize_test.cpp b/indra/llcommon/tests/llsdserialize_test.cpp
index 30cc2bbc8a..a54d861680 100644
--- a/indra/llcommon/tests/llsdserialize_test.cpp
+++ b/indra/llcommon/tests/llsdserialize_test.cpp
@@ -1673,9 +1673,21 @@ namespace tut
struct TestPythonCompatible
{
- TestPythonCompatible() {}
+ TestPythonCompatible():
+ import_llsd("import os.path\n"
+ "import sys\n"
+ "sys.path.insert(0,\n"
+ " os.path.join(os.path.dirname(__file__),\n"
+ " os.pardir, os.pardir, 'lib', 'python'))\n"
+ "try:\n"
+ " from llbase import llsd\n"
+ "except ImportError:\n"
+ " from indra.base import llsd\n")
+ {}
~TestPythonCompatible() {}
+ std::string import_llsd;
+
template <typename CONTENT>
void python(const std::string& desc, const CONTENT& script, int expect=0)
{
@@ -1802,10 +1814,7 @@ namespace tut
python("read C++ notation",
lambda::_1 <<
- "try:\n"
- " from llbase import llsd\n"
- "except ImportError:\n"
- " from indra.base import llsd\n"
+ import_llsd <<
"def parse_each(iterable):\n"
" for item in iterable:\n"
" yield llsd.parse(item)\n" <<
@@ -1825,11 +1834,8 @@ namespace tut
python("write Python notation",
lambda::_1 <<
- "from __future__ import with_statement\n"
- "try:\n"
- " from llbase import llsd\n"
- "except ImportError:\n"
- " from indra.base import llsd\n"
+ "from __future__ import with_statement\n" <<
+ import_llsd <<
"DATA = [\n"
" 17,\n"
" 3.14,\n"