Commit 23381875 authored by Jérome Perrin's avatar Jérome Perrin

supports PythonScripts >= 5.1

adjust tests to new coverage

switch to pyproject.toml

include a lock file, mostly to keep reference of a working version
parent 80a38d1f
...@@ -87,7 +87,7 @@ class AbstractFileTracerPlugin( ...@@ -87,7 +87,7 @@ class AbstractFileTracerPlugin(
self._options = options self._options = options
def file_tracer(self, filename): def file_tracer(self, filename):
if os.path.basename(filename) in self._base_names: if os.path.basename(filename).split(':')[0] in self._base_names:
return self return self
return None return None
......
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
[project]
name = "erp5_coverage_plugin"
version = "0.0.2"
dependencies = ["coverage>=7.6,<8"]
requires-python = ">=3.9"
description = "Coverage plugin for ERP5 python scripts and components"
readme = { file = "README.md", content-type = "text/markdown" }
[project.optional-dependencies]
test = ["pytest", "Products.PythonScripts"]
[project.urls]
"Homepage" = "https://lab.nexedi.com/nexedi/erp5_coverage_plugin"
from setuptools import find_packages, setup
setup(
name='erp5_coverage_plugin',
version='0.0.1',
packages=find_packages(),
install_requires=['coverage'],
extras_require={'test': ['pytest', 'Products.PythonScripts']},
)
...@@ -121,6 +121,8 @@ TOTAL 4 1 2 1 67% ...@@ -121,6 +121,8 @@ TOTAL 4 1 2 1 67%
assert coverage_process_with_branch_coverage.json_report(outfile=outfile) > 0 assert coverage_process_with_branch_coverage.json_report(outfile=outfile) > 0
script_py_report = json.loads(outfile.read_text())['files']['script.py'] script_py_report = json.loads(outfile.read_text())['files']['script.py']
script_py_report.pop('summary') script_py_report.pop('summary')
script_py_report.pop('classes', None)
script_py_report.pop('functions', None)
assert script_py_report == { assert script_py_report == {
'excluded_lines': [], 'excluded_lines': [],
'executed_branches': [[1, 4]], 'executed_branches': [[1, 4]],
...@@ -159,7 +161,7 @@ def test_python_script_callback_with_branch_coverage( ...@@ -159,7 +161,7 @@ def test_python_script_callback_with_branch_coverage(
Name Stmts Miss Branch BrPart Cover Name Stmts Miss Branch BrPart Cover
----------------------------------------------- -----------------------------------------------
callback.py 1 0 0 0 100% callback.py 1 0 0 0 100%
script.py 5 0 2 1 86% script.py 5 0 2 0 100%
----------------------------------------------- -----------------------------------------------
TOTAL 6 0 2 1 88% TOTAL 6 0 2 0 100%
''' '''
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment