Skip to content

Commit

Permalink
htmlreport: Clean up after review
Browse files Browse the repository at this point in the history
  • Loading branch information
vpetrigo committed May 4, 2024
1 parent cd437ff commit 9d0c441
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/scriptcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,11 @@ jobs:

- name: test htmlreport (standalone)
run: |
htmlreport/tests/test_htmlreport.py
test/tools/test_htmlreport.py
cd htmlreport
./check.sh
# Python 3.5 and 3.6 are excluded as they are not supported by setuptools-scm package for getting
# package version
- name: test htmlreport (pip)
if: matrix.python-version != '3.5' && matrix.python-version != '3.6'
run: |
Expand All @@ -168,7 +169,7 @@ jobs:
python -m pip install -U pip
pip install ./htmlreport/
which cppcheck-htmlreport
PIP_PACKAGE_TEST=1 htmlreport/tests/test_htmlreport.py
PIP_PACKAGE_TEST=1 test/tools/test_htmlreport.py
cd htmlreport
./check.sh
Expand Down
4 changes: 2 additions & 2 deletions htmlreport/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"highlighting."
),
long_description=readme,
author="Henrik Nilsson",
author="Cppcheck Team",
url="https://github.com/danmar/cppcheck",
license="GPL",
packages=find_packages(exclude=("tests", "docs")),
Expand All @@ -25,7 +25,7 @@
"cppcheck-htmlreport = cppcheck_htmlreport:run.main",
]
},
test_suite="tests",
install_requires=["Pygments"],
# Required by setuptools-scm 7.0 for Python 3.7+
setup_requires=["setuptools>=60", "setuptools-scm>=7.0"],
)
File renamed without changes.
File renamed without changes.
9 changes: 5 additions & 4 deletions htmlreport/tests/test_htmlreport.py → test/tools/test_htmlreport.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
else:
import unittest

HTMLREPORT_DIR = os.path.dirname(os.path.abspath(os.path.dirname(__file__)))
ROOT_DIR = os.path.split(HTMLREPORT_DIR)[0]
TEST_TOOLS_DIR = os.path.abspath(os.path.dirname(__file__))
ROOT_DIR = os.path.split(os.path.dirname(TEST_TOOLS_DIR))[0]
HTMLREPORT_DIR = os.path.join(ROOT_DIR, 'htmlreport')
CPPCHECK_BIN = os.path.join(ROOT_DIR, 'cppcheck')

if os.getenv("PIP_PACKAGE_TEST") is not None:
Expand Down Expand Up @@ -68,7 +69,7 @@ def checkReportNoError(self, xml_version):

def testMissingInclude(self):
with runCheck(
xml_filename=os.path.join(ROOT_DIR, 'htmlreport', 'example.xml'),
xml_filename=os.path.join(TEST_TOOLS_DIR, 'example.xml'),
) as (report, output_directory):
self.assertIn('<html', report)

Expand Down Expand Up @@ -104,7 +105,7 @@ def runCheck(source_filename=None, xml_version='1', xml_filename=None):
[*HTML_REPORT_BIN,
'--file=' + os.path.realpath(xml_filename),
'--report-dir=' + os.path.realpath(output_directory)],
cwd=os.path.join(ROOT_DIR, 'htmlreport'))
cwd=TEST_TOOLS_DIR)

with open(os.path.join(output_directory, 'index.html')) as index_file:
index_contents = index_file.read()
Expand Down

0 comments on commit 9d0c441

Please sign in to comment.