def test_main(self): rpkm_file = "rpkm_test.rpkm" single_RPKM.main(tests.get_file("test_single_RPKM.count"), os.path.join(tests.get_test_dir(), rpkm_file )) true_result = ["gene flag RPKM", "ENSG1 0 5025125.62814", "ENSG2 0 0.0"] for true, test in zip(true_result, open(tests.get_file(rpkm_file))): self.assertEqual(true.strip().split(), test.strip().split())
def test_wait_for_array_pbs(self): commands = ['date', 'echo testing PBS'] job_name = 'test_qtools_submitter_wait_for_pbs' submit_sh = '%s/%s.sh' % (tests.get_test_dir(), job_name) sub = Submitter(queue_type='PBS', sh_file=submit_sh, command_list=commands, job_name=job_name, wait_for_array=['11111']) job_id = sub.write_sh(submit=True, nodes=1, ppn=16, queue='home-yeo', walltime='0:01:00') true_result_string = '''#!/bin/sh #PBS -N test_qtools_submitter_wait_for_pbs #PBS -o %s/test_qtools_submitter_wait_for_pbs.sh.out #PBS -e %s/test_qtools_submitter_wait_for_pbs.sh.err #PBS -V #PBS -l walltime=0:01:00 #PBS -l nodes=1:ppn=16 #PBS -A yeo-group #PBS -q home-yeo #PBS -W depend=afterokarray:11111 # Go to the directory from which the script was called cd $PBS_O_WORKDIR date echo testing PBS ''' % (tests.get_test_dir(), tests.get_test_dir()) true_result = true_result_string.split('\n') # with open(submit_sh) as f: # for x in f.readlines(): # print x, for true, test in zip(true_result, open(submit_sh)): self.assertEqual(true.strip().split(), test.strip().split()) # Make sure the job ID is a single (potentially multi-digit) integer self.assertRegexpMatches(job_id, '^\d+$') subprocess.Popen(["qdel", job_id], stdout=PIPE)
def test_main(self): rpkm_file = "rpkm_test.rpkm" single_RPKM.main(tests.get_file("test_single_RPKM.count"), os.path.join(tests.get_test_dir(), rpkm_file)) true_result = [ "gene flag RPKM", "ENSG1 0 5025125.62814", "ENSG2 0 0.0" ] for true, test in zip(true_result, open(tests.get_file(rpkm_file))): self.assertEqual(true.strip().split(), test.strip().split())
def test_wait_for_array_pbs(self): commands = ['date', 'echo testing PBS'] job_name = 'test_qtools_submitter_wait_for_pbs' submit_sh = '%s/%s.sh' % (tests.get_test_dir(), job_name) sub = Submitter(queue_type='PBS', sh_file= submit_sh, command_list=commands, job_name=job_name, wait_for_array=['11111']) job_id = sub.write_sh(submit=True, nodes=1, ppn=16, queue='home-yeo', walltime='0:01:00') true_result_string = '''#!/bin/sh #PBS -N test_qtools_submitter_wait_for_pbs #PBS -o %s/test_qtools_submitter_wait_for_pbs.sh.out #PBS -e %s/test_qtools_submitter_wait_for_pbs.sh.err #PBS -V #PBS -l walltime=0:01:00 #PBS -l nodes=1:ppn=16 #PBS -A yeo-group #PBS -q home-yeo #PBS -W depend=afterokarray:11111 # Go to the directory from which the script was called cd $PBS_O_WORKDIR date echo testing PBS ''' % (tests.get_test_dir(), tests.get_test_dir()) true_result = true_result_string.split('\n') # with open(submit_sh) as f: # for x in f.readlines(): # print x, for true, test in zip(true_result, open(submit_sh)): self.assertEqual(true.strip().split(), test.strip().split()) # Make sure the job ID is a single (potentially multi-digit) integer self.assertRegexpMatches(job_id, '^\d+$') subprocess.Popen(["qdel", job_id], stdout=PIPE)
"""Test jpeg module.""" import shutil from pathlib import Path from typing import Tuple from picopt.extern import ExtArgs from picopt.formats import jpeg from picopt.settings import Settings from tests import IMAGES_DIR from tests import get_test_dir __all__ = () # hides module from pydocstring TMP_ROOT = get_test_dir() JPEG_SRC = IMAGES_DIR / "test_jpg.jpg" TEST_OLD_JPEG = TMP_ROOT / "old.jpeg" TEST_NEW_JPEG = TMP_ROOT / "new.jpeg" def _setup_jpeg() -> Tuple[ExtArgs, Settings]: TMP_ROOT.mkdir(exist_ok=True) shutil.copy(JPEG_SRC, TEST_OLD_JPEG) args = ExtArgs(str(TEST_OLD_JPEG), str(TEST_NEW_JPEG)) return args, Settings() def _teardown(args: ExtArgs) -> None: if TMP_ROOT.exists(): shutil.rmtree(TMP_ROOT)
"""Test png module.""" import shutil from picopt.extern import ExtArgs from picopt.formats.png import Png from tests import IMAGES_DIR from tests import get_test_dir __all__ = () # hides module from pydocstring TMP_DIR = get_test_dir() TMP_OLD_PATH = TMP_DIR / "old.png" TEST_SRC_PATH = IMAGES_DIR / "test_png.png" TEST_SRC_PATH_16 = IMAGES_DIR / "test_png_16rgba.png" def _setup(use_16: bool = False) -> ExtArgs: if use_16: src_path = TEST_SRC_PATH_16 else: src_path = TEST_SRC_PATH TMP_DIR.mkdir(exist_ok=True) shutil.copy(src_path, TMP_OLD_PATH) args = ExtArgs(str(TMP_OLD_PATH), str(TMP_OLD_PATH)) return args def _teardown(args: ExtArgs) -> None: if TMP_DIR.exists(): shutil.rmtree(TMP_DIR)