Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for coverage #775

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/autotest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ jobs:
pip install 'numpy<2'
pip install pywin32
}
python -m unittest discover -v -s ./comtypes/test -t comtypes\test
pip install coverage[toml]
coverage run -m unittest discover -v -s comtypes\test -t comtypes\test
- name: Run coverage report
run: coverage report
- name: Unregister the OutProc COM server
run: |
cd source/CppTestSrv
Expand Down
4 changes: 2 additions & 2 deletions comtypes/test/test_comserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ def test_eval(self):
obj = self.create_object()

def func():
return obj.eval("(1, 2, 3)")
return obj.eval("1 + 2")

self.assertEqual(func(), (1, 2, 3)) # type: ignore
self.assertEqual(func(), 3) # type: ignore
self._find_memleak(func)

def test_get_typeinfo(self):
Expand Down
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,9 @@ ignore = ["E402"]
"comtypes/test/test_subinterface.py" = ["E401", "F401", "F403", "F405"]
"comtypes/test/test_urlhistory.py" = ["E401", "F401", "F403", "F405", "F841"]
"comtypes/test/test_variant.py" = ["F401", "F821", "F841"]

[tool.coverage.run]
# Specify the source directory to avoid tracking temporary files created by "test_client_regenerate_modules.py".
# Without this, coverage track these temporary files, leading to error when trying to generate a report.
source = ["comtypes"]
omit = ["comtypes/gen/*", "comtypes/test/*"]
Loading