File: test_dataset_run_split.py

package info (click to toggle)
python-pbcore 1.7.1%2Bgit20200430.a127b1e%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 5,404 kB
  • sloc: python: 23,243; xml: 2,504; makefile: 232; sh: 66
file content (26 lines) | stat: -rw-r--r-- 817 bytes parent folder | download | duplicates (3)
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