def test_export_run(): '''Test the NCBImetaExport application for run completion''' # Use the test database test_db = os.path.join(os.path.dirname(os.path.abspath(__file__)),"test.sqlite") test_output_dir = os.path.dirname(os.path.abspath(__file__)) # If the test_db doesn't alread exist, run the test cmd from test_ncbimeta if not os.path.exists(test_db): test_ncbimeta.test_ncbimeta_run() test_cmd = ("ncbimeta/NCBImetaExport.py --database " + test_db + " --outputdir " + test_output_dir) # test NCBImetaExport through a subprocess returned_value = subprocess.call(test_cmd, shell=True) # If it returns a non-zero value, it failed assert returned_value == 0
def test_annotatereplace_run(): '''Test the NCBImetaAnnotateReplace application for run completion''' # Use the test database test_db = os.path.join(os.path.dirname(os.path.abspath(__file__)),"test.sqlite") test_annotfile = os.path.join(os.path.dirname(os.path.abspath(__file__)),'test_annot.txt') # If the test_db doesn't alread exist, run the test cmd from test_ncbimeta if not os.path.exists(test_db): test_ncbimeta.test_ncbimeta_run() test_table = 'BioSample' test_cmd = ("ncbimeta/NCBImetaAnnotateReplace.py --database " + test_db + " --table " + test_table + " --annotfile " + test_annotfile) # test NCBImetaAnnotateReplace through a subprocess returned_value = subprocess.call(test_cmd, shell=True) # If it returns a non-zero value, it failed assert returned_value == 0
def test_join_run(): '''Test the NCBImetaJoin application for run completion''' # Use the test database test_db = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test.sqlite") # If the test_db doesn't alread exist, run the test cmd from test_ncbimeta if not os.path.exists(test_db): test_ncbimeta.test_ncbimeta_run() test_anchor_table = 'BioSample' test_final_table = 'Master' test_accessory_table = "\'BioProject Assembly SRA Nucleotide\'" test_unique_field = "\'BioSampleAccession BioSampleAccessionSecondary BioSampleBioProjectAccession\'" test_cmd = ("ncbimeta/NCBImetaJoin.py --database " + test_db + " --final " + test_final_table + " --anchor " + test_anchor_table + " --accessory " + test_accessory_table + " --unique " + test_unique_field) # test NCBImetaJoin through a subprocess returned_value = subprocess.call(test_cmd, shell=True) # If it returns a non-zero value, it failed assert returned_value == 0
def test_multi_match(): ''' The ability to properly concatenate multiple matches''' # Use the test database test_db = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test.sqlite") # If the test_db doesn't alread exist, run the test cmd from test_ncbimeta if not os.path.exists(test_db): test_ncbimeta.test_ncbimeta_run() test_anchor_table = 'BioProject' test_final_table = 'BioProjectNucleotide' test_accessory_table = "Nucleotide" test_unique_field = "BioProjectAccession" test_cmd = ("ncbimeta/NCBImetaJoin.py --database " + test_db + " --final " + test_final_table + " --anchor " + test_anchor_table + " --accessory " + test_accessory_table + " --unique " + test_unique_field) # test NCBImetaJoin through a subprocess returned_value = subprocess.call(test_cmd, shell=True) # If it returns a non-zero value, it failed assert returned_value == 0 #def test_join_ErrorDBNotExists():