summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoern Hees <dev@joernhees.de>2015-03-18 16:53:19 +0100
committerJoern Hees <dev@joernhees.de>2015-03-18 16:53:19 +0100
commit36335d5d178ffbcc0422b8b8ee7444893a30ed84 (patch)
tree68e7c64a560b7a8d002752a7e8f6bb12f3a5e786
parent029c7645d6e50c49576f438395e64b276737377b (diff)
downloadrdflib-36335d5d178ffbcc0422b8b8ee7444893a30ed84.tar.gz
set PYTHONPATH to make rdfpipe tests use the right rdflib version
before this fix, the invocation of rdflib/tools/rdfpipe.py from a subprocess didn't have the current version of rdflib in its path but the one from the virtualenv, which is the one installed as dependency for SPARQLWrapper!
-rw-r--r--test/test_issue375.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/test/test_issue375.py b/test/test_issue375.py
index 29726b96..17f168ba 100644
--- a/test/test_issue375.py
+++ b/test/test_issue375.py
@@ -1,4 +1,6 @@
+import os
import subprocess
+import sys
import re
rdfa_expected = u'''@prefix dc: <http://purl.org/dc/terms/> .
@@ -146,6 +148,9 @@ mdata_expected = u'''@prefix cc: <http://creativecommons.org/ns#> .
rdfa:usesVocabulary schema: .
'''.strip()
+env = os.environ.copy()
+env['PYTHONPATH'] = '.:' + env.get('PYTHONPATH', '')
+
def test_rdfpipe_bytes_vs_str():
"""
Issue 375: rdfpipe command generates bytes vs. str TypeError
@@ -155,7 +160,7 @@ def test_rdfpipe_bytes_vs_str():
rdfpipe to ensure that we get the expected results.
"""
args = ['python', 'rdflib/tools/rdfpipe.py', '-i', 'rdfa1.1', 'test/rdfa/oreilly.html']
- proc = subprocess.Popen(args, stdout=subprocess.PIPE, universal_newlines=True)
+ proc = subprocess.Popen(args, stdout=subprocess.PIPE, universal_newlines=True, env=env)
res = ''
while proc.poll() is None:
res += proc.stdout.read()
@@ -170,7 +175,7 @@ def test_rdfpipe_mdata_open():
the open() builtin instead.
"""
args = ['python', 'rdflib/tools/rdfpipe.py', '-i', 'mdata', 'test/mdata/codelab.html']
- proc = subprocess.Popen(args, stdout=subprocess.PIPE, universal_newlines=True)
+ proc = subprocess.Popen(args, stdout=subprocess.PIPE, universal_newlines=True, env=env)
res = ''
while proc.poll() is None:
res += proc.stdout.read()