view env/lib/python3.9/site-packages/bioblend/_tests/pytest_galaxy_test_wrapper.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
line wrap: on
line source

#!/usr/bin/env python
"""Wrapper around pytest to execute the bioblend Galaxy test suite against fixed instance.

By default all Galaxy tests will run but a smaller subset can be executed by setting
the environment variable ``BIOBLEND_TEST_SUITE`` to ``quick``.
"""
import os
import sys

try:
    import pytest
except ImportError:
    pytest = None

DIRECTORY = os.path.abspath(os.path.dirname(__file__))
BIOBLEND_TEST_SUITE = os.environ.get("BIOBLEND_TEST_SUITE", "full")

quick_tests = [
    "TestGalaxyRoles.py",
    "TestGalaxyRoles.py",
    "TestGalaxyUsers.py",
    "TestGalaxyToolData.py",
    "TestGalaxyTools.py::TestGalaxyTools::test_get_tools",  # Test single upload command.
]


def main(args=None):
    """Entry point that delegates to pytest.main."""
    if args is None:
        args = sys.argv[1:]
    if len(args) < 2:
        if BIOBLEND_TEST_SUITE == "full":
            args.append(os.path.join(DIRECTORY))
        else:
            for quick_test in quick_tests:
                args.append(os.path.join(DIRECTORY, quick_test))
    _pytest_main(args)


def _pytest_main(args):
    if pytest is None:
        raise Exception("pytest is required to use this script.")
    sys.exit(pytest.main(args))


if __name__ == "__main__":
    main()