aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2018-05-07 22:10:18 -0700
committerBryan Newbold <bnewbold@archive.org>2018-05-07 22:11:18 -0700
commit81d2f6290fff487f0f49b109227443c0f8a7aedb (patch)
tree22ee06f629dab625b26a69ac0ab3a1973c5cb5db
parentee6ce29e7987f936536a0ef128d3a96cc1df3d86 (diff)
downloadsandcrawler-81d2f6290fff487f0f49b109227443c0f8a7aedb.tar.gz
sandcrawler-81d2f6290fff487f0f49b109227443c0f8a7aedb.zip
improve pig helper
-rw-r--r--pig/tests/pighelper.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/pig/tests/pighelper.py b/pig/tests/pighelper.py
index d0d89d2..4aa4259 100644
--- a/pig/tests/pighelper.py
+++ b/pig/tests/pighelper.py
@@ -36,7 +36,8 @@ class PigTestHelper(unittest.TestCase):
self._tmpdir = tempfile.mkdtemp()
def tearDown(self):
- shutil.rmtree(self._tmpdir)
+ pass
+ # XXX: shutil.rmtree(self._tmpdir)
def run_pig_raw(self, params):
"""Low-level variant with params appended directly. Returns
@@ -67,7 +68,14 @@ class PigTestHelper(unittest.TestCase):
'-p', 'INPUT={}'.format(in_file),
'-p', 'OUTPUT={}'.format(out_file),
] + pargs
- self.run_pig_raw(params)
- return out_file
+ status = self.run_pig_raw(params)
+ assert status.returncode == 0
+ # Capture all the part-r-* files
+ print("out_file: {}".format(out_file))
+ subprocess.run("/bin/ls -la {}/part-*".format(out_file), shell=True)
+ sub = subprocess.run("/bin/cat {}/part-*".format(out_file), stdout=subprocess.PIPE, shell=True)
+ out = sub.stdout.decode('utf-8')
+ print(out)
+ return out
# TODO: helper to verify that output matches an expected file