Skip to content

Commit

Permalink
Merge pull request #14012 from jmchilton/test_api_under_ci
Browse files Browse the repository at this point in the history
  • Loading branch information
nsoranzo authored Jun 9, 2022
2 parents 3144d37 + 1cb4135 commit 7b3b40f
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 13 deletions.
4 changes: 0 additions & 4 deletions lib/galaxy_test/base/api_asserts.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ def assert_error_code_is(response: Union[Response, dict], error_code: Union[int,
Galaxy error codes can be imported from :py:mod:`galaxy.exceptions.error_codes`
to test against.
>>> from galaxy.exceptions import error_codes
>>> response = {"err_code": 400007}
>>> assert_error_code_is(response, error_codes.USER_REQUEST_MISSING_PARAMETER)
"""
as_dict = _as_dict(response)
assert_has_keys(as_dict, "err_code")
Expand Down
4 changes: 0 additions & 4 deletions lib/galaxy_test/driver/driver_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,10 +537,6 @@ def attempt_port(port):


def attempt_ports(port=None, set_galaxy_web_port=True):
"""
>>> port = int(attempt_ports())
>>> assert port >= 8000 and port <= 10000
"""
if port is not None:
if not attempt_port(port):
raise Exception(f"An existing process seems bound to specified test server port [{port}]")
Expand Down
8 changes: 5 additions & 3 deletions packages/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ PACKAGE_DIRS=(
webapps
test_base
test_driver
test_api
)
for ((i=0; i<${#PACKAGE_DIRS[@]}; i++)); do
printf "\n========= TESTING PACKAGE ${PACKAGE_DIRS[$i]} =========\n\n"
Expand All @@ -53,9 +54,10 @@ for ((i=0; i<${#PACKAGE_DIRS[@]}; i++)); do
pip install -r test-requirements.txt

# Prevent execution of alembic/env.py at test collection stage (alembic.context not set)
# Also ignore ToolShed functional tests.
unit_extra='--doctest-modules --ignore galaxy/model/migrations/alembic/ --ignore=tool_shed/test/'
pytest $unit_extra .
# Also ignore functional tests (galaxy_test/ and tool_shed/test/).
unit_extra='--doctest-modules --ignore=galaxy/model/migrations/alembic/ --ignore=galaxy_test/ --ignore=tool_shed/test/'
# Ignore exit code 5 (no tests ran)
pytest $unit_extra . || test $? -eq 5
make mypy
cd ..
done
7 changes: 7 additions & 0 deletions packages/test_api/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
galaxy-test-base
pytest
python-dateutil
requests
pytest
python-dateutil
requests
tuspy
3 changes: 3 additions & 0 deletions packages/test_api/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ def get_var(var_name):
package_dir=PACKAGE_DIR,
include_package_data=True,
install_requires=requirements,
extras_require={
"driver": ["galaxy-test-driver"],
},
license="AFL",
zip_safe=False,
keywords="galaxy",
Expand Down
1 change: 1 addition & 0 deletions packages/test_base/tests/test_base
1 change: 1 addition & 0 deletions packages/test_driver/tests/test_driver
3 changes: 1 addition & 2 deletions packages/test_selenium/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
galaxy-selenium
galaxy-test-base


3 changes: 3 additions & 0 deletions packages/test_selenium/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ def get_var(var_name):
package_dir=PACKAGE_DIR,
include_package_data=True,
install_requires=requirements,
extras_require={
"driver": ["galaxy-test-driver"],
},
license="AFL",
zip_safe=False,
keywords="galaxy",
Expand Down
7 changes: 7 additions & 0 deletions test/unit/test_base/test_api_asserts.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from galaxy.exceptions import error_codes
from galaxy_test.base.api_asserts import assert_error_code_is


def test_assert_error_code_is():
response = {"err_code": 400007}
assert_error_code_is(response, error_codes.error_codes_by_name["USER_REQUEST_MISSING_PARAMETER"])
6 changes: 6 additions & 0 deletions test/unit/test_driver/test_driver_util.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from galaxy_test.driver.driver_util import attempt_ports


def test_attempt_ports():
port = int(attempt_ports())
assert port >= 8000 and port <= 10000

0 comments on commit 7b3b40f

Please sign in to comment.