diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..52b7d07 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,24 @@ +name: CI + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + + - uses: mamba-org/setup-micromamba@v2 + with: + generate-run-shell: true + environment-name: ci + create-args: >- + pillow + pymol-open-source + pyopengl + pytest + requests + + - name: Test + run: python3 -m pytest -v + shell: micromamba-shell {0} diff --git a/findseq.py b/findseq.py index 07d73a5..0672c02 100644 --- a/findseq.py +++ b/findseq.py @@ -203,3 +203,12 @@ def checkParams(needle, haystack, selName, het, matchMode): print("Error: selName was not a string.") return False return True + + +def test_findseq(): + cmd.reinitialize() + cmd.fab('ACDEFG', 'm1') + cmd.fab('HIKLMN', 'm2') + cmd.do('findseq DEF, *, foundSeq') + assert cmd.count_atoms("foundSeq and m1") == 47 + assert cmd.count_atoms("foundSeq and m2") == 0 diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..7095195 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,9 @@ +[pytest] +addopts = + --ignore-glob=_* + --ignore-glob=gendocs.py + --import-mode=importlib +pythonpath = . +python_files = *.py +python_functions = test_* +norecursedirs = examples files_for_examples modules plugins