mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Fix broken tests
This commit is contained in:
@ -163,6 +163,7 @@ def device_list( # pylint: disable=too-many-branches
|
||||
"--environment",
|
||||
help="Load configuration from `platformio.ini` and specified environment")
|
||||
def device_monitor(**kwargs): # pylint: disable=too-many-branches
|
||||
env_options = {}
|
||||
try:
|
||||
env_options = get_project_options(kwargs['project_dir'],
|
||||
kwargs['environment'])
|
||||
|
@ -13,3 +13,4 @@
|
||||
# limitations under the License.
|
||||
|
||||
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.validate()
|
||||
|
||||
expected_result = [("platform", boards[0]['platform']),
|
||||
("board", "uno"),
|
||||
("framework", [boards[0]['frameworks'][0]])]
|
||||
expected_result = dict(platform=str(boards[0]['platform']),
|
||||
board="uno",
|
||||
framework=[str(boards[0]['frameworks'][0])])
|
||||
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):
|
||||
@ -125,10 +126,13 @@ def test_init_enable_auto_uploading(clirunner, validate_cliresult):
|
||||
validate_pioproject(getcwd())
|
||||
config = ProjectConfig(join(getcwd(), "platformio.ini"))
|
||||
config.validate()
|
||||
expected_result = [("targets", ["upload"]), ("platform", "atmelavr"),
|
||||
("board", "uno"), ("framework", ["arduino"])]
|
||||
expected_result = dict(targets=["upload"],
|
||||
platform="atmelavr",
|
||||
board="uno",
|
||||
framework=["arduino"])
|
||||
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):
|
||||
@ -139,10 +143,13 @@ def test_init_custom_framework(clirunner, validate_cliresult):
|
||||
validate_pioproject(getcwd())
|
||||
config = ProjectConfig(join(getcwd(), "platformio.ini"))
|
||||
config.validate()
|
||||
expected_result = [("platform", "teensy"), ("board", "teensy31"),
|
||||
("framework", ["mbed"])]
|
||||
expected_result = dict(platform="teensy",
|
||||
board="teensy31",
|
||||
framework=["mbed"])
|
||||
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):
|
||||
|
@ -172,6 +172,6 @@ def test_empty_config():
|
||||
assert config.get("section", "option", 13) == 13
|
||||
|
||||
# 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"
|
||||
del os.environ["PLATFORMIO_CORE_DIR"]
|
||||
del os.environ["PLATFORMIO_HOME_DIR"]
|
||||
|
Reference in New Issue
Block a user