1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
import pbcore.io.dataset.run_split as M
import glob
import os
import pytest
@pytest.fixture(scope="module")
def script_loc(request):
'''Return the directory of the currently running test script'''
# uses .join instead of .dirname so we get a LocalPath object instead of
# a string. LocalPath.join calls normpath for us when joining the path
return request.fspath.join('..')
@pytest.mark.internal_data
def test(tmpdir, script_loc):
tmpdir.chdir()
dset = script_loc.join('data/test_dataset_run_split/filt.xml')
prefix = 'myprefix'
M.run_split_dataset(dset, prefix)
globbed_fns = glob.glob('myprefix.*.subreadset.xml')
assert len(globbed_fns) == 1
fns = [os.path.basename(fn.rstrip())
for fn in open('myprefix.fofn').readlines()]
assert globbed_fns == fns
|