diff options
Diffstat (limited to 'test/integration/targets/ansible-test-coverage-windows/test-coverage.py')
-rw-r--r-- | test/integration/targets/ansible-test-coverage-windows/test-coverage.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/integration/targets/ansible-test-coverage-windows/test-coverage.py b/test/integration/targets/ansible-test-coverage-windows/test-coverage.py new file mode 100644 index 0000000000..98dbca7437 --- /dev/null +++ b/test/integration/targets/ansible-test-coverage-windows/test-coverage.py @@ -0,0 +1,27 @@ +from __future__ import annotations + +import json +import os +import os.path + + +def main() -> None: + collection_root = os.getcwd() + print(f"Running windows-integration coverage test in '{collection_root}'") + + result_path = os.path.join(collection_root, "tests", "output", "coverage", "coverage-powershell") + module_path = os.path.join(collection_root, "plugins", "modules", "win_collection.ps1") + test_path = os.path.join(collection_root, "tests", "integration", "targets", "win_collection", "library", "test_win_collection.ps1") + with open(result_path, mode="rb") as fd: + data = json.load(fd) + + for path, result in data.items(): + print(f"Testing result for path '{path}' -> {result!r}") + assert path in [module_path, test_path], f"Found unexpected coverage result path '{path}'" + assert result == {'5': 1, '6': 1}, "Coverage result did not pick up a hit on lines 5 and 6" + + assert len(data) == 2, f"Expected coverage results for 2 files but got {len(data)}" + + +if __name__ == '__main__': + main() |