Remove redundant mock backport dependency and upgrade syntax for Python 3.8+ (#785)

* Upgrade syntax with pyupgrade --py38-plus

Signed-off-by: Hugo van Kemenade <[email protected]>

* Convert to f-strings with flynt

Signed-off-by: Hugo van Kemenade <[email protected]>

* Format with Black

Signed-off-by: Hugo van Kemenade <[email protected]>

* Remove redundant mock backport dependency

Signed-off-by: Hugo van Kemenade <[email protected]>

* isort imports

Signed-off-by: Hugo van Kemenade <[email protected]>

* Add changelog entry

Signed-off-by: Hugo van Kemenade <[email protected]>

---------

Signed-off-by: Hugo van Kemenade <[email protected]>
This commit is contained in:
Hugo van Kemenade
2024-07-20 16:19:20 -04:00
committed by GitHub
parent de96d28e45
commit 6e3f1a1194
95 changed files with 229 additions and 300 deletions
+8 -10
View File
@@ -31,8 +31,6 @@
# under the License.
from __future__ import print_function
import subprocess
import sys
from os import environ
@@ -78,10 +76,10 @@ def fetch_opensearch_repo() -> None:
# no test directory
if not exists(repo_path):
subprocess.check_call("mkdir %s" % repo_path, shell=True)
subprocess.check_call(f"mkdir {repo_path}", shell=True)
# make a new blank repository in the test directory
subprocess.check_call("cd %s && git init" % repo_path, shell=True)
subprocess.check_call(f"cd {repo_path} && git init", shell=True)
try:
# add a remote
@@ -104,7 +102,7 @@ def fetch_opensearch_repo() -> None:
# fetch the sha commit, version from info()
print("Fetching opensearch repo...")
subprocess.check_call("cd %s && git fetch origin %s" % (repo_path, sha), shell=True)
subprocess.check_call(f"cd {repo_path} && git fetch origin {sha}", shell=True)
def run_all(argv: Any = None) -> None:
@@ -136,18 +134,18 @@ def run_all(argv: Any = None) -> None:
argv = [
"pytest",
"--cov=opensearchpy",
"--junitxml=%s" % junit_xml,
f"--junitxml={junit_xml}",
"--log-level=DEBUG",
"--cache-clear",
"-vv",
"--cov-report=xml:%s" % codecov_xml,
f"--cov-report=xml:{codecov_xml}",
]
if (
"OPENSEARCHPY_GEN_HTML_COV" in environ
and environ.get("OPENSEARCHPY_GEN_HTML_COV") == "true"
):
codecov_html = join(abspath(dirname(dirname(__file__))), "junit", "html")
argv.append("--cov-report=html:%s" % codecov_html)
argv.append(f"--cov-report=html:{codecov_html}")
secured = False
if environ.get("OPENSEARCH_URL", "").startswith("https://"):
@@ -156,7 +154,7 @@ def run_all(argv: Any = None) -> None:
# check TEST_PATTERN env var for specific test to run
test_pattern = environ.get("TEST_PATTERN")
if test_pattern:
argv.append("-k %s" % test_pattern)
argv.append(f"-k {test_pattern}")
else:
ignores = [
"test_opensearchpy/test_server/",
@@ -196,7 +194,7 @@ def run_all(argv: Any = None) -> None:
)
if ignores:
argv.extend(["--ignore=%s" % ignore for ignore in ignores])
argv.extend([f"--ignore={ignore}" for ignore in ignores])
# Not in CI, run all tests specified.
else: