From 3e8e4f3cdd7842c847358c347838951155bb76b2 Mon Sep 17 00:00:00 2001 From: Patrick Li Date: Mon, 20 May 2024 11:56:17 -0400 Subject: [PATCH 1/5] test_run_pytest --- .github/workflows/run_pytests.yml | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/run_pytests.yml diff --git a/.github/workflows/run_pytests.yml b/.github/workflows/run_pytests.yml new file mode 100644 index 0000000..e492f96 --- /dev/null +++ b/.github/workflows/run_pytests.yml @@ -0,0 +1,49 @@ +################################################################################################## +# @Date: May 9th 2024 +# @Author: Patrick +# @Email: pinyuan.li@emory.edu +# @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: [ "test_workflow_main" ] + pull_request: + branches: [ "test_workflow_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/environment.yml + + - 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 \ No newline at end of file From ae4ed7e5578cd5ca39db3bec9e3133d440c9f880 Mon Sep 17 00:00:00 2001 From: Patrick Li Date: Mon, 20 May 2024 11:58:55 -0400 Subject: [PATCH 2/5] correct env path in run_pytest.yml --- .github/workflows/run_pytests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_pytests.yml b/.github/workflows/run_pytests.yml index e492f96..0a7d0d0 100644 --- a/.github/workflows/run_pytests.yml +++ b/.github/workflows/run_pytests.yml @@ -36,7 +36,7 @@ jobs: channel-priority: true - name: Create conda environment - run: conda env create -f devtools/conda-envs/environment.yml + run: conda env create -f devtools/conda-envs/doc_env.yaml - name: Activate conda environment shell: bash -l {0} From 23101a0c767f2789c191da6bd28bae543988cf95 Mon Sep 17 00:00:00 2001 From: Patrick Li Date: Mon, 20 May 2024 12:03:27 -0400 Subject: [PATCH 3/5] test --- .github/workflows/run_pytests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_pytests.yml b/.github/workflows/run_pytests.yml index 0a7d0d0..3fb2da5 100644 --- a/.github/workflows/run_pytests.yml +++ b/.github/workflows/run_pytests.yml @@ -36,7 +36,7 @@ jobs: channel-priority: true - name: Create conda environment - run: conda env create -f devtools/conda-envs/doc_env.yaml + run: conda env create -f devtools/conda-envs/test_env.yaml - name: Activate conda environment shell: bash -l {0} From 31cb631dcb8b13003a44324a2ebbb62003812b1e Mon Sep 17 00:00:00 2001 From: Patrick Li Date: Mon, 20 May 2024 12:13:01 -0400 Subject: [PATCH 4/5] fix pytest bugs --- .../tests/test_boxgen_naphthalene_water.py | 6 ++- autosolvate/tests/test_example_4.py | 51 ++++++++++--------- 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/autosolvate/tests/test_boxgen_naphthalene_water.py b/autosolvate/tests/test_boxgen_naphthalene_water.py index a3fa0ca..a5c7322 100644 --- a/autosolvate/tests/test_boxgen_naphthalene_water.py +++ b/autosolvate/tests/test_boxgen_naphthalene_water.py @@ -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 diff --git a/autosolvate/tests/test_example_4.py b/autosolvate/tests/test_example_4.py index 1c1316c..50198f9 100644 --- a/autosolvate/tests/test_example_4.py +++ b/autosolvate/tests/test_example_4.py @@ -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) From 7ff59b5e86411c0c94172437a4d4a6e164084f86 Mon Sep 17 00:00:00 2001 From: Patrick Li Date: Mon, 20 May 2024 12:18:33 -0400 Subject: [PATCH 5/5] get ready for merge --- .github/workflows/run_pytests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/run_pytests.yml b/.github/workflows/run_pytests.yml index 3fb2da5..14bbc7f 100644 --- a/.github/workflows/run_pytests.yml +++ b/.github/workflows/run_pytests.yml @@ -12,9 +12,9 @@ name: Python application on: push: - branches: [ "test_workflow_main" ] + branches: [ "main" ] pull_request: - branches: [ "test_workflow_main" ] + branches: [ "main" ] permissions: contents: read