mirror of
https://github.com/platformio/platformio-core.git
synced 2025-10-04 09:30:55 +02:00
Clean autogenerated files before running tests // Resolve #3523
Fixes possible conflicts between auxiliary test transport files when project contains multiple environments with different platforms
This commit is contained in:
@@ -17,6 +17,7 @@ from os.path import join
|
||||
import pytest
|
||||
|
||||
from platformio import util
|
||||
from platformio.commands.test.command import cli as cmd_test
|
||||
|
||||
|
||||
def test_local_env():
|
||||
@@ -31,7 +32,49 @@ def test_local_env():
|
||||
]
|
||||
)
|
||||
if result["returncode"] != 1:
|
||||
pytest.fail(result)
|
||||
pytest.fail(str(result))
|
||||
assert all([s in result["err"] for s in ("PASSED", "IGNORED", "FAILED")]), result[
|
||||
"out"
|
||||
]
|
||||
|
||||
|
||||
def test_multiple_env_build(clirunner, validate_cliresult, tmpdir):
|
||||
|
||||
project_dir = tmpdir.mkdir("project")
|
||||
project_dir.join("platformio.ini").write(
|
||||
"""
|
||||
[env:teensy31]
|
||||
platform = teensy
|
||||
framework = mbed
|
||||
board = teensy31
|
||||
|
||||
[env:native]
|
||||
platform = native
|
||||
|
||||
[env:espressif32]
|
||||
platform = espressif32
|
||||
framework = arduino
|
||||
board = esp32dev
|
||||
"""
|
||||
)
|
||||
|
||||
project_dir.mkdir("test").join("test_main.cpp").write(
|
||||
"""
|
||||
#ifdef ARDUINO
|
||||
void setup() {}
|
||||
void loop() {}
|
||||
#else
|
||||
int main() {
|
||||
UNITY_BEGIN();
|
||||
UNITY_END();
|
||||
}
|
||||
#endif
|
||||
"""
|
||||
)
|
||||
|
||||
result = clirunner.invoke(
|
||||
cmd_test, ["-d", str(project_dir), "--without-testing", "--without-uploading"],
|
||||
)
|
||||
|
||||
validate_cliresult(result)
|
||||
assert "Multiple ways to build" not in result.output
|
||||
|
Reference in New Issue
Block a user