Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixups and Python 3.11 Environment #1658

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions apiclient/rancher_api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,21 @@ def __repr__(self):
def _get(self, path, **kwargs):
url = urljoin(self.endpoint, path)
resp = self.session.get(url, **kwargs)
print(f"{resp.request.method} {resp.request.url}")
return resp

def _post(self, path, **kwargs):
url = urljoin(self.endpoint, path)
resp = self.session.post(url, **kwargs)
print(f"{resp.request.method} {resp.request.url}")
return resp

def _put(self, path, **kwargs):
url = urljoin(self.endpoint, path)
resp = self.session.put(url, **kwargs)
print(f"{resp.request.method} {resp.request.url}")
return resp

def _delete(self, path, **kwargs):
url = urljoin(self.endpoint, path)
resp = self.session.delete(url, **kwargs)
print(f"{resp.request.method} {resp.request.url}")
return resp

def authenticate(self, user, passwd, **kwargs):
Expand Down
7 changes: 5 additions & 2 deletions apiclient/rancher_api/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,8 +810,11 @@ def delete(self, name, *, raw=False):
return self._delete(self.PATH_fmt.format(uid=name), raw=raw)

def generate_kubeconfig(self, name, *, raw=False):
params = {'action': 'generateKubeconfig'}
return self._create(f"v3/clusters/{name}", raw=raw, params=params)
return self._create(
self.PATH1_fmt.format(uid=name),
raw=raw,
params={'action': 'generateKubeconfig'}
)

def explore(self, name):
from .cluster_api import ClusterExploreAPI # circular dependency
Expand Down
3 changes: 1 addition & 2 deletions harvester_e2e_tests/fixtures/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ def __init__(self):
def _storage_net_configured(self):
code, data = self.settings.get('storage-network')

cs = data.get('status', {}).get('conditions')
if cs:
if (cs := data.get('status', {}).get('conditions')):
if 'True' == cs[-1].get('status') and 'Completed' == cs[-1].get('reason'):
return True, (code, data)
return False, (code, data)
Expand Down
3 changes: 1 addition & 2 deletions harvester_e2e_tests/integrations/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,7 @@ def test_degraded_volume(self, api_client, wait_timeout, vm_shell_from_host,
# https://github.com/harvester/harvester/issues/6425
code, data = api_client.hosts.get()
assert 200 == code, (code, data)
cluster_size = len(data['data'])
if cluster_size < 3:
if (cluster_size := len(data['data'])) < 3:
pytest.skip(
f"Degraded volumes only checked on 3+ nodes cluster, skip on {cluster_size}."
)
Expand Down
2 changes: 0 additions & 2 deletions py36_pytest.ini

This file was deleted.

9 changes: 4 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py36,py38,pep8,testenv
envlist = py38,py311,pep8,testenv
# TODO(gyee): we are not distributing the test code right now. Will need
# to revisit this once we have majority of the tests developed.
skipsdist = True
Expand All @@ -20,6 +20,9 @@ commands =
pytest -c {env:PYTEST_CONFIG:{toxinidir}/tox.ini} {posargs}
passenv = http_proxy,HTTP_PROXY,https_proxy,HTTPS_PROXY,no_proxy,NO_PROXY,PBR_VERSION

[testenv:py311]
basepython = python3.11

[testenv:pep8]
deps = flake8
commands =
Expand All @@ -31,7 +34,3 @@ max-line-length = 99
[pytest]
initial_sort = original
render_collapsed = all

[testenv:py36]
setenv =
PYTEST_CONFIG = {toxinidir}/py36_pytest.ini