def test_filename_parsing(self):
     query = RunDBQuery(self.good_runrange)
     if __hostname__.find('plus'):
         query._cmd_ = [os.path.dirname(__file__) + '/rdbt', '4']
     query.parse()
     self.assertEqual(len(query.get_files(self.good_runno)), 70)
            from subprocess import call
            # Default Gaudi option files
            gaudi_w_opts = get_gaudi_opts(stream)

            # option files and datacards
            year = query.get_time(run)[0].tm_year       # info from run DB query
            partition = query.get_run_info(run)['partitionName']
            # info for option files, time stamp is also created here
            runinfo = get_runinfo(run, year, partition, stream)
            if _cliopts.local: runinfo['protocol'] = 'file'
            prefix = 'VELODQM_{}_{}_{}'.format(run, runinfo['timestamp'], stream)
            optfiles = {
                # same as FilterBeamBeam_HeartBeat.py
                '{}/{}.useropts.py'.format(jobdir_t,prefix): get_optfile(runinfo),
                '{}/{}.data.py'.format(jobdir_t,prefix):
                get_datacard(runinfo, query.get_files(run),
                             maxevts = _cliopts.nevents)
            }
            # create them
            try:
                for optfile, contents in optfiles.items():
                    optfile = file(optfile, 'w')
                    optfile.write(contents)
                    optfile.close()
            except OSError:
                error('Exception while writing option files', exc_info=True)
                continue

            # complete command
            cmd_w_args = gaudi_w_opts + optfiles.keys() + jobopts
            debug('Job command: %s', ' '.join(cmd_w_args))