forked from platformio/platformio-core
paths fix for check tool (#4874)
* paths fix for check tool * Minor changes - Handle an edge case on Windows when sources and the project are located on different drives - Cover edge cases with tests --------- Co-authored-by: Valerii Koval <valeros@users.noreply.github.com>
This commit is contained in:
1 parent
d36e39418e
commit
dbe58b49bf
2 files changed
+61
-4
No files matched your search
@@ -803,3 +803,49 @@ check_src_filters =
|
||||
assert errors + warnings + style == EXPECTED_DEFECTS
|
||||
assert "test.cpp" in result.output
|
||||
assert "main.cpp" not in result.output
|
||||
|
||||
|
||||
def test_check_sources_in_project_root(clirunner, validate_cliresult, tmpdir_factory):
|
||||
tmpdir = tmpdir_factory.mktemp("project")
|
||||
|
||||
config = (
|
||||
"""
|
||||
[platformio]
|
||||
src_dir = ./
|
||||
"""
|
||||
+ DEFAULT_CONFIG
|
||||
)
|
||||
tmpdir.join("platformio.ini").write(config)
|
||||
tmpdir.join("main.cpp").write(TEST_CODE)
|
||||
tmpdir.mkdir("spi").join("uart.cpp").write(TEST_CODE)
|
||||
|
||||
result = clirunner.invoke(cmd_check, ["--project-dir", str(tmpdir)])
|
||||
validate_cliresult(result)
|
||||
|
||||
errors, warnings, style = count_defects(result.output)
|
||||
|
||||
assert result.exit_code == 0
|
||||
assert errors + warnings + style == EXPECTED_DEFECTS * 2
|
||||
|
||||
|
||||
def test_check_sources_in_external_dir(clirunner, validate_cliresult, tmpdir_factory):
|
||||
tmpdir = tmpdir_factory.mktemp("project")
|
||||
external_src_dir = tmpdir_factory.mktemp("external_src_dir")
|
||||
|
||||
config = (
|
||||
f"""
|
||||
[platformio]
|
||||
src_dir = {external_src_dir}
|
||||
"""
|
||||
+ DEFAULT_CONFIG
|
||||
)
|
||||
tmpdir.join("platformio.ini").write(config)
|
||||
external_src_dir.join("main.cpp").write(TEST_CODE)
|
||||
|
||||
result = clirunner.invoke(cmd_check, ["--project-dir", str(tmpdir)])
|
||||
validate_cliresult(result)
|
||||
|
||||
errors, warnings, style = count_defects(result.output)
|
||||
|
||||
assert result.exit_code == 0
|
||||
assert errors + warnings + style == EXPECTED_DEFECTS
|
||||
Reference in new issue
Block a user