diff --git a/scripts/common/shell_command.py b/scripts/common/shell_command.py deleted file mode 100644 index e31389bb8..000000000 --- a/scripts/common/shell_command.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python3 -import os -import subprocess - -def run_cmd(command: str, env: dict = None, logfile: str = None) -> int: - """ - Args: - command: command to run - logfile: log file name - env: dictionary holding key-value pairs for bash environment variables - Returns: - int: The exit status of the command. Exit status codes are: - 0 -> Success - 1-255 -> Failure - """ - if logfile is None: - logfile = os.devnull - if env is None: - env = os.environ.copy() - with open( - file=logfile, - mode='w', - encoding='utf8' - ) as log: - ret = subprocess.run( - command, - shell=True, - check=True, - executable='/bin/bash', - env=env, - stdout=log if not logfile else None, - stderr=None - ) - return ret.returncode diff --git a/test/externalTests/common.sh b/scripts/externalTests/common.sh similarity index 100% rename from test/externalTests/common.sh rename to scripts/externalTests/common.sh diff --git a/test/externalTests/bleeps.sh b/test/externalTests/bleeps.sh index 22e54ac9c..939552100 100755 --- a/test/externalTests/bleeps.sh +++ b/test/externalTests/bleeps.sh @@ -22,7 +22,7 @@ set -e source scripts/common.sh -source test/externalTests/common.sh +source scripts/externalTests/common.sh REPO_ROOT=$(realpath "$(dirname "$0")/../..") diff --git a/test/externalTests/brink.sh b/test/externalTests/brink.sh index 901a0cfc0..77dd62f94 100755 --- a/test/externalTests/brink.sh +++ b/test/externalTests/brink.sh @@ -22,7 +22,7 @@ set -e source scripts/common.sh -source test/externalTests/common.sh +source scripts/externalTests/common.sh REPO_ROOT=$(realpath "$(dirname "$0")/../..") diff --git a/test/externalTests/chainlink.sh b/test/externalTests/chainlink.sh index 249a1254c..a11266c3b 100755 --- a/test/externalTests/chainlink.sh +++ b/test/externalTests/chainlink.sh @@ -22,7 +22,7 @@ set -e source scripts/common.sh -source test/externalTests/common.sh +source scripts/externalTests/common.sh REPO_ROOT=$(realpath "$(dirname "$0")/../..") diff --git a/test/externalTests/colony.sh b/test/externalTests/colony.sh index 8582411b9..402865107 100755 --- a/test/externalTests/colony.sh +++ b/test/externalTests/colony.sh @@ -22,7 +22,7 @@ set -e source scripts/common.sh -source test/externalTests/common.sh +source scripts/externalTests/common.sh REPO_ROOT=$(realpath "$(dirname "$0")/../..") diff --git a/test/externalTests/elementfi.sh b/test/externalTests/elementfi.sh index b667a4bbc..b3348e339 100755 --- a/test/externalTests/elementfi.sh +++ b/test/externalTests/elementfi.sh @@ -22,7 +22,7 @@ set -e source scripts/common.sh -source test/externalTests/common.sh +source scripts/externalTests/common.sh REPO_ROOT=$(realpath "$(dirname "$0")/../..") diff --git a/test/externalTests/ens.sh b/test/externalTests/ens.sh index 77395160d..7f713f4ab 100755 --- a/test/externalTests/ens.sh +++ b/test/externalTests/ens.sh @@ -22,7 +22,7 @@ set -e source scripts/common.sh -source test/externalTests/common.sh +source scripts/externalTests/common.sh REPO_ROOT=$(realpath "$(dirname "$0")/../..") diff --git a/test/externalTests/euler.sh b/test/externalTests/euler.sh index 78e89d147..586526124 100755 --- a/test/externalTests/euler.sh +++ b/test/externalTests/euler.sh @@ -22,7 +22,7 @@ set -e source scripts/common.sh -source test/externalTests/common.sh +source scripts/externalTests/common.sh REPO_ROOT=$(realpath "$(dirname "$0")/../..") diff --git a/test/externalTests/gnosis.sh b/test/externalTests/gnosis.sh index 00ea2597e..de0624c06 100755 --- a/test/externalTests/gnosis.sh +++ b/test/externalTests/gnosis.sh @@ -22,7 +22,7 @@ set -e source scripts/common.sh -source test/externalTests/common.sh +source scripts/externalTests/common.sh REPO_ROOT=$(realpath "$(dirname "$0")/../..") diff --git a/test/externalTests/gp2.sh b/test/externalTests/gp2.sh index 120379478..a73f1453b 100755 --- a/test/externalTests/gp2.sh +++ b/test/externalTests/gp2.sh @@ -22,7 +22,7 @@ set -e source scripts/common.sh -source test/externalTests/common.sh +source scripts/externalTests/common.sh REPO_ROOT=$(realpath "$(dirname "$0")/../..") diff --git a/test/externalTests/perpetual-pools.sh b/test/externalTests/perpetual-pools.sh index 18fb308af..70a14c499 100755 --- a/test/externalTests/perpetual-pools.sh +++ b/test/externalTests/perpetual-pools.sh @@ -22,7 +22,7 @@ set -e source scripts/common.sh -source test/externalTests/common.sh +source scripts/externalTests/common.sh REPO_ROOT=$(realpath "$(dirname "$0")/../..") diff --git a/test/externalTests/pool-together.sh b/test/externalTests/pool-together.sh index 86cd3ee68..77b3ad149 100755 --- a/test/externalTests/pool-together.sh +++ b/test/externalTests/pool-together.sh @@ -22,7 +22,7 @@ set -e source scripts/common.sh -source test/externalTests/common.sh +source scripts/externalTests/common.sh REPO_ROOT=$(realpath "$(dirname "$0")/../..") diff --git a/test/externalTests/prb-math.sh b/test/externalTests/prb-math.sh index 78a39519e..99c7c2716 100755 --- a/test/externalTests/prb-math.sh +++ b/test/externalTests/prb-math.sh @@ -22,7 +22,7 @@ set -e source scripts/common.sh -source test/externalTests/common.sh +source scripts/externalTests/common.sh REPO_ROOT=$(realpath "$(dirname "$0")/../..") diff --git a/test/externalTests/solc-js/solc-js.sh b/test/externalTests/solc-js/solc-js.sh index bf7ca8762..af325326c 100755 --- a/test/externalTests/solc-js/solc-js.sh +++ b/test/externalTests/solc-js/solc-js.sh @@ -22,7 +22,7 @@ set -e source scripts/common.sh -source test/externalTests/common.sh +source scripts/externalTests/common.sh SOLJSON="$1" VERSION="$2" diff --git a/test/externalTests/trident.sh b/test/externalTests/trident.sh index b5d48b500..f02123217 100755 --- a/test/externalTests/trident.sh +++ b/test/externalTests/trident.sh @@ -22,7 +22,7 @@ set -e source scripts/common.sh -source test/externalTests/common.sh +source scripts/externalTests/common.sh REPO_ROOT=$(realpath "$(dirname "$0")/../..") diff --git a/test/externalTests/uniswap.sh b/test/externalTests/uniswap.sh index 8b07aee84..d9a25138f 100755 --- a/test/externalTests/uniswap.sh +++ b/test/externalTests/uniswap.sh @@ -22,7 +22,7 @@ set -e source scripts/common.sh -source test/externalTests/common.sh +source scripts/externalTests/common.sh REPO_ROOT=$(realpath "$(dirname "$0")/../..") diff --git a/test/externalTests/yield-liquidator.sh b/test/externalTests/yield-liquidator.sh index a22443311..8b256d797 100755 --- a/test/externalTests/yield-liquidator.sh +++ b/test/externalTests/yield-liquidator.sh @@ -22,7 +22,7 @@ set -e source scripts/common.sh -source test/externalTests/common.sh +source scripts/externalTests/common.sh REPO_ROOT=$(realpath "$(dirname "$0")/../..") diff --git a/test/externalTests/zeppelin.sh b/test/externalTests/zeppelin.sh index 2a95fc8dd..46b3f2d89 100755 --- a/test/externalTests/zeppelin.sh +++ b/test/externalTests/zeppelin.sh @@ -27,7 +27,7 @@ set -e export NODE_OPTIONS="--max-old-space-size=4096" source scripts/common.sh -source test/externalTests/common.sh +source scripts/externalTests/common.sh REPO_ROOT=$(realpath "$(dirname "$0")/../..") diff --git a/test/external_tests.py b/test/external_tests.py index c230533a0..e25311793 100755 --- a/test/external_tests.py +++ b/test/external_tests.py @@ -23,13 +23,7 @@ from argparse import ArgumentParser, Namespace import os from pathlib import Path import sys - -# Our scripts/ is not a proper Python package so we need to modify PYTHONPATH to import from it -# pragma pylint: disable=import-error,wrong-import-position -SCRIPTS_DIR = Path(__file__).parents[1] / "scripts" -sys.path.insert(0, str(SCRIPTS_DIR)) - -from common.shell_command import run_cmd +import subprocess EXTERNAL_TESTS_DIR = Path(__file__).parent / "externalTests" @@ -39,13 +33,10 @@ class ExternalTestNotFound(Exception): def detect_external_tests() -> dict: - # TODO: Remove `file_path.stem != "common"` when we complete the migration - # of the external tests to python, since there will be no more - # common.sh script in the externalTests folder. return { file_path.stem: file_path for file_path in Path(EXTERNAL_TESTS_DIR).iterdir() - if file_path.is_file() and file_path.suffix == ".sh" and file_path.stem != "common" + if file_path.is_file() and file_path.suffix == ".sh" }