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

Fix autoskip for pymol #71

Merged
merged 4 commits into from
Jun 24, 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
11 changes: 6 additions & 5 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
uses: conda-incubator/setup-miniconda@v3
with:
python-version: ${{ matrix.python-version }}
environment-file: .github/workflows/envs/environment.yml
channels: conda-forge
activate-environment: test
show-channel-urls: true
Expand All @@ -29,10 +28,13 @@ jobs:
- name: Check and Conditionally Install PyMOL
shell: bash -l {0}
run: |
PYMOL_VER=3.0.0
PYTHON_VER=${{ matrix.python-version }}
PYTHON_VER=${PYTHON_VER//./} # Remove the dot from the Python version
if mamba search -c conda-forge pymol-open-source=3.0.0 | grep -q "py${PYTHON_VER}"; then
mamba install -c conda-forge pymol-open-source=3.0.0
if mamba search -c conda-forge pymol-open-source==${PYMOL_VER} | grep -q "py${PYTHON_VER}"; then
mamba install -c conda-forge pymol-open-source==${PYMOL_VER} --file requirements/requirements-test.txt
else
mamba install -c conda-forge --file requirements/requirements-test.txt
fi
- name: Install package
shell: bash -l {0}
Expand All @@ -42,5 +44,4 @@ jobs:
shell: bash -l {0}
run: |
which python
python -m pip install pytest
pytest
python -m pytest
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repos:
- id: requirements-txt-fixer
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.2.2
rev: v0.4.10
hooks:
# Run the linter.
- id: ruff
Expand Down
1 change: 1 addition & 0 deletions requirements/requirements-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ matplotlib==3.8.4
nglview==3.1.2
numpy==1.26.4
scikit-learn==1.4.2
pytest==8.2.2
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def water_data(request):
return np.loadtxt(request.param), request.param.split("/")[-1].split(".")[0]


@pytest.fixture(autouse=True)
@pytest.fixture()
def _pymol_skip():
pytest.importorskip("pymol")

Expand Down
3 changes: 1 addition & 2 deletions tests/test_hydrogen_orientation.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Unit and regression test for the ConservedWaterSearch package.
"""
"""Unit and regression test for the ConservedWaterSearch package."""

# Import package, test suite, and other packages as needed
import numpy as np
Expand Down
3 changes: 3 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def test_read_results(water_results):
assert waterH2[0] == []


@pytest.mark.usefixtures("_pymol_skip")
def test_visualise_pymol():
# Create a temporary file using with for writing and reading
with tempfile.NamedTemporaryFile(mode="w+", suffix=".pse", delete=True) as f:
Expand All @@ -117,6 +118,7 @@ def test_visualise_pymol():
)


@pytest.mark.usefixtures("_pymol_skip")
def test_visualise_pymol2():
# Create a temporary file using with for writing and reading
with tempfile.NamedTemporaryFile(mode="w+", suffix=".pdb", delete=True) as f:
Expand All @@ -133,6 +135,7 @@ def test_visualise_pymol2():


# Visualise pymol tests
@pytest.mark.usefixtures("_pymol_skip")
@pytest.mark.parametrize(
("output_file", "align_file"),
[
Expand Down