summaryrefslogtreecommitdiff
path: root/tools/packaging
diff options
context:
space:
mode:
authorBrian Terlson <btthalion@gmail.com>2014-10-24 14:41:40 -0700
committerBrian Terlson <btthalion@gmail.com>2014-10-24 14:41:40 -0700
commit1f2812adeb8bccabf7816e6adb26e9f9d6ce7b58 (patch)
treea729442e08ecf2e6c63b81ab990775eab8cfdeff /tools/packaging
parenteb08d871c5dc7eb037de6bd5d3f0a427b6f0402b (diff)
parent9dc29da89701c2b27eb26268ec9a096d0297f1b6 (diff)
downloadqtdeclarative-testsuites-1f2812adeb8bccabf7816e6adb26e9f9d6ce7b58.tar.gz
Merge pull request #104 from smikes/monkeyYaml-loadfix
load monkeyYaml without assuming it is on path
Diffstat (limited to 'tools/packaging')
-rw-r--r--tools/packaging/parseTestRecord.py18
-rw-r--r--tools/packaging/test/test_monkeyYaml.py18
2 files changed, 31 insertions, 5 deletions
diff --git a/tools/packaging/parseTestRecord.py b/tools/packaging/parseTestRecord.py
index 60590af00..ce4550a0a 100644
--- a/tools/packaging/parseTestRecord.py
+++ b/tools/packaging/parseTestRecord.py
@@ -16,6 +16,7 @@ import subprocess
import sys
import tempfile
import time
+import imp
# from TestCasePackagerConfig import *
@@ -115,6 +116,19 @@ def importYamlLoad():
try:
import yaml
yamlLoad = yaml.load
- except ImportError:
- import monkeyYaml
+ except:
+ monkeyYaml = loadMonkeyYaml()
yamlLoad = monkeyYaml.load
+
+def loadMonkeyYaml():
+ f = None
+ try:
+ p = os.path.dirname(os.path.realpath(__file__))
+ (f, pathname, description) = imp.find_module("monkeyYaml", [p])
+ module = imp.load_module("monkeyYaml", f, pathname, description)
+ return module
+ except:
+ raise ImportError("Cannot load monkeyYaml")
+ finally:
+ if f:
+ f.close()
diff --git a/tools/packaging/test/test_monkeyYaml.py b/tools/packaging/test/test_monkeyYaml.py
index edf7b939e..ada802356 100644
--- a/tools/packaging/test/test_monkeyYaml.py
+++ b/tools/packaging/test/test_monkeyYaml.py
@@ -7,12 +7,24 @@ import unittest
import os
import yaml
+import imp
# add parent dir to search path
import sys
-sys.path.insert(0, "..")
-
-import monkeyYaml
+#sys.path.insert(0, "..")
+
+f = None
+try:
+ (f, pathname, description) = imp.find_module("monkeyYaml", [os.path.join(os.getcwd(), "../")])
+ module = imp.load_module("monkeyYaml", f, pathname, description)
+ monkeyYaml = module
+except:
+ raise ImportError("Cannot load monkeyYaml")
+finally:
+ if f:
+ f.close()
+
+#import monkeyYaml
class TestMonkeyYAMLParsing(unittest.TestCase):