import os
from toil.job import Job


def test_map_job(tmpdir):
    from toil_scripts.lib.jobs import map_job
    options = Job.Runner.getDefaultOptions(os.path.join(str(tmpdir), 'test_store'))
    samples = [x for x in xrange(200)]
    j = Job.wrapJobFn(map_job, _test_batch, samples, 'a', 'b', 'c', disk='1K')
    Job.Runner.startToil(j, options)


def _test_batch(job, sample, a, b, c):
    assert str(sample).isdigit()
    assert a == 'a'
    assert b == 'b'
    assert c == 'c'

@@ -28,16 +28,64 @@
 ort Job%0A
+from toil_scripts.lib import get_work_directory%0A
 %0A%0Adef te
@@ -150,16 +150,52 @@
 map_job%0A
+    work_dir = get_work_directory()%0A
     opti
@@ -246,19 +246,16 @@
 oin(
-str(tmp
+work_
 dir
-)
 , 't
@@ -267,16 +267,47 @@
 tore'))%0A
+    options.workDir = work_dir%0A
     samp

Use get_work_directory for test_map_job