diff options
author | Benjamin Schubert <bschubert15@bloomberg.net> | 2019-12-05 15:51:38 +0000 |
---|---|---|
committer | Benjamin Schubert <contact@benschubert.me> | 2020-01-13 17:32:08 +0000 |
commit | f62cb1b6369f82fd216ce09d1ebd15d4f1698d9a (patch) | |
tree | 3a75f1a11723fd80bb43141a055fe5ac6f926582 | |
parent | 0804133a0843b09825fa07f700902343996902be (diff) | |
download | buildstream-f62cb1b6369f82fd216ce09d1ebd15d4f1698d9a.tar.gz |
tox.ini: Remove external plugins tests
These tests don't do anything, as they have no plugins registered at
all.
-rw-r--r-- | .gitlab-ci.yml | 2 | ||||
-rw-r--r-- | tests/external_plugins.py | 84 | ||||
-rw-r--r-- | tox.ini | 8 |
3 files changed, 3 insertions, 91 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 002146f9b..0c5bf1e5d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,7 +29,6 @@ variables: INTEGRATION_CACHE: "${CI_PROJECT_DIR}/cache/integration-cache" PYTEST_ARGS: "--color=yes --integration -n 2" TEST_COMMAND: "tox -- ${PYTEST_ARGS}" - EXTERNAL_TESTS_COMMAND: "tox -e py35-external,py36-external,py37-external,py38-external -- ${PYTEST_ARGS}" COVERAGE_PREFIX: "${CI_JOB_NAME}." @@ -55,7 +54,6 @@ variables: # Run the tests as a simple user to test for permission issues - su buildstream -c "${TEST_COMMAND}" - - su buildstream -c "${EXTERNAL_TESTS_COMMAND}" after_script: except: diff --git a/tests/external_plugins.py b/tests/external_plugins.py deleted file mode 100644 index 9a5e04501..000000000 --- a/tests/external_plugins.py +++ /dev/null @@ -1,84 +0,0 @@ -import glob -import os -import subprocess -import sys - -import pytest - - -# An ExternalPluginRepo represents a git repository containing a plugin -# with tests that we wish to use as part of our test suite. -# -# Args: -# name (str): The name of the repository. This is used for impormational purposes -# url (str): The location from which therepository can be cloned -# ref (str): A known git ref that we wish to test against -# test_match_patterns (list[str]): A list of shell style globs which may be -# used to specify a subset of test files from the repository to run. -# These must be specified relative to the root of the repository. -class ExternalPluginRepo: - def __init__(self, name, url, ref, test_match_patterns=None): - self.name = name - self.url = url - self.ref = ref - - if test_match_patterns is None: - test_match_patterns = ["tests"] - - self._test_match_patterns = test_match_patterns - self._clone_location = None - - def clone(self, location): - self._clone_location = os.path.join(location, self.name) - subprocess.run( - ["git", "clone", "--single-branch", "--branch", self.ref, "--depth", "1", self.url, self._clone_location,], - check=True, - ) - return self._clone_location - - def install(self): - subprocess.run(["pip3", "install", self._clone_location], check=True) - - def test(self, args): - test_files = self._match_test_patterns() - return pytest.main(args + test_files) - - def _match_test_patterns(self): - match_list = [] - for pattern in self._test_match_patterns: - abs_pattern = os.path.join(self._clone_location, pattern) - print("matching pattern: ", abs_pattern) - matches = glob.glob(abs_pattern) - match_list.extend(matches) - - if not match_list: - raise ValueError("No matches found for patterns {}".format(self._test_match_patterns)) - return match_list - - -def run_repo_tests(repo, tempdir, args): - print("Cloning repo {} to {}...".format(repo.name, tempdir)) - repo.clone(tempdir) - - print("Installing {}...".format(repo.name)) - repo.install() - - print("Testing {}...".format(repo.name)) - return repo.test(args) - - -if __name__ == "__main__": - # Args: - # tmpdir: The directory in which this script will clone external - # repositories and use pytest's tmpdir. - # pytest_args: any remaining arguments to this script will be passed - # directly to it's pytest invocations - _, tmpdir, *pytest_args = sys.argv - - ALL_EXTERNAL_PLUGINS = [] - - exit_code = 0 - for plugin in ALL_EXTERNAL_PLUGINS: - exit_code = run_repo_tests(plugin, tmpdir, pytest_args) - if exit_code != 0: - sys.exit(exit_code) @@ -18,13 +18,11 @@ usedevelop = commands = # Running with coverage reporting enabled - py{35,36,37,38}-!external-!nocover: pytest --basetemp {envtmpdir} --cov=buildstream --cov-config .coveragerc {posargs} + py{35,36,37,38}-!nocover: pytest --basetemp {envtmpdir} --cov=buildstream --cov-config .coveragerc {posargs} py{35,36,37,38}-!nocover: mkdir -p .coverage-reports - external-!nocover: {envpython} {toxinidir}/tests/external_plugins.py {envtmpdir} --cov=buildstream --cov-append {posargs} - py{35,36,37,38}-!external-!nocover: mv {envtmpdir}/.coverage {toxinidir}/.coverage-reports/.coverage.{env:COVERAGE_PREFIX:}{envname} + py{35,36,37,38}-!nocover: mv {envtmpdir}/.coverage {toxinidir}/.coverage-reports/.coverage.{env:COVERAGE_PREFIX:}{envname} # Running with coverage reporting disabled - py{35,36,37,38}-!external-nocover: pytest --basetemp {envtmpdir} {posargs} - external-nocover: {envpython} {toxinidir}/tests/external_plugins.py {envtmpdir} {posargs} + py{35,36,37,38}--nocover: pytest --basetemp {envtmpdir} {posargs} deps = py{35,36,37,38}: -rrequirements/requirements.txt py{35,36,37,38}: -rrequirements/dev-requirements.txt |