Skip to content

Commit

Permalink
changes to TS testing CI:
Browse files Browse the repository at this point in the history
* run TS tests together with Galaxy dev tests so only run once per Python version
* fail TS tests when test TS is inaccessible, don't skip
  • Loading branch information
simonbray committed May 28, 2022
1 parent 97c961d commit 69ec3f8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 45 deletions.
39 changes: 4 additions & 35 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ jobs:
run: |
# Create a PostgreSQL database for Galaxy. The default SQLite3 database makes test fail randomly because of "database locked" error.
createdb -U postgres galaxy
# Run ToolShed tests only once per Python version
if [ "${{ matrix.galaxy_version }}" = 'dev' ]; then
export BIOBLEND_TOOLSHED_URL=https://testtoolshed.g2.bx.psu.edu/
fi
# Install Galaxy
GALAXY_DIR=galaxy-${{ matrix.galaxy_version }}
git clone --depth=1 -b ${{ matrix.galaxy_version }} https://github.com/galaxyproject/galaxy $GALAXY_DIR
Expand All @@ -114,38 +118,3 @@ jobs:
if: ${{ failure() }}
run: |
cat galaxy-${{ matrix.galaxy_version }}/*.log
test-toolshed:
if: (github.event_name != 'schedule' || github.repository_owner == 'galaxyproject') && git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep 'bioblend/toolshed'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
galaxy_version: [dev]
tox_env:
- py39
- py38
- py37
- py36
steps:
- uses: actions/checkout@v2
- name: Cache pip dir
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: pip-cache-${{ matrix.tox_env }}-${{ matrix.galaxy_version }}
- name: Calculate Python version for BioBlend from tox_env
id: get_bioblend_python_version
run: echo "::set-output name=bioblend_python_version::$(echo "${{ matrix.tox_env }}" | sed -e 's/^py\([0-9]\)\([0-9]\+\)/\1.\2/')"
- name: Set up Python for BioBlend
uses: actions/setup-python@v2
with:
python-version: ${{ steps.get_bioblend_python_version.outputs.bioblend_python_version }}
- name: Install tox
run: |
python3 -m pip install --upgrade pip setuptools
python3 -m pip install 'tox>=1.8.0' 'virtualenv>=20.0.14'
- name: Run ToolShed tests
run: |
export BIOBLEND_TOOLSHED_URL=https://testtoolshed.g2.bx.psu.edu/
tox -e ${{ matrix.tox_env }}
8 changes: 1 addition & 7 deletions bioblend/_tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@
import string
import unittest

import requests

import bioblend

NO_CLOUDMAN_MESSAGE = "CloudMan required and no CloudMan AMI configured."
NO_GALAXY_MESSAGE = "Externally configured Galaxy required, but not found. Set BIOBLEND_GALAXY_URL and BIOBLEND_GALAXY_API_KEY to run this test."
NO_TOOLSHED_MESSAGE = (
"Externally configured ToolShed required, but not found. Set BIOBLEND_TOOLSHED_URL to run this test."
)
INACCESSIBLE_TOOLSHED_MESSAGE = "Externally configured ToolShed is not accessible."
OLD_GALAXY_RELEASE = "Testing on Galaxy %s, but need %s to run this test."
MISSING_TOOL_MESSAGE = "Externally configured Galaxy instance requires tool %s to run test."

Expand All @@ -35,10 +32,7 @@ def skip_unless_toolshed():
"""
if "BIOBLEND_TOOLSHED_URL" not in os.environ:
return unittest.skip(NO_TOOLSHED_MESSAGE)
elif requests.get(os.environ["BIOBLEND_TOOLSHED_URL"]).status_code != 200:
return unittest.skip(INACCESSIBLE_TOOLSHED_MESSAGE)
else:
return lambda f: f
return lambda f: f


def skip_unless_galaxy(min_release=None):
Expand Down
3 changes: 0 additions & 3 deletions run_bioblend_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ else
fi
export BIOBLEND_GALAXY_URL=http://localhost:${GALAXY_PORT}

# Set variable for ToolShed tests
export BIOBLEND_TOOLSHED_URL=https://testtoolshed.g2.bx.psu.edu/

# Run the tests
cd "${BIOBLEND_DIR}"
set +e # don't stop the script if tox fails
Expand Down

0 comments on commit 69ec3f8

Please sign in to comment.