#!/usr/bin/env python """Test cppcheck-htmlreport.""" import os import contextlib import shutil import subprocess import sys import tempfile if sys.version_info < (2, 7): # For TestCase.assertIn(). import unittest2 as unittest else: import unittest ROOT_DIR = os.path.split(os.path.abspath(os.path.dirname(__file__)))[0] CPPCHECK_BIN = os.path.join(ROOT_DIR, 'cppcheck') HTML_REPORT_BIN = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'cppcheck-htmlreport') class TestHTMLReport(unittest.TestCase): def testReportError(self): for xml_version in ['2']: self.checkReportError(xml_version) def checkReportError(self, xml_version): with runCheck( os.path.join(ROOT_DIR, 'samples', 'memleak', 'bad.c'), xml_version=xml_version ) as (report, output_directory): self.assertIn('