mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-30 10:07:14 +02:00
Fix broken tests
This commit is contained in:
@ -163,6 +163,7 @@ def device_list( # pylint: disable=too-many-branches
|
|||||||
"--environment",
|
"--environment",
|
||||||
help="Load configuration from `platformio.ini` and specified environment")
|
help="Load configuration from `platformio.ini` and specified environment")
|
||||||
def device_monitor(**kwargs): # pylint: disable=too-many-branches
|
def device_monitor(**kwargs): # pylint: disable=too-many-branches
|
||||||
|
env_options = {}
|
||||||
try:
|
try:
|
||||||
env_options = get_project_options(kwargs['project_dir'],
|
env_options = get_project_options(kwargs['project_dir'],
|
||||||
kwargs['environment'])
|
kwargs['environment'])
|
||||||
|
@ -13,3 +13,4 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from platformio.commands.run.command import cli
|
from platformio.commands.run.command import cli
|
||||||
|
from platformio.commands.run.helpers import print_header
|
||||||
|
@ -110,11 +110,12 @@ def test_init_special_board(clirunner, validate_cliresult):
|
|||||||
config = ProjectConfig(join(getcwd(), "platformio.ini"))
|
config = ProjectConfig(join(getcwd(), "platformio.ini"))
|
||||||
config.validate()
|
config.validate()
|
||||||
|
|
||||||
expected_result = [("platform", boards[0]['platform']),
|
expected_result = dict(platform=str(boards[0]['platform']),
|
||||||
("board", "uno"),
|
board="uno",
|
||||||
("framework", [boards[0]['frameworks'][0]])]
|
framework=[str(boards[0]['frameworks'][0])])
|
||||||
assert config.has_section("env:uno")
|
assert config.has_section("env:uno")
|
||||||
assert config.items("env:uno") == expected_result
|
assert sorted(config.items(env="uno", as_dict=True).items()) == sorted(
|
||||||
|
expected_result.items())
|
||||||
|
|
||||||
|
|
||||||
def test_init_enable_auto_uploading(clirunner, validate_cliresult):
|
def test_init_enable_auto_uploading(clirunner, validate_cliresult):
|
||||||
@ -125,10 +126,13 @@ def test_init_enable_auto_uploading(clirunner, validate_cliresult):
|
|||||||
validate_pioproject(getcwd())
|
validate_pioproject(getcwd())
|
||||||
config = ProjectConfig(join(getcwd(), "platformio.ini"))
|
config = ProjectConfig(join(getcwd(), "platformio.ini"))
|
||||||
config.validate()
|
config.validate()
|
||||||
expected_result = [("targets", ["upload"]), ("platform", "atmelavr"),
|
expected_result = dict(targets=["upload"],
|
||||||
("board", "uno"), ("framework", ["arduino"])]
|
platform="atmelavr",
|
||||||
|
board="uno",
|
||||||
|
framework=["arduino"])
|
||||||
assert config.has_section("env:uno")
|
assert config.has_section("env:uno")
|
||||||
assert config.items("env:uno") == expected_result
|
assert sorted(config.items(env="uno", as_dict=True).items()) == sorted(
|
||||||
|
expected_result.items())
|
||||||
|
|
||||||
|
|
||||||
def test_init_custom_framework(clirunner, validate_cliresult):
|
def test_init_custom_framework(clirunner, validate_cliresult):
|
||||||
@ -139,10 +143,13 @@ def test_init_custom_framework(clirunner, validate_cliresult):
|
|||||||
validate_pioproject(getcwd())
|
validate_pioproject(getcwd())
|
||||||
config = ProjectConfig(join(getcwd(), "platformio.ini"))
|
config = ProjectConfig(join(getcwd(), "platformio.ini"))
|
||||||
config.validate()
|
config.validate()
|
||||||
expected_result = [("platform", "teensy"), ("board", "teensy31"),
|
expected_result = dict(platform="teensy",
|
||||||
("framework", ["mbed"])]
|
board="teensy31",
|
||||||
|
framework=["mbed"])
|
||||||
assert config.has_section("env:teensy31")
|
assert config.has_section("env:teensy31")
|
||||||
assert config.items("env:teensy31") == expected_result
|
assert sorted(config.items(env="teensy31",
|
||||||
|
as_dict=True).items()) == sorted(
|
||||||
|
expected_result.items())
|
||||||
|
|
||||||
|
|
||||||
def test_init_incorrect_board(clirunner):
|
def test_init_incorrect_board(clirunner):
|
||||||
|
@ -172,6 +172,6 @@ def test_empty_config():
|
|||||||
assert config.get("section", "option", 13) == 13
|
assert config.get("section", "option", 13) == 13
|
||||||
|
|
||||||
# sysenv
|
# sysenv
|
||||||
os.environ["PLATFORMIO_CORE_DIR"] = "/custom/core/dir"
|
os.environ["PLATFORMIO_HOME_DIR"] = "/custom/core/dir"
|
||||||
assert config.get("platformio", "core_dir") == "/custom/core/dir"
|
assert config.get("platformio", "core_dir") == "/custom/core/dir"
|
||||||
del os.environ["PLATFORMIO_CORE_DIR"]
|
del os.environ["PLATFORMIO_HOME_DIR"]
|
||||||
|
Reference in New Issue
Block a user