Skip to content

Commit

Permalink
Merge pull request #1 from bcgsc/bugfix/fix-gh-workflows
Browse files Browse the repository at this point in the history
Bugfix/fix gh workflows
  • Loading branch information
elewis2 authored Jun 20, 2024
2 parents 24cb2af + b576fd7 commit a947caa
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gkb_workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.9', '3.10']

steps:
- uses: actions/checkout@v3
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
Expand All @@ -32,15 +32,15 @@ jobs:
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 ipr graphkb --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 pori_python --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Check with black
run: |
pip install black
black --check -S -l 100 ipr graphkb tests
black --check -S -l 100 pori_python tests
- name: Full Tests with pytest
run: |
pip list
pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml --cov ipr --cov-report term --cov-report xml
pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml --cov pori_python --cov-report term --cov-report xml
env:
IPR_USER: ${{ secrets.IPR_TEST_USER }}
IPR_PASS: ${{ secrets.IPR_TEST_PASSWORD }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/quick-pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v3
Expand All @@ -29,11 +29,11 @@ jobs:
run: |
pip install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 ipr graphkb --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 pori_python --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Check with black
run: |
pip install black
black --check -S -l 100 ipr graphkb tests
black --check -S -l 100 pori_python tests
- name: Short Tests with pytest
run: pytest --junitxml=junit/test-results-${{ matrix.python-version }}.xml --cov ipr --cov-report term --cov-report xml
env:
Expand Down
2 changes: 2 additions & 0 deletions pori_python/graphkb/genes.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ def get_preferred_gene_name(
return gene_names[0]


# DEVSU-2348 - relate the genes to the variants
def get_cancer_predisposition_info(
conn: GraphKBConnection, source: str = PREFERRED_GENE_SOURCE
) -> Tuple[List[str], Dict[str, str]]:
Expand Down Expand Up @@ -309,6 +310,7 @@ def get_cancer_predisposition_info(
return sorted(genes), variants


# DEVSU-2348 - relate the genes to the variants
def get_pharmacogenomic_info(
conn: GraphKBConnection, source: str = PREFERRED_GENE_SOURCE
) -> Tuple[List[str], Dict[str, str]]:
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ long_description_content_type = text/markdown

[options]
packages = find:
python_requires = >=3.7
python_requires = >=3.9
dependency_links = []
include_package_data = True
install_requires =
Expand Down
1 change: 1 addition & 0 deletions tests/test_graphkb/test_genes.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def test_cancer_genes(conn):
assert gene not in names


@pytest.mark.skip(reason="DEVSU-2348")
def test_get_pharmacogenomic_info(conn):
genes, matches = get_pharmacogenomic_info(conn)
for gene in PHARMACOGENOMIC_INITIAL_GENES:
Expand Down
1 change: 1 addition & 0 deletions tests/test_graphkb/test_graphkb.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def conn():
conn.login(os.environ["GRAPHKB_USER"], os.environ["GRAPHKB_PASS"])
return conn


class TestPaginate:
@mock.patch("pori_python.graphkb.GraphKBConnection.request")
def test_does_not_paginate_when_false(self, graphkb_request, conn):
Expand Down
6 changes: 5 additions & 1 deletion tests/test_graphkb/test_match.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@

import pori_python.graphkb
from pori_python.graphkb import GraphKBConnection, match
from pori_python.graphkb.constants import DEFAULT_NON_STRUCTURAL_VARIANT_TYPE, STRUCTURAL_VARIANT_SIZE_THRESHOLD
from pori_python.graphkb.constants import (
DEFAULT_NON_STRUCTURAL_VARIANT_TYPE,
STRUCTURAL_VARIANT_SIZE_THRESHOLD,
)
from pori_python.graphkb.util import FeatureNotFoundError

# Test datasets
Expand Down Expand Up @@ -500,6 +503,7 @@ def test_filling_cache(self):
assert "alice" in match.FEATURES_CACHE
match.FEATURES_CACHE = None


class TestTypeScreening:
# Types as class variables
default_type = DEFAULT_NON_STRUCTURAL_VARIANT_TYPE
Expand Down
3 changes: 1 addition & 2 deletions tests/test_ipr/test_annotate.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def graphkb_conn():
graphkb_conn.login(username, password)
return graphkb_conn


class TestAnnotation:
def test_annotate_nonsense_vs_missense(self, graphkb_conn):
"""Verify missense (point mutation) is not mistaken for a nonsense (stop codon) mutation."""
Expand All @@ -58,7 +59,6 @@ def test_annotate_nonsense_vs_missense(self, graphkb_conn):
assert not nonsense, f"nonsense matched to {key}: {TP53_MUT_DICT[key]}"
assert matched, f"should have matched in {key}: {TP53_MUT_DICT[key]}"


def test_annotate_nonsense_vs_missense_protein(self, graphkb_conn):
"""Verify missense (point mutation) is not mistaken for a nonsense (stop codon) mutation."""
disease = 'cancer'
Expand All @@ -69,7 +69,6 @@ def test_annotate_nonsense_vs_missense_protein(self, graphkb_conn):
assert not nonsense, f"nonsense matched to {key}: {TP53_MUT_DICT[key]}"
assert matched, f"should have matched in {key}: {TP53_MUT_DICT[key]}"


def test_annotate_structural_variants_tp53(self, graphkb_conn):
"""Verify alternate TP53 variants match."""
disease = 'cancer'
Expand Down
6 changes: 5 additions & 1 deletion tests/test_ipr/test_summary.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
from unittest.mock import MagicMock

from pori_python.ipr.summary import GRAPHKB_GUI, get_preferred_drug_representation, substitute_sentence_template
from pori_python.ipr.summary import (
GRAPHKB_GUI,
get_preferred_drug_representation,
substitute_sentence_template,
)


class TestGetPreferredDrugRepresentation:
Expand Down

0 comments on commit a947caa

Please sign in to comment.