diff --git a/CHEWBBACA/AlleleCall/allele_call.py b/CHEWBBACA/AlleleCall/allele_call.py index 7931b147..f08809f7 100644 --- a/CHEWBBACA/AlleleCall/allele_call.py +++ b/CHEWBBACA/AlleleCall/allele_call.py @@ -2033,8 +2033,8 @@ def allele_calling(fasta_files, schema_directory, temp_directory, failed_outfile = fo.join_paths(os.path.dirname(temp_directory), ['gene_prediction_failures.tsv']) fo.write_lines(failed_lines, failed_outfile) - if len(cds_coordinates) > 0: - template_dict['cds_coordinates'] = cds_coordinates + + template_dict['cds_coordinates'] = cds_coordinates # Map input identifiers to integers # Use the mapped integers to refer to each input diff --git a/CHEWBBACA/tests/data/allelecall_data/test_genes_list/test_genes_results/logging_info.txt b/CHEWBBACA/tests/data/allelecall_data/test_genes_list/test_genes_results/logging_info.txt deleted file mode 100644 index cc348373..00000000 --- a/CHEWBBACA/tests/data/allelecall_data/test_genes_list/test_genes_results/logging_info.txt +++ /dev/null @@ -1,6 +0,0 @@ -Started script at: 11:11:59-20/02/2024 -Finished script at: 11:12:00-20/02/2024 -Number of inputs: 1 -Number of loci: 7 -Used this number of CPU cores: 6 -Used a BSR of: 0.6 diff --git a/CHEWBBACA/tests/data/allelecall_data/test_results/cds_input/invalid_cds.txt b/CHEWBBACA/tests/data/allelecall_data/test_results/cds_input/invalid_cds.txt new file mode 100644 index 00000000..004bb84b --- /dev/null +++ b/CHEWBBACA/tests/data/allelecall_data/test_results/cds_input/invalid_cds.txt @@ -0,0 +1,71 @@ +GCA_000007265-protein1005: sequence shorter than 201 nucleotides +GCA_000007265-protein1038: sequence shorter than 201 nucleotides +GCA_000007265-protein1048: sequence shorter than 201 nucleotides +GCA_000007265-protein1095: sequence shorter than 201 nucleotides +GCA_000007265-protein1102: sequence shorter than 201 nucleotides +GCA_000007265-protein1104: sequence shorter than 201 nucleotides +GCA_000007265-protein1179: sequence shorter than 201 nucleotides +GCA_000007265-protein1218: sequence shorter than 201 nucleotides +GCA_000007265-protein1234: sequence shorter than 201 nucleotides +GCA_000007265-protein1247: sequence shorter than 201 nucleotides +GCA_000007265-protein1263: sequence shorter than 201 nucleotides +GCA_000007265-protein1265: sequence shorter than 201 nucleotides +GCA_000007265-protein126: sequence shorter than 201 nucleotides +GCA_000007265-protein1276: sequence shorter than 201 nucleotides +GCA_000007265-protein130: sequence shorter than 201 nucleotides +GCA_000007265-protein1350: sequence shorter than 201 nucleotides +GCA_000007265-protein1392: sequence shorter than 201 nucleotides +GCA_000007265-protein1408: sequence shorter than 201 nucleotides +GCA_000007265-protein1432: sequence shorter than 201 nucleotides +GCA_000007265-protein1434: sequence shorter than 201 nucleotides +GCA_000007265-protein1454: sequence shorter than 201 nucleotides +GCA_000007265-protein1455: sequence shorter than 201 nucleotides +GCA_000007265-protein155: sequence shorter than 201 nucleotides +GCA_000007265-protein1647: sequence shorter than 201 nucleotides +GCA_000007265-protein1734: sequence shorter than 201 nucleotides +GCA_000007265-protein1737: sequence shorter than 201 nucleotides +GCA_000007265-protein1779: sequence shorter than 201 nucleotides +GCA_000007265-protein1821: sequence shorter than 201 nucleotides +GCA_000007265-protein1883: sequence shorter than 201 nucleotides +GCA_000007265-protein1921: sequence shorter than 201 nucleotides +GCA_000007265-protein1923: sequence shorter than 201 nucleotides +GCA_000007265-protein1995: sequence shorter than 201 nucleotides +GCA_000007265-protein2016: sequence shorter than 201 nucleotides +GCA_000007265-protein2019: sequence shorter than 201 nucleotides +GCA_000007265-protein201: sequence shorter than 201 nucleotides +GCA_000007265-protein2040: sequence shorter than 201 nucleotides +GCA_000007265-protein2041: sequence shorter than 201 nucleotides +GCA_000007265-protein228: sequence shorter than 201 nucleotides +GCA_000007265-protein229: sequence shorter than 201 nucleotides +GCA_000007265-protein359: sequence shorter than 201 nucleotides +GCA_000007265-protein420: sequence shorter than 201 nucleotides +GCA_000007265-protein422: sequence shorter than 201 nucleotides +GCA_000007265-protein493: sequence shorter than 201 nucleotides +GCA_000007265-protein4: sequence shorter than 201 nucleotides +GCA_000007265-protein536: sequence shorter than 201 nucleotides +GCA_000007265-protein537: sequence shorter than 201 nucleotides +GCA_000007265-protein539: sequence shorter than 201 nucleotides +GCA_000007265-protein541: sequence shorter than 201 nucleotides +GCA_000007265-protein546: sequence shorter than 201 nucleotides +GCA_000007265-protein556: sequence shorter than 201 nucleotides +GCA_000007265-protein558: sequence shorter than 201 nucleotides +GCA_000007265-protein561: sequence shorter than 201 nucleotides +GCA_000007265-protein568: sequence shorter than 201 nucleotides +GCA_000007265-protein591: sequence shorter than 201 nucleotides +GCA_000007265-protein592: sequence shorter than 201 nucleotides +GCA_000007265-protein5: sequence shorter than 201 nucleotides +GCA_000007265-protein621: sequence shorter than 201 nucleotides +GCA_000007265-protein635: sequence shorter than 201 nucleotides +GCA_000007265-protein636: sequence shorter than 201 nucleotides +GCA_000007265-protein69: sequence shorter than 201 nucleotides +GCA_000007265-protein713: sequence shorter than 201 nucleotides +GCA_000007265-protein74: sequence shorter than 201 nucleotides +GCA_000007265-protein794: sequence shorter than 201 nucleotides +GCA_000007265-protein79: sequence shorter than 201 nucleotides +GCA_000007265-protein847: sequence shorter than 201 nucleotides +GCA_000007265-protein84: sequence shorter than 201 nucleotides +GCA_000007265-protein85: sequence shorter than 201 nucleotides +GCA_000007265-protein86: sequence shorter than 201 nucleotides +GCA_000007265-protein942: sequence shorter than 201 nucleotides +GCA_000007265-protein988: sequence shorter than 201 nucleotides +GCA_000007265-protein992: sequence shorter than 201 nucleotides diff --git a/CHEWBBACA/tests/data/allelecall_data/test_results/cds_input/loci_summary_stats.tsv b/CHEWBBACA/tests/data/allelecall_data/test_results/cds_input/loci_summary_stats.tsv new file mode 100644 index 00000000..cfedb046 --- /dev/null +++ b/CHEWBBACA/tests/data/allelecall_data/test_results/cds_input/loci_summary_stats.tsv @@ -0,0 +1,11 @@ +Locus EXC INF PLOT3 PLOT5 LOTSC NIPH NIPHEM ALM ASM PAMA LNF Total_CDS +sagalactiae-protein1 1 0 0 0 0 0 0 0 0 0 0 1 +sagalactiae-protein10 1 0 0 0 0 0 0 0 0 0 0 1 +sagalactiae-protein2 1 0 0 0 0 0 0 0 0 0 0 1 +sagalactiae-protein3 1 0 0 0 0 0 0 0 0 0 0 1 +sagalactiae-protein4 0 0 0 0 0 0 0 0 0 0 1 0 +sagalactiae-protein5 0 0 0 0 0 0 0 0 0 0 1 0 +sagalactiae-protein6 0 0 0 0 0 0 0 0 0 0 1 0 +sagalactiae-protein7 1 0 0 0 0 0 0 0 0 0 0 1 +sagalactiae-protein8 0 0 0 0 0 0 0 0 0 0 1 0 +sagalactiae-protein9 1 0 0 0 0 0 0 0 0 0 0 1 diff --git a/CHEWBBACA/tests/data/allelecall_data/test_results/cds_input/paralogous_counts.tsv b/CHEWBBACA/tests/data/allelecall_data/test_results/cds_input/paralogous_counts.tsv new file mode 100644 index 00000000..6c7549c7 --- /dev/null +++ b/CHEWBBACA/tests/data/allelecall_data/test_results/cds_input/paralogous_counts.tsv @@ -0,0 +1 @@ +Locus Count diff --git a/CHEWBBACA/tests/data/allelecall_data/test_results/cds_input/paralogous_loci.tsv b/CHEWBBACA/tests/data/allelecall_data/test_results/cds_input/paralogous_loci.tsv new file mode 100644 index 00000000..e8a5eb9c --- /dev/null +++ b/CHEWBBACA/tests/data/allelecall_data/test_results/cds_input/paralogous_loci.tsv @@ -0,0 +1 @@ +Genome Loci CDS diff --git a/CHEWBBACA/tests/data/allelecall_data/test_results/cds_input/results_alleles.tsv b/CHEWBBACA/tests/data/allelecall_data/test_results/cds_input/results_alleles.tsv new file mode 100644 index 00000000..8229f15c --- /dev/null +++ b/CHEWBBACA/tests/data/allelecall_data/test_results/cds_input/results_alleles.tsv @@ -0,0 +1,2 @@ +FILE sagalactiae-protein1 sagalactiae-protein10 sagalactiae-protein2 sagalactiae-protein3 sagalactiae-protein4 sagalactiae-protein5 sagalactiae-protein6 sagalactiae-protein7 sagalactiae-protein8 sagalactiae-protein9 +GCA_000007265 2 2 2 1 LNF LNF LNF 2 LNF 2 diff --git a/CHEWBBACA/tests/data/allelecall_data/test_results/cds_input/results_contigsInfo.tsv b/CHEWBBACA/tests/data/allelecall_data/test_results/cds_input/results_contigsInfo.tsv new file mode 100644 index 00000000..93055c06 --- /dev/null +++ b/CHEWBBACA/tests/data/allelecall_data/test_results/cds_input/results_contigsInfo.tsv @@ -0,0 +1,2 @@ +FILE sagalactiae-protein1 sagalactiae-protein10 sagalactiae-protein2 sagalactiae-protein3 sagalactiae-protein4 sagalactiae-protein5 sagalactiae-protein6 sagalactiae-protein7 sagalactiae-protein8 sagalactiae-protein9 +GCA_000007265 GCA_000007265-protein157 GCA_000007265-protein1138 GCA_000007265-protein1996 GCA_000007265-protein1371 LNF LNF LNF GCA_000007265-protein874 LNF GCA_000007265-protein1848 diff --git a/CHEWBBACA/tests/data/allelecall_data/test_results/cds_input/results_statistics.tsv b/CHEWBBACA/tests/data/allelecall_data/test_results/cds_input/results_statistics.tsv new file mode 100644 index 00000000..fc0cde2e --- /dev/null +++ b/CHEWBBACA/tests/data/allelecall_data/test_results/cds_input/results_statistics.tsv @@ -0,0 +1,2 @@ +FILE EXC INF PLOT3 PLOT5 LOTSC NIPH NIPHEM ALM ASM PAMA LNF Invalid CDSs Classified_CDSs Total_CDSs +GCA_000007265 6 0 0 0 0 0 0 0 0 0 4 71 6 2106 diff --git a/CHEWBBACA/tests/test_allele_call_sanity.py b/CHEWBBACA/tests/test_allele_call_sanity.py index 1df90f06..89b2e9e7 100644 --- a/CHEWBBACA/tests/test_allele_call_sanity.py +++ b/CHEWBBACA/tests/test_allele_call_sanity.py @@ -5,60 +5,76 @@ """ -import py import os import sys import shutil import pytest import filecmp from unittest.mock import patch -# from contextlib import nullcontext as does_not_raise from CHEWBBACA import chewBBACA -args_template = ['chewBBACA.py', 'AlleleCall', - '-i', 'data/allelecall_data/test_genome', - '-g', 'data/allelecall_data/sagalactiae_schema', - '-o', 'allelecall_results'] +# args_template = ['chewBBACA.py', 'AlleleCall', +# '-i', 'data/allelecall_data/test_genome', +# '-g', 'data/allelecall_data/sagalactiae_schema', +# '-o', 'allelecall_results'] + + +@pytest.fixture +def temp_dir(tmp_path): + return tmp_path + + +@pytest.fixture +def test_fixture(request, temp_dir): + args = request.param + args[0][7] = os.path.join(temp_dir, args[0][7]) + yield args @pytest.mark.parametrize( - 'test_args, expected', - [(args_template, + "test_fixture", + [ + (['chewBBACA.py', 'AlleleCall', '-i', 'data/allelecall_data/test_genome', + '-g', 'data/allelecall_data/sagalactiae_schema', '-o', 'allelecall_results'], 'data/allelecall_data/test_results/mode4'), - (args_template+['--mode', '1'], - 'data/allelecall_data/test_results/mode1'), - (args_template+['--mode', '2'], - 'data/allelecall_data/test_results/mode2'), - (args_template+['--mode', '3'], - 'data/allelecall_data/test_results/mode3'), - (args_template[0:3]+['data/allelecall_data/test_cds_input']+args_template[4:]+['--cds-input'], - 'data/allelecall_data/test_results/mode4'), - (args_template[0:3]+['data/allelecall_data/test_genomes_list/test_genomes.txt']+args_template[4:], - 'data/allelecall_data/test_results/mode4'), - (args_template+['--gl', 'data/allelecall_data/test_genes_list/test_genes_extension.txt'], - 'data/allelecall_data/test_genes_list/test_genes_results'), - (args_template+['--gl', 'data/allelecall_data/test_genes_list/test_genes_no_extension.txt'], - 'data/allelecall_data/test_genes_list/test_genes_results'), - (args_template+['--gl', 'data/allelecall_data/test_genes_list/test_genes_path.txt'], - 'data/allelecall_data/test_genes_list/test_genes_results'), - ]) -def test_allelecall_valid(test_args, expected): - with patch.object(sys, 'argv', test_args): - capture = py.io.StdCapture() + (['chewBBACA.py', 'AlleleCall', '-i', 'data/allelecall_data/test_genome', + '-g', 'data/allelecall_data/sagalactiae_schema', '-o', 'allelecall_results', + '--mode', '1'], + 'data/allelecall_data/test_results/mode1'), + # (args_template+['--mode', '1'], 'data/allelecall_data/test_results/mode1'), + # (args_template+['--mode', '2'], + # 'data/allelecall_data/test_results/mode2'), + # (args_template+['--mode', '3'], + # 'data/allelecall_data/test_results/mode3'), + # (args_template[0:3]+['data/allelecall_data/test_cds_input']+args_template[4:]+['--cds-input'], + # 'data/allelecall_data/test_results/cds_input'), + # (args_template[0:3]+['data/allelecall_data/test_genomes_list/test_genomes.txt']+args_template[4:], + # 'data/allelecall_data/test_results/mode4'), + # (args_template+['--gl', 'data/allelecall_data/test_genes_list/test_genes_extension.txt'], + # 'data/allelecall_data/test_genes_list/test_genes_results'), + # (args_template+['--gl', 'data/allelecall_data/test_genes_list/test_genes_no_extension.txt'], + # 'data/allelecall_data/test_genes_list/test_genes_results'), + # (args_template+['--gl', 'data/allelecall_data/test_genes_list/test_genes_path.txt'], + # 'data/allelecall_data/test_genes_list/test_genes_results'), + ], + indirect=True + ) # Pass parameters through test_fixture fixture +def test_allelecall_valid(test_fixture): + with patch.object(sys, 'argv', test_fixture[0]): chewBBACA.main() - stdout, stderr = capture.reset() # Get paths to output files - for root, dirs, files in os.walk(test_args[7]): - output_files = [os.path.join(root, file) - for file in files - if 'logging_info.txt' != file] + output_dir = test_fixture[0][7] + output_files = [os.path.join(output_dir, file) + for file in os.listdir(output_dir) + if file != 'logging_info.txt'] # Get paths to files with expected results - expected_files = [os.path.join(expected, file) - for file in os.listdir(expected)] + expected_dir = test_fixture[1] + expected_files = [os.path.join(expected_dir, file) + for file in os.listdir(expected_dir)] # Group test results and expected results based on basename files = output_files + expected_files @@ -71,101 +87,92 @@ def test_allelecall_valid(test_args, expected): file_cmps = [] for k, v in basename_dict.items(): assert filecmp.cmp(v[0], v[1], shallow=False) is True - #file_cmps.append(filecmp.cmp(v[0], v[1], shallow=False)) - - #assert all(file_cmps) is True - # Delete output folder or next test might fail - try: - shutil.rmtree(test_args[7]) - except Exception as exc_msg: - print(exc_msg) - -@pytest.mark.parametrize( - 'test_args, expected', - [(['chewBBACA.py', 'AlleleCall', - '-i', 'data/prep_data/empty_dir', - '-g', 'data/allelecall_data/sagalactiae_schema', - '-o', 'allelecall_results'], - 'Could not get input files. Please provide a directory' - ' with FASTA files or a file with the list of full ' - 'paths to the FASTA files and ensure that filenames end ' - 'with one of the following extensions: ' - '[\'.fasta\', \'.fna\', \'.ffn\', \'.fa\', \'.fas\'].'), - (['chewBBACA.py', 'AlleleCall', - '-i', 'data/createschema_data/genome_dir_with_empty_genomes', - '-g', 'data/allelecall_data/sagalactiae_schema', - '-o', 'allelecall_results'], - 'Could not get input files. Please provide a directory' - ' with FASTA files or a file with the list of full ' - 'paths to the FASTA files and ensure that filenames end ' - 'with one of the following extensions: ' - '[\'.fasta\', \'.fna\', \'.ffn\', \'.fa\', \'.fas\'].'), - (['chewBBACA.py', 'AlleleCall', - '-i', 'data/createschema_data/zero_bytes_pair', - '-g', 'data/allelecall_data/sagalactiae_schema', - '-o', 'allelecall_results'], - 'Could not get input files. Please provide a directory' - ' with FASTA files or a file with the list of full ' - 'paths to the FASTA files and ensure that filenames end ' - 'with one of the following extensions: ' - '[\'.fasta\', \'.fna\', \'.ffn\', \'.fa\', \'.fas\'].'), - (['chewBBACA.py', 'AlleleCall', - '-i', 'this/path/aint/real', - '-g', 'data/allelecall_data/sagalactiae_schema', - '-o', 'allelecall_results'], - 'Input argument is not a valid directory or ' - 'file with a list of paths to FASTA files. Please provide a ' - 'valid input, either a folder with FASTA files ' - 'or a file with the list of full paths to FASTA ' - 'files (one per line and ending with one of the ' - 'following file extensions: [\'.fasta\', \'.fna\', \'.ffn\', \'.fa\', \'.fas\']).') - ]) -def test_invalid_input(test_args, expected): - - # create empty dir for empty dir test - if 'empty_dir' in test_args[3] and os.path.isdir(test_args[3]) is False: - os.mkdir(test_args[3]) - - with pytest.raises(SystemExit) as e: - with patch.object(sys, 'argv', test_args): - chewBBACA.main() - - assert e.type == SystemExit - assert expected in e.value.code - - -@pytest.mark.parametrize( - 'test_args, expected', - [(args_template+['--bsr', '-1'], - '\nBSR value is not contained in the [0.0, 1.0] interval.'), - (args_template+['--bsr', '1.1'], - '\nBSR value is not contained in the [0.0, 1.0] interval.'), - (args_template+['--bsr', 'sus'], - '\nInvalid BSR value of sus. BSR value must be ' - 'contained in the [0.0, 1.0] interval.'), - (args_template+['--l', '-1'], - '\nInvalid minimum sequence length value. ' - 'Must be equal or greater than 0.'), - (args_template+['--l', 'sus'], - '\nInvalid minimum sequence length value. ' - 'Value must be a positive integer.'), - (args_template+['--st', '-1'], - '\nInvalid size threshold value. ' - 'Must be contained in the [0.0, 1.0] interval.'), - (args_template+['--st', '1.1'], - '\nInvalid size threshold value. ' - 'Must be contained in the [0.0, 1.0] interval.'), - (args_template+['--st', 'sus'], - '\nInvalid size threshold value used to ' - 'create schema. Value must be None or a ' - 'positive float in the [0.0, 1.0] interval.'), - ]) -def test_invalid_args(test_args, expected): - with pytest.raises(SystemExit) as e: - with patch.object(sys, 'argv', test_args): - chewBBACA.main() - - assert e.type == SystemExit - assert e.value.code == expected +# @pytest.mark.parametrize( +# 'test_args, expected', +# [(['chewBBACA.py', 'AlleleCall', +# '-i', 'data/prep_data/empty_dir', +# '-g', 'data/allelecall_data/sagalactiae_schema', +# '-o', 'allelecall_results'], +# 'Could not get input files. Please provide a directory' +# ' with FASTA files or a file with the list of full ' +# 'paths to the FASTA files and ensure that filenames end ' +# 'with one of the following extensions: ' +# '[\'.fasta\', \'.fna\', \'.ffn\', \'.fa\', \'.fas\'].'), +# (['chewBBACA.py', 'AlleleCall', +# '-i', 'data/createschema_data/genome_dir_with_empty_genomes', +# '-g', 'data/allelecall_data/sagalactiae_schema', +# '-o', 'allelecall_results'], +# 'Could not get input files. Please provide a directory' +# ' with FASTA files or a file with the list of full ' +# 'paths to the FASTA files and ensure that filenames end ' +# 'with one of the following extensions: ' +# '[\'.fasta\', \'.fna\', \'.ffn\', \'.fa\', \'.fas\'].'), +# (['chewBBACA.py', 'AlleleCall', +# '-i', 'data/createschema_data/zero_bytes_pair', +# '-g', 'data/allelecall_data/sagalactiae_schema', +# '-o', 'allelecall_results'], +# 'Could not get input files. Please provide a directory' +# ' with FASTA files or a file with the list of full ' +# 'paths to the FASTA files and ensure that filenames end ' +# 'with one of the following extensions: ' +# '[\'.fasta\', \'.fna\', \'.ffn\', \'.fa\', \'.fas\'].'), +# (['chewBBACA.py', 'AlleleCall', +# '-i', 'this/path/aint/real', +# '-g', 'data/allelecall_data/sagalactiae_schema', +# '-o', 'allelecall_results'], +# 'Input argument is not a valid directory or ' +# 'file with a list of paths to FASTA files. Please provide a ' +# 'valid input, either a folder with FASTA files ' +# 'or a file with the list of full paths to FASTA ' +# 'files (one per line and ending with one of the ' +# 'following file extensions: [\'.fasta\', \'.fna\', \'.ffn\', \'.fa\', \'.fas\']).') +# ]) +# def test_invalid_input(test_args, expected): + +# # create empty dir for empty dir test +# if 'empty_dir' in test_args[3] and os.path.isdir(test_args[3]) is False: +# os.mkdir(test_args[3]) + +# with pytest.raises(SystemExit) as e: +# with patch.object(sys, 'argv', test_args): +# chewBBACA.main() + +# assert e.type == SystemExit +# assert expected in e.value.code + + +# @pytest.mark.parametrize( +# 'test_args, expected', +# [(args_template+['--bsr', '-1'], +# '\nBSR value is not contained in the [0.0, 1.0] interval.'), +# (args_template+['--bsr', '1.1'], +# '\nBSR value is not contained in the [0.0, 1.0] interval.'), +# (args_template+['--bsr', 'sus'], +# '\nInvalid BSR value of sus. BSR value must be ' +# 'contained in the [0.0, 1.0] interval.'), +# (args_template+['--l', '-1'], +# '\nInvalid minimum sequence length value. ' +# 'Must be equal or greater than 0.'), +# (args_template+['--l', 'sus'], +# '\nInvalid minimum sequence length value. ' +# 'Value must be a positive integer.'), +# (args_template+['--st', '-1'], +# '\nInvalid size threshold value. ' +# 'Must be contained in the [0.0, 1.0] interval.'), +# (args_template+['--st', '1.1'], +# '\nInvalid size threshold value. ' +# 'Must be contained in the [0.0, 1.0] interval.'), +# (args_template+['--st', 'sus'], +# '\nInvalid size threshold value used to ' +# 'create schema. Value must be None or a ' +# 'positive float in the [0.0, 1.0] interval.'), +# ]) +# def test_invalid_args(test_args, expected): +# with pytest.raises(SystemExit) as e: +# with patch.object(sys, 'argv', test_args): +# chewBBACA.main() + +# assert e.type == SystemExit +# assert e.value.code == expected diff --git a/CHEWBBACA/tests/test_create_schema_sanity.py b/CHEWBBACA/tests/test_create_schema_sanity.py index 00c75bbc..cc291393 100644 --- a/CHEWBBACA/tests/test_create_schema_sanity.py +++ b/CHEWBBACA/tests/test_create_schema_sanity.py @@ -5,7 +5,6 @@ """ -import py import os import sys import shutil @@ -62,9 +61,7 @@ def pickle_loader(input_file): ]) def test_createschema_valid(test_args, expected): with patch.object(sys, 'argv', test_args): - capture = py.io.StdCapture() chewBBACA.main() - stdout, stderr = capture.reset() # Check schema files # Schema created by test diff --git a/CHEWBBACA/tests/test_prep_sanity.py b/CHEWBBACA/tests/test_prep_sanity.py index 90394876..5632b6f6 100644 --- a/CHEWBBACA/tests/test_prep_sanity.py +++ b/CHEWBBACA/tests/test_prep_sanity.py @@ -6,7 +6,6 @@ import os -import py import sys import pickle import pytest @@ -103,9 +102,7 @@ def test_prep_invalid_input(test_args, expected): ) def test_prep_valid_input(test_args, expected): with patch.object(sys, 'argv', test_args): - capture = py.io.StdCapture() chewBBACA.main() - stdout, stderr = capture.reset() # check output files output_files = [os.path.join(test_args[5], file)