forked from platformio/platformio-core
Drop flake8
This commit is contained in:
@ -18,7 +18,6 @@ import json
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
|
||||||
from os.path import basename, getsize, isdir, isfile, islink, join
|
from os.path import basename, getsize, isdir, isfile, islink, join
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
from os.path import basename
|
|
||||||
|
|
||||||
from platformio import exception, util
|
from platformio import exception, util
|
||||||
from platformio.commands.init import cli as cmd_init
|
from platformio.commands.init import cli as cmd_init
|
||||||
@ -39,7 +38,7 @@ def test_global_install_registry(clirunner, validate_cliresult,
|
|||||||
result = clirunner.invoke(cmd_lib, [
|
result = clirunner.invoke(cmd_lib, [
|
||||||
"-g", "install", "58", "547@2.2.4", "DallasTemperature",
|
"-g", "install", "58", "547@2.2.4", "DallasTemperature",
|
||||||
"http://dl.platformio.org/libraries/archives/3/5174.tar.gz",
|
"http://dl.platformio.org/libraries/archives/3/5174.tar.gz",
|
||||||
"ArduinoJson@5.6.7", "ArduinoJson@~5.7.0", "1089@fee16e880b"
|
"ArduinoJson@5.6.7", "ArduinoJson@~5.7.0", "168@00589a3250"
|
||||||
])
|
])
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
|
|
||||||
@ -65,7 +64,7 @@ def test_global_install_registry(clirunner, validate_cliresult,
|
|||||||
items2 = [
|
items2 = [
|
||||||
"ArduinoJson_ID64", "ArduinoJson_ID64@5.6.7", "DallasTemperature_ID54",
|
"ArduinoJson_ID64", "ArduinoJson_ID64@5.6.7", "DallasTemperature_ID54",
|
||||||
"DHT22_ID58", "ESPAsyncTCP_ID305", "NeoPixelBus_ID547", "OneWire_ID1",
|
"DHT22_ID58", "ESPAsyncTCP_ID305", "NeoPixelBus_ID547", "OneWire_ID1",
|
||||||
"IRremoteESP8266_ID1089"
|
"EspSoftwareSerial_ID168"
|
||||||
]
|
]
|
||||||
assert set(items1) == set(items2)
|
assert set(items1) == set(items2)
|
||||||
|
|
||||||
@ -134,7 +133,7 @@ def test_global_install_repository(clirunner, validate_cliresult,
|
|||||||
assert "is already installed" in result.output
|
assert "is already installed" in result.output
|
||||||
|
|
||||||
|
|
||||||
def test_global_lib_list(clirunner, validate_cliresult, isolated_pio_home):
|
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([n in result.output for n in ("OneWire", "DHT22", "64")])
|
assert all([n in result.output for n in ("OneWire", "DHT22", "64")])
|
||||||
@ -142,31 +141,30 @@ def test_global_lib_list(clirunner, validate_cliresult, isolated_pio_home):
|
|||||||
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 ("PJON", "git+https://github.com/knolleary/pubsubclient",
|
for n in (
|
||||||
"https://github.com/bblanchon/ArduinoJson/archive/v5.8.2.zip"
|
"PJON", "git+https://github.com/knolleary/pubsubclient",
|
||||||
)
|
"https://github.com/bblanchon/ArduinoJson/archive/v5.8.2.zip")
|
||||||
])
|
])
|
||||||
items1 = [i['name'] for i in json.loads(result.output)]
|
items1 = [i['name'] for i in json.loads(result.output)]
|
||||||
items2 = [
|
items2 = [
|
||||||
"OneWire", "DHT22", "PJON", "ESPAsyncTCP", "ArduinoJson",
|
"OneWire", "DHT22", "PJON", "ESPAsyncTCP", "ArduinoJson",
|
||||||
"PubSubClient", "rs485-nodeproto", "Adafruit ST7735 Library",
|
"PubSubClient", "rs485-nodeproto", "Adafruit ST7735 Library",
|
||||||
"RadioHead-1.62", "DallasTemperature", "NeoPixelBus",
|
"RadioHead-1.62", "DallasTemperature", "NeoPixelBus",
|
||||||
"IRremoteESP8266", "platformio-libmirror"
|
"EspSoftwareSerial", "platformio-libmirror"
|
||||||
]
|
]
|
||||||
assert set(items1) == set(items2)
|
assert set(items1) == set(items2)
|
||||||
|
|
||||||
|
|
||||||
def test_global_lib_update_check(clirunner, validate_cliresult,
|
def test_global_lib_update_check(clirunner, validate_cliresult):
|
||||||
isolated_pio_home):
|
|
||||||
result = clirunner.invoke(
|
result = clirunner.invoke(
|
||||||
cmd_lib, ["-g", "update", "--only-check", "--json-output"])
|
cmd_lib, ["-g", "update", "--only-check", "--json-output"])
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
output = json.loads(result.output)
|
output = json.loads(result.output)
|
||||||
assert set(["ArduinoJson", "IRremoteESP8266", "NeoPixelBus"]) == set(
|
assert set(["ArduinoJson", "EspSoftwareSerial",
|
||||||
[l['name'] for l in output])
|
"NeoPixelBus"]) == set([l['name'] for l in output])
|
||||||
|
|
||||||
|
|
||||||
def test_global_lib_update(clirunner, validate_cliresult, isolated_pio_home):
|
def test_global_lib_update(clirunner, validate_cliresult):
|
||||||
# update library using package directory
|
# update library using package directory
|
||||||
result = clirunner.invoke(
|
result = clirunner.invoke(
|
||||||
cmd_lib,
|
cmd_lib,
|
||||||
@ -187,7 +185,7 @@ def test_global_lib_update(clirunner, validate_cliresult, isolated_pio_home):
|
|||||||
assert result.output.count("[Fixed]") == 5
|
assert result.output.count("[Fixed]") == 5
|
||||||
assert result.output.count("[Up-to-date]") == 10
|
assert result.output.count("[Up-to-date]") == 10
|
||||||
assert "Uninstalling ArduinoJson @ 5.7.3" in result.output
|
assert "Uninstalling ArduinoJson @ 5.7.3" in result.output
|
||||||
assert "Uninstalling IRremoteESP8266 @ fee16e880b" in result.output
|
assert "Uninstalling EspSoftwareSerial @ 00589a3250" in result.output
|
||||||
|
|
||||||
# update unknown library
|
# update unknown library
|
||||||
result = clirunner.invoke(cmd_lib, ["-g", "update", "Unknown"])
|
result = clirunner.invoke(cmd_lib, ["-g", "update", "Unknown"])
|
||||||
@ -208,14 +206,14 @@ def test_global_lib_uninstall(clirunner, validate_cliresult,
|
|||||||
|
|
||||||
# uninstall the rest libraries
|
# uninstall the rest libraries
|
||||||
result = clirunner.invoke(cmd_lib, [
|
result = clirunner.invoke(cmd_lib, [
|
||||||
"-g", "uninstall", "1", "ArduinoJson@!=5.6.7",
|
"-g", "uninstall", "1", "https://github.com/bblanchon/ArduinoJson.git",
|
||||||
"https://github.com/bblanchon/ArduinoJson.git", "IRremoteESP8266@>=0.2"
|
"ArduinoJson@!=5.6.7", "EspSoftwareSerial@>=3.3.1"
|
||||||
])
|
])
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
|
|
||||||
items1 = [d.basename for d in isolated_pio_home.join("lib").listdir()]
|
items1 = [d.basename for d in isolated_pio_home.join("lib").listdir()]
|
||||||
items2 = [
|
items2 = [
|
||||||
"ArduinoJson", "ArduinoJson_ID64@5.6.7", "DallasTemperature_ID54",
|
"ArduinoJson_ID64", "ArduinoJson_ID64@5.6.7", "DallasTemperature_ID54",
|
||||||
"DHT22_ID58", "ESPAsyncTCP_ID305", "NeoPixelBus_ID547", "PJON",
|
"DHT22_ID58", "ESPAsyncTCP_ID305", "NeoPixelBus_ID547", "PJON",
|
||||||
"PJON@src-79de467ebe19de18287becff0a1fb42d", "PubSubClient",
|
"PJON@src-79de467ebe19de18287becff0a1fb42d", "PubSubClient",
|
||||||
"RadioHead-1.62", "rs485-nodeproto", "platformio-libmirror"
|
"RadioHead-1.62", "rs485-nodeproto", "platformio-libmirror"
|
||||||
@ -228,7 +226,7 @@ def test_global_lib_uninstall(clirunner, validate_cliresult,
|
|||||||
assert isinstance(result.exception, exception.UnknownPackage)
|
assert isinstance(result.exception, exception.UnknownPackage)
|
||||||
|
|
||||||
|
|
||||||
def test_lib_show(clirunner, validate_cliresult, isolated_pio_home):
|
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(
|
assert all(
|
||||||
@ -238,14 +236,14 @@ def test_lib_show(clirunner, validate_cliresult, isolated_pio_home):
|
|||||||
assert "OneWire" in result.output
|
assert "OneWire" in result.output
|
||||||
|
|
||||||
|
|
||||||
def test_lib_builtin(clirunner, validate_cliresult, isolated_pio_home):
|
def test_lib_builtin(clirunner, validate_cliresult):
|
||||||
result = clirunner.invoke(cmd_lib, ["builtin"])
|
result = clirunner.invoke(cmd_lib, ["builtin"])
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
result = clirunner.invoke(cmd_lib, ["builtin", "--json-output"])
|
result = clirunner.invoke(cmd_lib, ["builtin", "--json-output"])
|
||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
|
|
||||||
|
|
||||||
def test_lib_stats(clirunner, validate_cliresult, isolated_pio_home):
|
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([
|
||||||
|
3
tox.ini
3
tox.ini
@ -20,7 +20,6 @@ basepython = python2.7
|
|||||||
usedevelop = True
|
usedevelop = True
|
||||||
deps =
|
deps =
|
||||||
isort
|
isort
|
||||||
flake8
|
|
||||||
yapf
|
yapf
|
||||||
pylint
|
pylint
|
||||||
pytest
|
pytest
|
||||||
@ -47,10 +46,8 @@ commands =
|
|||||||
[testenv:lint]
|
[testenv:lint]
|
||||||
basepython = python2.7
|
basepython = python2.7
|
||||||
deps =
|
deps =
|
||||||
flake8
|
|
||||||
pylint
|
pylint
|
||||||
commands =
|
commands =
|
||||||
flake8 ./platformio
|
|
||||||
pylint --rcfile=./.pylintrc ./platformio
|
pylint --rcfile=./.pylintrc ./platformio
|
||||||
|
|
||||||
[testenv]
|
[testenv]
|
||||||
|
Reference in New Issue
Block a user