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

add worflow to main #51

Merged
merged 5 commits into from
Aug 9, 2024
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
49 changes: 49 additions & 0 deletions .github/workflows/run_pytests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
##################################################################################################
# @Date: May 9th 2024
# @Author: Patrick
# @Email: [email protected]
# @Description: This workflow will automatically run pytest
##################################################################################################

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Python application

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

permissions:
contents: read

jobs:
build:

runs-on: macos-latest

steps:
- uses: actions/checkout@v3

- name: Set up Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
miniconda-version: "latest"
channels: anaconda
channel-priority: true

- name: Create conda environment
run: conda env create -f devtools/conda-envs/test_env.yaml

- name: Activate conda environment
shell: bash -l {0}
run: conda activate autosolvate

- name: Install additional dependencies if needed
run: conda install --yes flake8 pytest

- name: Test with pytest
run: conda run -n autosolvate pytest
6 changes: 4 additions & 2 deletions autosolvate/tests/test_boxgen_naphthalene_water.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import autosolvate
import pytest
from . import helper_functions as hp
import os

def test_example_1(tmp_path):
autosolvate.startboxgen(["-m", "inputs/naphthalene_neutral.xyz", "-o", "neutral"])
compare_pdb, compare_inpcrd, compare_prmtop = compare_boxgen("neutral", "refs/naphthalene_water/neutral")
compare_pdb, compare_inpcrd, compare_prmtop = compare_boxgen("neutral", os.path.join(hp.get_reference_dir(), "naphthalene_water/neutral"))
assert compare_pdb
assert compare_inpcrd
assert compare_prmtop

autosolvate.startboxgen(["-m", "inputs/naphthalene_radical.xyz", "-o", "radical"])
compare_pdb, compare_inpcrd, compare_prmtop = compare_boxgen("radical", "refs/naphthalene_water/radical")
compare_pdb, compare_inpcrd, compare_prmtop = compare_boxgen("radical", os.path.join(hp.get_reference_dir(), "naphthalene_water/radical"))
assert compare_pdb
assert compare_inpcrd
assert compare_prmtop
Expand Down
51 changes: 28 additions & 23 deletions autosolvate/tests/test_example_4.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,41 @@
#--------------------------------------------------------------------------------------------------#
######################################################################################################
# test example 4: Naphthalene Radical in Chloroform: box gen: test pdb, prmtop
# author: Patrick Li (2022-10-18)
# path: autosolvate/tests/test_case4.py
#--------------------------------------------------------------------------------------------------#
import os
import pytest
import numpy as np
######################################################################################################
# @Date : May 9th 2024
# @Author : Patrick Li
# @Note : Disabled because this test case requires the gaussian to be installed
######################################################################################################

import autosolvate
from . import helper_functions as hp
# import os
# import pytest
# import numpy as np

# import autosolvate
# from . import helper_functions as hp

def test_example_4(tmpdir):
testName = "test_example_4"

# def test_example_4(tmpdir):
# testName = "test_example_4"

autosolvate.startboxgen([
"-m", hp.get_input_dir("naphthalene_radical.xyz"),
"-s", "chloroform",
"-c", "1",
"-u", "2",
"-g", "resp",
"-o", "nap_radical_chcl3",
])
# autosolvate.startboxgen([
# "-m", hp.get_input_dir("naphthalene_radical.xyz"),
# "-s", "chloroform",
# "-c", "1",
# "-u", "2",
# "-g", "resp",
# "-o", "nap_radical_chcl3",
# ])

out = "nap_radical_chcl3"
ref = hp.get_reference_dir("nap_radical_chcl3")
# out = "nap_radical_chcl3"
# ref = hp.get_reference_dir("nap_radical_chcl3")


for suffix in [".pdb", ".prmtop", ".inpcrd"]:
assert os.path.exists(out + suffix)
# for suffix in [".pdb", ".prmtop", ".inpcrd"]:
# assert os.path.exists(out + suffix)

assert hp.compare_pdb(out, ref)
assert hp.compare_inpcrd_prmtop(out, ref)
# assert hp.compare_pdb(out, ref)
# assert hp.compare_inpcrd_prmtop(out, ref)


Loading