mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Addressed an issue where passing a relative path to the pio project init
// Resolve #4847
This commit is contained in:
@ -22,6 +22,7 @@ test-driven methodologies, and modern toolchains for unrivaled success.
|
||||
|
||||
* Broadened version support for the ``pyelftools`` dependency, enabling compatibility with lower versions and facilitating integration with a wider range of third-party tools (`issue #4834 <https://github.com/platformio/platformio-core/issues/4834>`_)
|
||||
* Resolved an issue related to the relative package path in the `pio pkg publish <https://docs.platformio.org/en/latest/core/userguide/pkg/cmd_publish.html>`__ command
|
||||
* Addressed an issue where passing a relative path (``--project-dir``) to the `pio project init <https://docs.platformio.org/en/latest/core/userguide/project/cmd_init.html>`__ command resulted in an error (`issue #4847 <https://github.com/platformio/platformio-core/issues/4847>`_)
|
||||
|
||||
6.1.13 (2024-01-12)
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -79,6 +79,7 @@ def project_init_cmd(
|
||||
env_prefix,
|
||||
silent,
|
||||
):
|
||||
project_dir = os.path.abspath(project_dir)
|
||||
is_new_project = not is_platformio_project(project_dir)
|
||||
if is_new_project:
|
||||
if not silent:
|
||||
|
@ -15,6 +15,7 @@
|
||||
import json
|
||||
import os
|
||||
|
||||
from platformio import fs
|
||||
from platformio.commands.boards import cli as cmd_boards
|
||||
from platformio.project.commands.init import project_init_cmd
|
||||
from platformio.project.config import ProjectConfig
|
||||
@ -36,27 +37,28 @@ def test_init_default(clirunner, validate_cliresult):
|
||||
validate_pioproject(os.getcwd())
|
||||
|
||||
|
||||
def test_init_ext_folder(clirunner, validate_cliresult):
|
||||
with clirunner.isolated_filesystem():
|
||||
ext_folder_name = "ext_folder"
|
||||
os.makedirs(ext_folder_name)
|
||||
result = clirunner.invoke(project_init_cmd, ["-d", ext_folder_name])
|
||||
validate_cliresult(result)
|
||||
validate_pioproject(os.path.join(os.getcwd(), ext_folder_name))
|
||||
|
||||
|
||||
def test_init_duplicated_boards(clirunner, validate_cliresult, tmpdir):
|
||||
with tmpdir.as_cwd():
|
||||
for _ in range(2):
|
||||
result = clirunner.invoke(
|
||||
project_init_cmd,
|
||||
["-b", "uno", "-b", "uno", "--no-install-dependencies"],
|
||||
)
|
||||
validate_cliresult(result)
|
||||
validate_pioproject(str(tmpdir))
|
||||
config = ProjectConfig(os.path.join(os.getcwd(), "platformio.ini"))
|
||||
config.validate()
|
||||
assert set(config.sections()) == set(["env:uno"])
|
||||
project_dir = str(tmpdir.join("ext_folder"))
|
||||
os.makedirs(project_dir)
|
||||
|
||||
with fs.cd(os.path.dirname(project_dir)):
|
||||
result = clirunner.invoke(
|
||||
project_init_cmd,
|
||||
[
|
||||
"-d",
|
||||
os.path.basename(project_dir),
|
||||
"-b",
|
||||
"uno",
|
||||
"-b",
|
||||
"uno",
|
||||
"--no-install-dependencies",
|
||||
],
|
||||
)
|
||||
validate_cliresult(result)
|
||||
validate_pioproject(project_dir)
|
||||
config = ProjectConfig(os.path.join(project_dir, "platformio.ini"))
|
||||
config.validate()
|
||||
assert set(config.sections()) == set(["env:uno"])
|
||||
|
||||
|
||||
def test_init_ide_without_board(clirunner, tmpdir):
|
||||
|
Reference in New Issue
Block a user