From 51ec94f78c1cd4fb2ba61f09828aee75e772b31c Mon Sep 17 00:00:00 2001 From: Valerii Koval Date: Sun, 26 Apr 2020 01:38:25 +0300 Subject: [PATCH] Add new test for PIO Check with --skip-packages option --- tests/commands/test_check.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/commands/test_check.py b/tests/commands/test_check.py index a03f136b..1126bf1d 100644 --- a/tests/commands/test_check.py +++ b/tests/commands/test_check.py @@ -18,6 +18,7 @@ import sys import pytest +from platformio import fs from platformio.commands.check.command import cli as cmd_check DEFAULT_CONFIG = """ @@ -428,3 +429,29 @@ int main() { framework, tool, ) + + +def test_check_skip_includes_from_packages(clirunner, tmpdir): + config = """ +[env:test] +platform = nordicnrf52 +board = nrf52_dk +framework = arduino +""" + + tmpdir.join("platformio.ini").write(config) + tmpdir.mkdir("src").join("main.c").write(TEST_CODE) + + result = clirunner.invoke( + cmd_check, ["--project-dir", str(tmpdir), "--skip-packages", "-v"] + ) + + output = result.output + + project_path = fs.to_unix_path(str(tmpdir)) + for l in output.split("\n"): + if not l.startswith("Includes:"): + continue + for inc in l.split(" "): + if inc.startswith("-I") and project_path not in inc: + pytest.fail("Detected an include path from packages: " + inc)