diff --git a/.ci/variables.json b/.ci/variables.json index be9e24c8c..34c74ca3e 100644 --- a/.ci/variables.json +++ b/.ci/variables.json @@ -7,6 +7,7 @@ "python_versions": { "PY38": "3.8.10", "PY39": "3.9.2", + "PY310": "3.10.0", "MIN_PY_VER": "3.8.10" } } diff --git a/Makefile b/Makefile index 0d3d8aa86..dd0651807 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,7 @@ PY_BIN = python3 PIP_WRAPPER = $(PY_BIN) -m pip export PY38 = $(shell jq -r '.python_versions.PY38' .ci/variables.json) export PY39 = $(shell jq -r '.python_versions.PY39' .ci/variables.json) +export PY310 = $(shell jq -r '.python_versions.PY310' .ci/variables.json) export PIP_VERSION = $(shell jq -r '.prerequisite_versions.PIP' .ci/variables.json) export SETUPTOOLS_VERSION = $(shell jq -r '.prerequisite_versions.SETUPTOOLS' .ci/variables.json) export WHEEL_VERSION = $(shell jq -r '.prerequisite_versions.WHEEL' .ci/variables.json) @@ -38,6 +39,7 @@ VE_MISSING_HELP = "\033[0;31mIMPORTANT\033[0m: Couldn't find $(PWD)/$(VIRTUAL_EN prereq: pyenv install --skip-existing $(PY38) pyenv install --skip-existing $(PY39) + pyenv install --skip-existing $(PY310) pyenv local $(PY38) @# Ensure all Python versions are registered for this project @ jq -r '.python_versions | [.[] | tostring] | join("\n")' .ci/variables.json > .python-version @@ -108,8 +110,10 @@ test: check-venv precommit: lint +# checks min and max python versions it: check-venv python-caches-clean tox-env-clean - . $(VENV_ACTIVATE_FILE); tox + . $(VENV_ACTIVATE_FILE); tox -e py38 + . $(VENV_ACTIVATE_FILE); tox -e py310 it38: check-venv python-caches-clean tox-env-clean . $(VENV_ACTIVATE_FILE); tox -e py38 @@ -117,6 +121,9 @@ it38: check-venv python-caches-clean tox-env-clean it39: check-venv python-caches-clean tox-env-clean . $(VENV_ACTIVATE_FILE); tox -e py39 +it310: check-venv python-caches-clean tox-env-clean + . $(VENV_ACTIVATE_FILE); tox -e py310 + check-all: lint test it benchmark: check-venv @@ -129,4 +136,4 @@ release-checks: check-venv release: check-venv release-checks clean docs it . $(VENV_ACTIVATE_FILE); ./release.sh $(release_version) $(next_version) -.PHONY: install clean nondocs-clean docs-clean python-caches-clean tox-env-clean docs serve-docs test it it38 benchmark release release-checks prereq venv-create check-env +.PHONY: install clean nondocs-clean docs-clean python-caches-clean tox-env-clean docs serve-docs test it it38 it39 it310 benchmark release release-checks prereq venv-create check-env diff --git a/it/proxy_test.py b/it/proxy_test.py index bdedc4b4f..fd9759be0 100644 --- a/it/proxy_test.py +++ b/it/proxy_test.py @@ -38,7 +38,7 @@ def http_proxy(): f"-v {config_dir}/squid.conf:/etc/squid/squid.conf " f"-p 3128:3128 datadog/squid" ) - proxy_container_id = lines[0].strip() + proxy_container_id = lines[-1].strip() proxy = HttpProxy(authenticated_url="http://testuser:testuser@127.0.0.1:3128", anonymous_url="http://127.0.0.1:3128") yield proxy process.run_subprocess(f"docker stop {proxy_container_id}") diff --git a/setup.py b/setup.py index 43eafa105..819814cf4 100644 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ def str_from_file(name): long_description = str_from_file("README.rst") # tuples of (major, minor) of supported Python versions ordered from lowest to highest -supported_python_versions = [(3, 8), (3, 9)] +supported_python_versions = [(3, 8), (3, 9), (3, 10)] ################################################################################################ # @@ -56,7 +56,7 @@ def str_from_file(name): # License: MIT "py-cpuinfo==7.0.0", # License: MIT - "tabulate==0.8.7", + "tabulate==0.8.9", # License: MIT "jsonschema==3.1.1", # License: BSD @@ -69,8 +69,8 @@ def str_from_file(name): # always use the latest version, these are certificate files... # License: MPL 2.0 "certifi", - # License: Apache 2.0 - "yappi==1.2.3", + # License: MIT + "yappi==1.3.3", # License: BSD "ijson==2.6.1", # License: Apache 2.0 @@ -92,9 +92,9 @@ def str_from_file(name): tests_require = [ "ujson", - "pytest==5.4.0", + "pytest==6.2.5", "pytest-benchmark==3.2.2", - "pytest-asyncio==0.14.0" + "pytest-asyncio==0.16.0" ] # These packages are only required when developing Rally diff --git a/tests/__init__.py b/tests/__init__.py index 82e3e8c97..cd971cc7c 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -40,7 +40,7 @@ def as_future(result=None, exception=None): :param exception: Exceptional result. :return: The corresponding future. """ - f = asyncio.Future() + f = asyncio.get_running_loop().create_future() if exception and result: raise AssertionError("Specify a result or an exception but not both") if exception: diff --git a/tests/driver/runner_test.py b/tests/driver/runner_test.py index 0a80e5f23..03a40945b 100644 --- a/tests/driver/runner_test.py +++ b/tests/driver/runner_test.py @@ -3312,7 +3312,7 @@ async def test_raw_with_timeout_and_opaqueid(self, es): class SleepTests(TestCase): @mock.patch("elasticsearch.Elasticsearch") # To avoid real sleeps in unit tests - @mock.patch("asyncio.sleep", return_value=as_future()) + @mock.patch("asyncio.sleep") @run_async async def test_missing_parameter(self, sleep, es): r = runner.Sleep() @@ -3330,7 +3330,7 @@ async def test_missing_parameter(self, sleep, es): @mock.patch("elasticsearch.Elasticsearch") # To avoid real sleeps in unit tests - @mock.patch("asyncio.sleep", return_value=as_future()) + @mock.patch("asyncio.sleep") @run_async async def test_sleep(self, sleep, es): r = runner.Sleep() @@ -3850,7 +3850,7 @@ async def test_waits_for_ongoing_indices_recovery(self, es): class ShrinkIndexTests(TestCase): @mock.patch("elasticsearch.Elasticsearch") # To avoid real sleeps in unit tests - @mock.patch("asyncio.sleep", return_value=as_future()) + @mock.patch("asyncio.sleep") @run_async async def test_shrink_index_with_shrink_node(self, sleep, es): es.indices.get.return_value = as_future({"src": {}}) @@ -3907,7 +3907,7 @@ async def test_shrink_index_with_shrink_node(self, sleep, es): @mock.patch("elasticsearch.Elasticsearch") # To avoid real sleeps in unit tests - @mock.patch("asyncio.sleep", return_value=as_future()) + @mock.patch("asyncio.sleep") @run_async async def test_shrink_index_derives_shrink_node(self, sleep, es): es.indices.get.return_value = as_future({"src": {}}) @@ -3970,7 +3970,7 @@ async def test_shrink_index_derives_shrink_node(self, sleep, es): @mock.patch("elasticsearch.Elasticsearch") # To avoid real sleeps in unit tests - @mock.patch("asyncio.sleep", return_value=as_future()) + @mock.patch("asyncio.sleep") @run_async async def test_shrink_index_pattern_with_shrink_node(self, sleep, es): es.indices.get.return_value = as_future({"src1": {}, "src2": {}, "src-2020": {}}) diff --git a/tox.ini b/tox.ini index 0bb921ebf..d3f313c1e 100644 --- a/tox.ini +++ b/tox.ini @@ -7,11 +7,12 @@ ############################################################################### [tox] envlist = - py38, py39 + py38, py39, py310 platform = linux|darwin [testenv] +deps = .[develop] passenv = HOME JAVA8_HOME