Skip to content
Snippets Groups Projects
Commit b5c7cd3c authored by Amandine  PERRIN's avatar Amandine PERRIN
Browse files

adapt tests for protein_seq_functions

parent f8539c42
Branches
Tags
No related merge requests found
Pipeline #17628 passed
...@@ -7,7 +7,8 @@ Unit tests for the protein_seq_functions in pangenome module ...@@ -7,7 +7,8 @@ Unit tests for the protein_seq_functions in pangenome module
import os import os
import shutil import shutil
import genomeAPCAT.pangenome_module.protein_seq_functions as psf import PanACoTA.pangenome_module.protein_seq_functions as psf
import test.test_unit.utilities_for_tests as utiltest
import logging import logging
...@@ -31,10 +32,13 @@ def test_build_bank(): ...@@ -31,10 +32,13 @@ def test_build_bank():
outfile = psf.build_prt_bank(lstinfo, dbpath, name, spedir, quiet) outfile = psf.build_prt_bank(lstinfo, dbpath, name, spedir, quiet)
exp_file = os.path.join(PATH_EXP_FILES, "exp_EXEM.All.prt") exp_file = os.path.join(PATH_EXP_FILES, "exp_EXEM.All.prt")
exp_out = os.path.join(dbpath, name + ".All.prt") exp_out = os.path.join(dbpath, name + ".All.prt")
# Check prt bank filename
assert outfile == exp_out assert outfile == exp_out
with open(outfile, "r") as of, open(exp_file, "r") as ef: # Check content of bank created
for l1, l2 in zip(of, ef): assert utiltest.compare_order_content(exp_file, exp_out)
assert l1 == l2
# Remove tmp files
os.remove(outfile) os.remove(outfile)
...@@ -51,10 +55,7 @@ def test_build_bank_spedir(): ...@@ -51,10 +55,7 @@ def test_build_bank_spedir():
exp_file = os.path.join(PATH_EXP_FILES, "exp_EXEM.All.prt") exp_file = os.path.join(PATH_EXP_FILES, "exp_EXEM.All.prt")
exp_out = os.path.join(spedir, name + ".All.prt") exp_out = os.path.join(spedir, name + ".All.prt")
assert outfile == exp_out assert outfile == exp_out
with open(outfile, "r") as of, open(exp_file, "r") as ef: assert utiltest.compare_order_content(exp_file, exp_out)
for l1, l2 in zip(of, ef):
assert l1 == l2
shutil.rmtree(spedir)
shutil.rmtree("test_build_prt") shutil.rmtree("test_build_prt")
...@@ -94,9 +95,8 @@ def test_build_bank_noquiet(caplog): ...@@ -94,9 +95,8 @@ def test_build_bank_noquiet(caplog):
exp_file = os.path.join(PATH_EXP_FILES, "exp_EXEM.All.prt") exp_file = os.path.join(PATH_EXP_FILES, "exp_EXEM.All.prt")
exp_out = os.path.join(dbpath, name + ".All.prt") exp_out = os.path.join(dbpath, name + ".All.prt")
assert outfile == exp_out assert outfile == exp_out
with open(outfile, "r") as of, open(exp_file, "r") as ef: assert utiltest.compare_order_content(exp_file, outfile)
for l1, l2 in zip(of, ef):
assert l1 == l2
assert "Building bank with all proteins to EXEM.All.prt" in caplog.text
assert caplog.records[0].levelname == "INFO" assert caplog.records[0].levelname == "INFO"
assert ("Building bank with all proteins to "
"test/data/pangenome/test_files/example_db/Proteins/EXEM.All.prt") in caplog.text
os.remove(outfile) os.remove(outfile)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment