mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Fix PyLint errors in tests
This commit is contained in:
@ -1,3 +1,6 @@
|
||||
[REPORTS]
|
||||
output-format=colorized
|
||||
|
||||
[MESSAGES CONTROL]
|
||||
disable=
|
||||
bad-continuation,
|
||||
|
3
Makefile
3
Makefile
@ -1,5 +1,6 @@
|
||||
lint:
|
||||
pylint --rcfile=./.pylintrc ./platformio
|
||||
pylint -j 6 --rcfile=./.pylintrc ./platformio ./tests
|
||||
pylint -j 6 --rcfile=./.pylintrc ./tests
|
||||
|
||||
isort:
|
||||
isort -rc ./platformio
|
||||
|
@ -101,8 +101,6 @@ class PlatformBase( # pylint: disable=too-many-instance-attributes,too-many-pub
|
||||
if spec.name not in packages:
|
||||
packages[spec.name] = {}
|
||||
packages[spec.name].update(**options)
|
||||
|
||||
print(13, packages)
|
||||
return packages
|
||||
|
||||
@property
|
||||
|
13
tests/__init__.py
Normal file
13
tests/__init__.py
Normal file
@ -0,0 +1,13 @@
|
||||
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
13
tests/commands/__init__.py
Normal file
13
tests/commands/__init__.py
Normal file
@ -0,0 +1,13 @@
|
||||
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
@ -12,6 +12,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# pylint: disable=global-statement,unused-argument
|
||||
|
||||
import json
|
||||
import os
|
||||
import random
|
||||
@ -30,6 +32,7 @@ pytestmark = pytest.mark.skipif(
|
||||
|
||||
username = None
|
||||
email = None
|
||||
splited_email = None
|
||||
firstname = None
|
||||
lastname = None
|
||||
password = None
|
||||
@ -43,7 +46,7 @@ team_description = None
|
||||
|
||||
|
||||
def test_prepare():
|
||||
global username, splited_email, email, firstname, lastname
|
||||
global username, email, splited_email, firstname, lastname
|
||||
global password, orgname, display_name, second_username, teamname, team_description
|
||||
|
||||
username = "test-piocore-%s" % str(random.randint(0, 100000))
|
||||
|
@ -40,7 +40,7 @@ def test_board_options(clirunner, validate_cliresult):
|
||||
validate_cliresult(result)
|
||||
search_result = json.loads(result.output)
|
||||
assert isinstance(search_result, list)
|
||||
assert len(search_result)
|
||||
assert search_result
|
||||
platforms = [item["name"] for item in search_result]
|
||||
|
||||
result = clirunner.invoke(cmd_boards, ["mbed", "--json-output"])
|
||||
|
@ -12,6 +12,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# pylint: disable=redefined-outer-name
|
||||
|
||||
import json
|
||||
import sys
|
||||
from os.path import isfile, join
|
||||
|
@ -12,6 +12,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
|
||||
import json
|
||||
import os
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# pylint: disable=line-too-long
|
||||
|
||||
import json
|
||||
import re
|
||||
|
||||
@ -129,7 +131,9 @@ def test_global_install_repository(clirunner, validate_cliresult, isolated_pio_c
|
||||
assert set(items1) >= set(items2)
|
||||
|
||||
|
||||
def test_install_duplicates(clirunner, validate_cliresult, without_internet):
|
||||
def test_install_duplicates( # pylint: disable=unused-argument
|
||||
clirunner, validate_cliresult, without_internet
|
||||
):
|
||||
# registry
|
||||
result = clirunner.invoke(
|
||||
cmd_lib,
|
||||
@ -231,7 +235,7 @@ def test_global_lib_update_check(clirunner, validate_cliresult):
|
||||
result = clirunner.invoke(cmd_lib, ["-g", "update", "--dry-run", "--json-output"])
|
||||
validate_cliresult(result)
|
||||
output = json.loads(result.output)
|
||||
assert set(["ESPAsyncTCP", "NeoPixelBus"]) == set([lib["name"] for lib in output])
|
||||
assert set(["ESPAsyncTCP", "NeoPixelBus"]) == set(lib["name"] for lib in output)
|
||||
|
||||
|
||||
def test_global_lib_update(clirunner, validate_cliresult):
|
||||
|
@ -12,6 +12,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
|
||||
import json
|
||||
|
||||
from platformio.commands import platform as cli_platform
|
||||
|
@ -33,6 +33,7 @@ def test_local_env():
|
||||
)
|
||||
if result["returncode"] != 1:
|
||||
pytest.fail(str(result))
|
||||
# pylint: disable=unsupported-membership-test
|
||||
assert all([s in result["err"] for s in ("PASSED", "IGNORED", "FAILED")]), result[
|
||||
"out"
|
||||
]
|
||||
|
@ -12,6 +12,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
|
||||
from platformio.commands.update import cli as cmd_update
|
||||
|
||||
|
||||
|
13
tests/ino2cpp/__init__.py
Normal file
13
tests/ino2cpp/__init__.py
Normal file
@ -0,0 +1,13 @@
|
||||
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
13
tests/package/__init__.py
Normal file
13
tests/package/__init__.py
Normal file
@ -0,0 +1,13 @@
|
||||
# Copyright (c) 2014-present PlatformIO <contact@platformio.org>
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
@ -12,6 +12,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
|
||||
import os
|
||||
import time
|
||||
|
||||
|
@ -741,7 +741,7 @@ def test_examples_from_dir(tmpdir_factory):
|
||||
return re.sub(r"[\\/]+", "/", path)
|
||||
|
||||
def _sort_examples(items):
|
||||
for i, item in enumerate(items):
|
||||
for i, _ in enumerate(items):
|
||||
items[i]["base"] = _to_unix_path(items[i]["base"])
|
||||
items[i]["files"] = [_to_unix_path(f) for f in sorted(items[i]["files"])]
|
||||
return sorted(items, key=lambda item: item["name"])
|
||||
|
@ -21,7 +21,8 @@ import pytest
|
||||
|
||||
from platformio import util
|
||||
from platformio.compat import PY2
|
||||
from platformio.managers.platform import PlatformFactory, PlatformManager
|
||||
from platformio.package.manager.platform import PlatformPackageManager
|
||||
from platformio.platform.factory import PlatformFactory
|
||||
from platformio.project.config import ProjectConfig
|
||||
|
||||
|
||||
@ -34,8 +35,8 @@ def pytest_generate_tests(metafunc):
|
||||
examples_dirs.append(normpath(join(dirname(__file__), "..", "examples")))
|
||||
|
||||
# dev/platforms
|
||||
for manifest in PlatformManager().get_installed():
|
||||
p = PlatformFactory.new(manifest["__pkg_dir"])
|
||||
for pkg in PlatformPackageManager().get_installed():
|
||||
p = PlatformFactory.new(pkg)
|
||||
examples_dir = join(p.get_dir(), "examples")
|
||||
assert isdir(examples_dir)
|
||||
examples_dirs.append(examples_dir)
|
||||
|
@ -12,6 +12,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
|
@ -12,6 +12,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
|
||||
import pytest
|
||||
import requests
|
||||
|
||||
@ -21,6 +23,7 @@ from platformio import exception, util
|
||||
def test_platformio_cli():
|
||||
result = util.exec_command(["pio", "--help"])
|
||||
assert result["returncode"] == 0
|
||||
# pylint: disable=unsupported-membership-test
|
||||
assert "Usage: pio [OPTIONS] COMMAND [ARGS]..." in result["out"]
|
||||
|
||||
|
||||
|
@ -12,6 +12,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# pylint: disable=redefined-outer-name
|
||||
|
||||
import os
|
||||
|
||||
import pytest
|
||||
@ -345,7 +347,7 @@ board = myboard
|
||||
["check_types", [("float_option", 13.99), ("bool_option", True)]],
|
||||
]
|
||||
)
|
||||
config.get("platformio", "extra_configs") == "extra.ini"
|
||||
assert config.get("platformio", "extra_configs") == ["extra.ini"]
|
||||
config.remove_section("platformio")
|
||||
assert config.as_tuple() == [
|
||||
("env:myenv", [("board", "myboard"), ("framework", ["espidf", "arduino"])]),
|
||||
|
Reference in New Issue
Block a user