diff --git a/HISTORY.rst b/HISTORY.rst index 2b307a33..7a910971 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -26,6 +26,7 @@ PlatformIO Core 6 * **Unit Testing** + - Updated "Getting Started" documentation for `GoogleTest `__ testing and mocking framework - Export |UNITTESTING| flags only to the project build environment (``projenv``, files in "src" folder) - Merged the "building" stage with "uploading" for the embedded target (`issue #4307 `_) - Do not resolve dependencies from the project "src" folder when the `test_build_src `__ option is not enabled diff --git a/docs b/docs index 519b5db4..03cb09aa 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 519b5db43440c219e6388e6d64f53850bc6882ca +Subproject commit 03cb09aa4c3541c0367e07842aa20e88ba93863e diff --git a/examples b/examples index 6c52fd32..7376c622 160000 --- a/examples +++ b/examples @@ -1 +1 @@ -Subproject commit 6c52fd327753f2ca14b575bd8719674b479e1181 +Subproject commit 7376c6225bccebf5b5f33d6cc099442fad79b30d diff --git a/tests/commands/test_test.py b/tests/commands/test_test.py index 9d7c1dd5..7965d75b 100644 --- a/tests/commands/test_test.py +++ b/tests/commands/test_test.py @@ -13,6 +13,7 @@ # limitations under the License. import os +import shutil import sys import xml.etree.ElementTree as ET from pathlib import Path @@ -26,12 +27,16 @@ from platformio.test.cli import cli as pio_test_cmd def test_calculator_example(tmp_path: Path): junit_output_path = tmp_path / "junit.xml" + project_dir = tmp_path / "project" + shutil.copytree( + os.path.join("examples", "unit-testing", "calculator"), str(project_dir) + ) result = proc.exec_command( [ "platformio", "test", "-d", - os.path.join("examples", "unit-testing", "calculator"), + str(project_dir), "-e", "uno", "-e", @@ -67,11 +72,15 @@ def test_calculator_example(tmp_path: Path): def test_list_tests(clirunner, validate_cliresult, tmp_path: Path): json_output_path = tmp_path / "report.json" + project_dir = tmp_path / "project" + shutil.copytree( + os.path.join("examples", "unit-testing", "calculator"), str(project_dir) + ) result = clirunner.invoke( pio_test_cmd, [ "-d", - os.path.join("examples", "unit-testing", "calculator"), + str(project_dir), "--list-tests", "--json-output-path", str(json_output_path), @@ -593,13 +602,16 @@ int main(int argc, char **argv) def test_googletest_framework(clirunner, tmp_path: Path): - project_dir = os.path.join("examples", "unit-testing", "googletest") + project_dir = tmp_path / "project" + shutil.copytree( + os.path.join("examples", "unit-testing", "googletest"), str(project_dir) + ) junit_output_path = tmp_path / "junit.xml" result = clirunner.invoke( pio_test_cmd, [ "-d", - project_dir, + str(project_dir), "-e", "native", "--junit-output-path",