mirror of
https://github.com/ubuntu/microk8s.git
synced 2021-05-23 02:23:41 +03:00
Lint (#1988)
* Fix linting and switch to tox Switched linting to tox Added codspell to tox Fixed black and codespell identified mistakes
This commit is contained in:
8
.github/workflows/check-formatting.yml
vendored
8
.github/workflows/check-formatting.yml
vendored
@@ -15,12 +15,8 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get install python3-setuptools
|
||||
sudo pip3 install black codespell flake8
|
||||
sudo apt-get install tox
|
||||
|
||||
- name: Check formatting
|
||||
run: |
|
||||
set -eux
|
||||
black --check . microk8s-resources/actions/enable.kubeflow.sh
|
||||
codespell --ignore-words-list="aks" --quiet-level=2 --skip="*.patch,*.spec"
|
||||
flake8 . microk8s-resources/actions/enable.kubeflow.sh
|
||||
tox -e lint
|
||||
|
||||
@@ -94,7 +94,7 @@ class InstallTests:
|
||||
assert "microk8s is running" in status
|
||||
|
||||
def test_get_kubeconfig(self):
|
||||
"""Test retreiving the kubeconfig"""
|
||||
"""Test retrieving the kubeconfig"""
|
||||
config = yaml.safe_load(self.node.microk8s.config)
|
||||
assert config["clusters"][0]["name"] == "microk8s-cluster"
|
||||
|
||||
@@ -104,7 +104,7 @@ class InstallTests:
|
||||
assert ready == 1
|
||||
|
||||
def test_addon(self, addon, input):
|
||||
"""Test enableing addon"""
|
||||
"""Test enabling addon"""
|
||||
addon_attr = getattr(self.node.microk8s, addon)
|
||||
if input:
|
||||
result = addon_attr.enable(input)
|
||||
|
||||
@@ -14,7 +14,7 @@ class NotFound(Exception):
|
||||
|
||||
|
||||
class RetryWrapper:
|
||||
"""Generic class for retyring method calls on an object"""
|
||||
"""Generic class for retrying method calls on an object"""
|
||||
|
||||
def __init__(self, object, exception=Exception, timeout=60):
|
||||
self.object = object
|
||||
|
||||
@@ -102,7 +102,7 @@ class Lxd(Node):
|
||||
"""Copy a file to the destination on node"""
|
||||
|
||||
src = Path(source)
|
||||
with src.open(mode='rb') as f:
|
||||
with src.open(mode="rb") as f:
|
||||
return self.write(dest, f.read())
|
||||
|
||||
def get_primary_address(self):
|
||||
|
||||
2
tox.ini
2
tox.ini
@@ -13,11 +13,13 @@ deps =
|
||||
flake8
|
||||
flake8-colors
|
||||
pep8-naming
|
||||
codespell
|
||||
-r{toxinidir}/tests/requirements.txt
|
||||
|
||||
[testenv:lint]
|
||||
commands =
|
||||
-flake8
|
||||
codespell --ignore-words-list="aks" --quiet-level=2 --skip="*.patch,*.spec,.tox_env"
|
||||
black --diff --check --exclude "/(\.eggs|\.git|\.tox|\.venv|\.build|dist|charmhelpers|mod)/" .
|
||||
|
||||
[testenv:func]
|
||||
|
||||
Reference in New Issue
Block a user