forked from platformio/platformio-core
PyLint fixes
This commit is contained in:
@ -52,6 +52,7 @@ def BoardConfig(env, board=None):
|
|||||||
except (AssertionError, UnknownBoard) as e:
|
except (AssertionError, UnknownBoard) as e:
|
||||||
sys.stderr.write("Error: %s\n" % str(e))
|
sys.stderr.write("Error: %s\n" % str(e))
|
||||||
env.Exit(1)
|
env.Exit(1)
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def GetFrameworkScript(env, framework):
|
def GetFrameworkScript(env, framework):
|
||||||
|
@ -230,7 +230,7 @@ class CppcheckCheckTool(CheckToolBase):
|
|||||||
project_files = self.get_project_target_files(self.options["patterns"])
|
project_files = self.get_project_target_files(self.options["patterns"])
|
||||||
|
|
||||||
languages = ("c", "c++")
|
languages = ("c", "c++")
|
||||||
if not any([project_files[t] for t in languages]):
|
if not any(project_files[t] for t in languages):
|
||||||
click.echo("Error: Nothing to check.")
|
click.echo("Error: Nothing to check.")
|
||||||
return True
|
return True
|
||||||
for language in languages:
|
for language in languages:
|
||||||
|
@ -192,7 +192,7 @@ def configure_esp32_load_cmds(debug_options, configuration):
|
|||||||
debug_options["load_cmds"] != ["load"],
|
debug_options["load_cmds"] != ["load"],
|
||||||
"xtensa-esp32" not in configuration.get("cc_path", ""),
|
"xtensa-esp32" not in configuration.get("cc_path", ""),
|
||||||
not flash_images,
|
not flash_images,
|
||||||
not all([isfile(item["path"]) for item in flash_images]),
|
not all(isfile(item["path"]) for item in flash_images),
|
||||||
]
|
]
|
||||||
if any(ignore_conds):
|
if any(ignore_conds):
|
||||||
return debug_options["load_cmds"]
|
return debug_options["load_cmds"]
|
||||||
|
@ -257,15 +257,13 @@ class ProjectRPC:
|
|||||||
return arduino_project_dir
|
return arduino_project_dir
|
||||||
|
|
||||||
is_arduino_project = any(
|
is_arduino_project = any(
|
||||||
[
|
os.path.isfile(
|
||||||
os.path.isfile(
|
os.path.join(
|
||||||
os.path.join(
|
arduino_project_dir,
|
||||||
arduino_project_dir,
|
"%s.%s" % (os.path.basename(arduino_project_dir), ext),
|
||||||
"%s.%s" % (os.path.basename(arduino_project_dir), ext),
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
for ext in ("ino", "pde")
|
)
|
||||||
]
|
for ext in ("ino", "pde")
|
||||||
)
|
)
|
||||||
if not is_arduino_project:
|
if not is_arduino_project:
|
||||||
raise jsonrpc.exceptions.JSONRPCDispatchException(
|
raise jsonrpc.exceptions.JSONRPCDispatchException(
|
||||||
|
@ -128,9 +128,9 @@ def cli( # pylint: disable=redefined-builtin
|
|||||||
not environment and default_envs and envname not in default_envs,
|
not environment and default_envs and envname not in default_envs,
|
||||||
testname != "*"
|
testname != "*"
|
||||||
and patterns["filter"]
|
and patterns["filter"]
|
||||||
and not any([fnmatch(testname, p) for p in patterns["filter"]]),
|
and not any(fnmatch(testname, p) for p in patterns["filter"]),
|
||||||
testname != "*"
|
testname != "*"
|
||||||
and any([fnmatch(testname, p) for p in patterns["ignore"]]),
|
and any(fnmatch(testname, p) for p in patterns["ignore"]),
|
||||||
]
|
]
|
||||||
if any(skip_conditions):
|
if any(skip_conditions):
|
||||||
results.append({"env": envname, "test": testname})
|
results.append({"env": envname, "test": testname})
|
||||||
|
@ -95,7 +95,7 @@ class EmbeddedTestProcessor(TestProcessorBase):
|
|||||||
if isinstance(line, bytes):
|
if isinstance(line, bytes):
|
||||||
line = line.decode("utf8", "ignore")
|
line = line.decode("utf8", "ignore")
|
||||||
self.on_run_out(line)
|
self.on_run_out(line)
|
||||||
if all([l in line for l in ("Tests", "Failures", "Ignored")]):
|
if all(l in line for l in ("Tests", "Failures", "Ignored")):
|
||||||
break
|
break
|
||||||
ser.close()
|
ser.close()
|
||||||
return not self._run_failed
|
return not self._run_failed
|
||||||
|
@ -568,6 +568,7 @@ class LibraryPropertiesManifestParser(BaseManifestParser):
|
|||||||
continue
|
continue
|
||||||
found = True
|
found = True
|
||||||
item["maintainer"] = True
|
item["maintainer"] = True
|
||||||
|
# pylint: disable=unsupported-membership-test
|
||||||
if not item.get("email") and email and "@" in email:
|
if not item.get("email") and email and "@" in email:
|
||||||
item["email"] = email
|
item["email"] = email
|
||||||
if not found:
|
if not found:
|
||||||
|
@ -252,6 +252,7 @@ class PlatformBase( # pylint: disable=too-many-instance-attributes,too-many-pub
|
|||||||
click.secho(
|
click.secho(
|
||||||
"Could not install Python packages -> %s" % e, fg="red", err=True
|
"Could not install Python packages -> %s" % e, fg="red", err=True
|
||||||
)
|
)
|
||||||
|
return None
|
||||||
|
|
||||||
def uninstall_python_packages(self):
|
def uninstall_python_packages(self):
|
||||||
if not self.python_packages:
|
if not self.python_packages:
|
||||||
|
@ -23,7 +23,7 @@ def test_board_json_output(clirunner, validate_cliresult):
|
|||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
boards = json.loads(result.output)
|
boards = json.loads(result.output)
|
||||||
assert isinstance(boards, list)
|
assert isinstance(boards, list)
|
||||||
assert any(["mbed" in b["frameworks"] for b in boards])
|
assert any("mbed" in b["frameworks"] for b in boards)
|
||||||
|
|
||||||
|
|
||||||
def test_board_raw_output(clirunner, validate_cliresult):
|
def test_board_raw_output(clirunner, validate_cliresult):
|
||||||
|
@ -70,10 +70,8 @@ def test_init_ide_vscode(clirunner, validate_cliresult, tmpdir):
|
|||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
validate_pioproject(str(tmpdir))
|
validate_pioproject(str(tmpdir))
|
||||||
assert all(
|
assert all(
|
||||||
[
|
tmpdir.join(".vscode").join(f).check()
|
||||||
tmpdir.join(".vscode").join(f).check()
|
for f in ("c_cpp_properties.json", "launch.json")
|
||||||
for f in ("c_cpp_properties.json", "launch.json")
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
assert (
|
assert (
|
||||||
"framework-arduino-avr"
|
"framework-arduino-avr"
|
||||||
@ -113,7 +111,7 @@ def test_init_ide_eclipse(clirunner, validate_cliresult):
|
|||||||
result = clirunner.invoke(cmd_init, ["-b", "uno", "--ide", "eclipse"])
|
result = clirunner.invoke(cmd_init, ["-b", "uno", "--ide", "eclipse"])
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
validate_pioproject(getcwd())
|
validate_pioproject(getcwd())
|
||||||
assert all([isfile(f) for f in (".cproject", ".project")])
|
assert all(isfile(f) for f in (".cproject", ".project"))
|
||||||
|
|
||||||
|
|
||||||
def test_init_special_board(clirunner, validate_cliresult):
|
def test_init_special_board(clirunner, validate_cliresult):
|
||||||
|
@ -172,27 +172,23 @@ def test_global_lib_list(clirunner, validate_cliresult):
|
|||||||
result = clirunner.invoke(cmd_lib, ["-g", "list"])
|
result = clirunner.invoke(cmd_lib, ["-g", "list"])
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
assert all(
|
assert all(
|
||||||
[
|
n in result.output
|
||||||
n in result.output
|
for n in (
|
||||||
for n in (
|
"Source: https://github.com/Pedroalbuquerque/ESP32WebServer/archive/master.zip",
|
||||||
"Source: https://github.com/Pedroalbuquerque/ESP32WebServer/archive/master.zip",
|
"Version: 5.10.1",
|
||||||
"Version: 5.10.1",
|
"Source: git+https://github.com/gioblu/PJON.git#3.0",
|
||||||
"Source: git+https://github.com/gioblu/PJON.git#3.0",
|
"Version: 3.0.0+sha.1fb26fd",
|
||||||
"Version: 3.0.0+sha.1fb26fd",
|
)
|
||||||
)
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
result = clirunner.invoke(cmd_lib, ["-g", "list", "--json-output"])
|
result = clirunner.invoke(cmd_lib, ["-g", "list", "--json-output"])
|
||||||
assert all(
|
assert all(
|
||||||
[
|
n in result.output
|
||||||
n in result.output
|
for n in (
|
||||||
for n in (
|
"__pkg_dir",
|
||||||
"__pkg_dir",
|
'"__src_url": "git+https://github.com/gioblu/PJON.git#6.2"',
|
||||||
'"__src_url": "git+https://github.com/gioblu/PJON.git#6.2"',
|
'"version": "5.10.1"',
|
||||||
'"version": "5.10.1"',
|
)
|
||||||
)
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
items1 = [i["name"] for i in json.loads(result.output)]
|
items1 = [i["name"] for i in json.loads(result.output)]
|
||||||
items2 = [
|
items2 = [
|
||||||
@ -316,7 +312,7 @@ def test_global_lib_uninstall(clirunner, validate_cliresult, isolated_pio_core):
|
|||||||
def test_lib_show(clirunner, validate_cliresult):
|
def test_lib_show(clirunner, validate_cliresult):
|
||||||
result = clirunner.invoke(cmd_lib, ["show", "64"])
|
result = clirunner.invoke(cmd_lib, ["show", "64"])
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
assert all([s in result.output for s in ("ArduinoJson", "Arduino", "Atmel AVR")])
|
assert all(s in result.output for s in ("ArduinoJson", "Arduino", "Atmel AVR"))
|
||||||
result = clirunner.invoke(cmd_lib, ["show", "OneWire", "--json-output"])
|
result = clirunner.invoke(cmd_lib, ["show", "OneWire", "--json-output"])
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
assert "OneWire" in result.output
|
assert "OneWire" in result.output
|
||||||
@ -333,10 +329,8 @@ def test_lib_stats(clirunner, validate_cliresult):
|
|||||||
result = clirunner.invoke(cmd_lib, ["stats"])
|
result = clirunner.invoke(cmd_lib, ["stats"])
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
assert all(
|
assert all(
|
||||||
[
|
s in result.output
|
||||||
s in result.output
|
for s in ("UPDATED", "POPULAR", "https://platformio.org/lib/show")
|
||||||
for s in ("UPDATED", "POPULAR", "https://platformio.org/lib/show")
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
|
|
||||||
result = clirunner.invoke(cmd_lib, ["stats", "--json-output"])
|
result = clirunner.invoke(cmd_lib, ["stats", "--json-output"])
|
||||||
|
@ -103,7 +103,7 @@ def test_list_json_output(clirunner, validate_cliresult):
|
|||||||
def test_list_raw_output(clirunner, validate_cliresult):
|
def test_list_raw_output(clirunner, validate_cliresult):
|
||||||
result = clirunner.invoke(cli_platform.platform_list)
|
result = clirunner.invoke(cli_platform.platform_list)
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
assert all([s in result.output for s in ("atmelavr", "espressif8266")])
|
assert all(s in result.output for s in ("atmelavr", "espressif8266"))
|
||||||
|
|
||||||
|
|
||||||
def test_update_check(clirunner, validate_cliresult, isolated_pio_core):
|
def test_update_check(clirunner, validate_cliresult, isolated_pio_core):
|
||||||
|
@ -34,7 +34,7 @@ def test_local_env():
|
|||||||
if result["returncode"] != 1:
|
if result["returncode"] != 1:
|
||||||
pytest.fail(str(result))
|
pytest.fail(str(result))
|
||||||
# pylint: disable=unsupported-membership-test
|
# pylint: disable=unsupported-membership-test
|
||||||
assert all([s in result["err"] for s in ("PASSED", "FAILED")]), result["out"]
|
assert all(s in result["err"] for s in ("PASSED", "FAILED")), result["out"]
|
||||||
|
|
||||||
|
|
||||||
def test_multiple_env_build(clirunner, validate_cliresult, tmpdir):
|
def test_multiple_env_build(clirunner, validate_cliresult, tmpdir):
|
||||||
|
@ -21,7 +21,7 @@ def test_update(clirunner, validate_cliresult, isolated_pio_core):
|
|||||||
matches = ("Platform Manager", "Library Manager")
|
matches = ("Platform Manager", "Library Manager")
|
||||||
result = clirunner.invoke(cmd_update, ["--only-check"])
|
result = clirunner.invoke(cmd_update, ["--only-check"])
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
assert all([m in result.output for m in matches])
|
assert all(m in result.output for m in matches)
|
||||||
result = clirunner.invoke(cmd_update)
|
result = clirunner.invoke(cmd_update)
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
assert all([m in result.output for m in matches])
|
assert all(m in result.output for m in matches)
|
||||||
|
Reference in New Issue
Block a user