Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fix exit code #329

Merged
merged 2 commits into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "arctic3d"
license = "Apache-2.0"
version = "0.1.0"
version = "0.4.1"
description = ""
authors = [
"Computational Structural Biology Group at Utrecht University <haddocking@gmail.com>",
Expand Down
4 changes: 3 additions & 1 deletion src/arctic3d/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,11 @@ def main(
)

# check if there's at least one interface
if Path(run_dir_path, "clustered_interfaces.out").is_file() is False:
if Path("clustered_interfaces.out").is_file() is False:
return 255

return 0


if __name__ == "__main__":
sys.exit(maincli())
37 changes: 37 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,40 @@ def test_cli_empty():
# remove folder
if exp_dir.exists():
shutil.rmtree(exp_dir)


def test_cli_full():
target_uniprot = "W5JXD7"
start_cwd = os.getcwd()
exit_code = main(
input_arg=target_uniprot,
db=None,
interface_file=None,
out_partner=None,
out_pdb=None,
pdb_to_use="3wqb",
chain_to_use=None,
run_dir=None,
interface_data=None,
pdb_data=None,
full=None,
ligand="no",
linkage_strategy=None,
threshold=None,
min_clust_size=1,
)
assert exit_code == 0
os.chdir(start_cwd)
exp_dir = Path(f"arctic3d-{target_uniprot}")
assert exp_dir.exists() is True
# Check that the log file has been created
assert Path(exp_dir, "arctic3d.log").exists()
# check content of the clustered interfaces file
assert Path(exp_dir, "clustered_interfaces.out").exists()
# check content of the clustered interfaces file
obs_content = Path(exp_dir, "clustered_interfaces.out").read_text()
exp_content = f"Cluster 1 -> Q9L5A4-3wqb-A{os.linesep}"
assert exp_content == obs_content
# remove folder
if exp_dir.exists():
shutil.rmtree(exp_dir)