зеркало из https://github.com/microsoft/lisa.git
Pylint: Enable pointless statement checks
This commit is contained in:
Родитель
ba094c3bce
Коммит
e291bd47ee
|
@ -64,8 +64,7 @@ class HelloWorld(TestSuite):
|
||||||
priority=1,
|
priority=1,
|
||||||
)
|
)
|
||||||
def bye(self, node: Node) -> None:
|
def bye(self, node: Node) -> None:
|
||||||
# use it once like this way before use short cut
|
node.tools.get(Echo) # Ensure echo is in cache
|
||||||
node.tools[Echo]
|
|
||||||
assert_that(str(node.tools.echo("bye!"))).is_equal_to("bye!")
|
assert_that(str(node.tools.echo("bye!"))).is_equal_to("bye!")
|
||||||
|
|
||||||
def before_suite(self, log: Logger, **kwargs: Any) -> None:
|
def before_suite(self, log: Logger, **kwargs: Any) -> None:
|
||||||
|
|
|
@ -220,8 +220,8 @@ class Tool(InitializableMixin):
|
||||||
# check dependencies
|
# check dependencies
|
||||||
if self.dependencies:
|
if self.dependencies:
|
||||||
self._log.info("installing dependencies")
|
self._log.info("installing dependencies")
|
||||||
for dependency in self.dependencies:
|
map(self.node.tools.get, self.dependencies)
|
||||||
self.node.tools[dependency]
|
|
||||||
return self._install()
|
return self._install()
|
||||||
|
|
||||||
def run_async(
|
def run_async(
|
||||||
|
@ -560,7 +560,7 @@ class Tools:
|
||||||
|
|
||||||
def get(
|
def get(
|
||||||
self,
|
self,
|
||||||
tool_type: Union[Type[T], CustomScriptBuilder, str],
|
tool_type: Union[Type[T], Type[Tool], CustomScriptBuilder, str],
|
||||||
*args: Any,
|
*args: Any,
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> T:
|
) -> T:
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
# Copyright (c) Microsoft Corporation.
|
# Copyright (c) Microsoft Corporation.
|
||||||
# Licensed under the MIT license.
|
# Licensed under the MIT license.
|
||||||
|
|
||||||
|
"""
|
||||||
|
Schema is dealt with three components,
|
||||||
|
1. dataclasses. It's a builtin class, uses to define schema of an instance. field()
|
||||||
|
function uses to describe a field.
|
||||||
|
2. dataclasses_json. Serializer. config() function customizes this component.
|
||||||
|
3. marshmallow. Validator. It's wrapped by dataclasses_json. config(mm_field=xxx)
|
||||||
|
function customizes this component.
|
||||||
|
"""
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
@ -28,16 +37,6 @@ from lisa.util import (
|
||||||
strip_strs,
|
strip_strs,
|
||||||
)
|
)
|
||||||
|
|
||||||
"""
|
|
||||||
Schema is dealt with three components,
|
|
||||||
1. dataclasses. It's a builtin class, uses to define schema of an instance. field()
|
|
||||||
function uses to describe a field.
|
|
||||||
2. dataclasses_json. Serializer. config() function customizes this component.
|
|
||||||
3. marshmallow. Validator. It's wrapped by dataclasses_json. config(mm_field=xxx)
|
|
||||||
function customizes this component.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
T = TypeVar("T")
|
T = TypeVar("T")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,7 @@ class Kexec(Tool):
|
||||||
tool_path, name_pattern="kexec-tools*", file_type="d"
|
tool_path, name_pattern="kexec-tools*", file_type="d"
|
||||||
)
|
)
|
||||||
code_path = tool_path.joinpath(kexec_source_folder[0])
|
code_path = tool_path.joinpath(kexec_source_folder[0])
|
||||||
self.node.tools[Gcc]
|
self.node.tools.get(Gcc) # Ensure gcc is installed
|
||||||
make = self.node.tools[Make]
|
make = self.node.tools[Make]
|
||||||
self.node.execute(
|
self.node.execute(
|
||||||
"./configure",
|
"./configure",
|
||||||
|
|
|
@ -130,7 +130,7 @@ class Lsvmbus(Tool):
|
||||||
cmd_result = self.node.execute("which python", sudo=True)
|
cmd_result = self.node.execute("which python", sudo=True)
|
||||||
if 0 != cmd_result.exit_code:
|
if 0 != cmd_result.exit_code:
|
||||||
ln = self.node.tools[Ln]
|
ln = self.node.tools[Ln]
|
||||||
self.node.tools[Python]
|
self.node.tools.get(Python)
|
||||||
ln.create_link("/bin/python3", "/usr/bin/python")
|
ln.create_link("/bin/python3", "/usr/bin/python")
|
||||||
|
|
||||||
def _check_exists(self) -> bool:
|
def _check_exists(self) -> bool:
|
||||||
|
|
|
@ -80,7 +80,7 @@ class StressNg(Tool):
|
||||||
tool_path = self.get_tool_path()
|
tool_path = self.get_tool_path()
|
||||||
git = self.node.tools[Git]
|
git = self.node.tools[Git]
|
||||||
git.clone(self.repo, tool_path, ref=self.branch)
|
git.clone(self.repo, tool_path, ref=self.branch)
|
||||||
self.node.tools[Gcc]
|
self.node.tools.get(Gcc) # Ensure gcc is installed
|
||||||
make = self.node.tools[Make]
|
make = self.node.tools[Make]
|
||||||
code_path = tool_path.joinpath("stress-ng")
|
code_path = tool_path.joinpath("stress-ng")
|
||||||
make.make_install(cwd=code_path)
|
make.make_install(cwd=code_path)
|
||||||
|
|
|
@ -66,7 +66,7 @@ class Vdsotest(Tool):
|
||||||
tool_path = self.get_tool_path()
|
tool_path = self.get_tool_path()
|
||||||
git = self.node.tools[Git]
|
git = self.node.tools[Git]
|
||||||
git.clone(self.repo, tool_path, ref=self.branch)
|
git.clone(self.repo, tool_path, ref=self.branch)
|
||||||
self.node.tools[Gcc]
|
self.node.tools.get(Gcc)
|
||||||
make = self.node.tools[Make]
|
make = self.node.tools[Make]
|
||||||
code_path = tool_path.joinpath("vdsotest")
|
code_path = tool_path.joinpath("vdsotest")
|
||||||
self.node.execute("./autogen.sh", cwd=code_path).assert_exit_code()
|
self.node.execute("./autogen.sh", cwd=code_path).assert_exit_code()
|
||||||
|
|
|
@ -1,14 +1,6 @@
|
||||||
# Copyright (c) Microsoft Corporation.
|
# Copyright (c) Microsoft Corporation.
|
||||||
# Licensed under the MIT license.
|
# Licensed under the MIT license.
|
||||||
|
|
||||||
import importlib
|
|
||||||
import importlib.util
|
|
||||||
import sys
|
|
||||||
from pathlib import Path
|
|
||||||
from typing import Iterable, Optional
|
|
||||||
|
|
||||||
from lisa.util.logger import Logger, get_logger
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Reasons to import packages in LISA:
|
Reasons to import packages in LISA:
|
||||||
|
|
||||||
|
@ -24,6 +16,14 @@ Steps,
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import importlib
|
||||||
|
import importlib.util
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import Iterable, Optional
|
||||||
|
|
||||||
|
from lisa.util.logger import Logger, get_logger
|
||||||
|
|
||||||
|
|
||||||
def _import_module(
|
def _import_module(
|
||||||
file: Path,
|
file: Path,
|
||||||
|
|
|
@ -148,10 +148,10 @@ class ACCBasicTest(TestSuite):
|
||||||
# <cp -r /opt/openenclave/share/openenclave/samples ~/mysamples>
|
# <cp -r /opt/openenclave/share/openenclave/samples ~/mysamples>
|
||||||
|
|
||||||
samples_folder = node.get_working_path() / "mysamples"
|
samples_folder = node.get_working_path() / "mysamples"
|
||||||
copy_cmd = "cp -r /opt/openenclave/share/openenclave/samples " + str(
|
node.execute(
|
||||||
samples_folder
|
f"cp -r /opt/openenclave/share/openenclave/samples {samples_folder}",
|
||||||
|
shell=True,
|
||||||
)
|
)
|
||||||
node.execute(copy_cmd, shell=True)
|
|
||||||
|
|
||||||
# Run Hello World and Remote Attestation
|
# Run Hello World and Remote Attestation
|
||||||
helloworld_dir = samples_folder / "helloworld"
|
helloworld_dir = samples_folder / "helloworld"
|
||||||
|
@ -159,7 +159,7 @@ class ACCBasicTest(TestSuite):
|
||||||
source_command = ". /opt/openenclave/share/openenclave/openenclaverc"
|
source_command = ". /opt/openenclave/share/openenclave/openenclaverc"
|
||||||
fail_msg = "HELLO WORLD TEST FAILED"
|
fail_msg = "HELLO WORLD TEST FAILED"
|
||||||
|
|
||||||
node.tools[Make]
|
node.tools.get(Make) # Ensure make is installed
|
||||||
result = node.execute(
|
result = node.execute(
|
||||||
f"{source_command} && make build && make run",
|
f"{source_command} && make build && make run",
|
||||||
cwd=helloworld_dir,
|
cwd=helloworld_dir,
|
||||||
|
|
|
@ -224,7 +224,7 @@ class HvModule(TestSuite):
|
||||||
if isinstance(node.os, Redhat):
|
if isinstance(node.os, Redhat):
|
||||||
try:
|
try:
|
||||||
log.debug("Checking LIS installation before reload.")
|
log.debug("Checking LIS installation before reload.")
|
||||||
node.tools[LisDriver]
|
node.tools.get(LisDriver)
|
||||||
except Exception:
|
except Exception:
|
||||||
log.debug("Updating LIS failed. Moving on to attempt reload.")
|
log.debug("Updating LIS failed. Moving on to attempt reload.")
|
||||||
|
|
||||||
|
|
|
@ -691,10 +691,10 @@ class Sriov(TestSuite):
|
||||||
):
|
):
|
||||||
matched_server_nic_info = server_nic_info
|
matched_server_nic_info = server_nic_info
|
||||||
break
|
break
|
||||||
assert (
|
assert matched_server_nic_info, (
|
||||||
matched_server_nic_info
|
"not found the server nic has the same subnet of"
|
||||||
), "not found the server nic has the same subnet of"
|
f" {client_nic_info.ip_addr}"
|
||||||
f" {client_nic_info.ip_addr}"
|
)
|
||||||
|
|
||||||
# 3. Start iperf3 for 120 seconds with 128 threads on client node.
|
# 3. Start iperf3 for 120 seconds with 128 threads on client node.
|
||||||
client_iperf3.run_as_client(
|
client_iperf3.run_as_client(
|
||||||
|
|
2
pylintrc
2
pylintrc
|
@ -43,8 +43,6 @@ disable=
|
||||||
missing-timeout,
|
missing-timeout,
|
||||||
modified-iterating-list,
|
modified-iterating-list,
|
||||||
no-member,
|
no-member,
|
||||||
pointless-statement,
|
|
||||||
pointless-string-statement,
|
|
||||||
redefined-argument-from-local,
|
redefined-argument-from-local,
|
||||||
redefined-outer-name,
|
redefined-outer-name,
|
||||||
super-init-not-called,
|
super-init-not-called,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче