Skip to content

Commit 53e5fde

Browse files
Fix pytest-cov crash (#1390)
The `pytest-cov` plugin is used to gather test coverage info, using the `coverage` tool. It suffers from a limitation where child processes created by tests do not inherit the `coverage` configuration from `pyproject.toml` because that file is not on the command line. This limitation is described here nedbat/coveragepy#512 With the introduction of LSP, we started encountering crashes when collecting coverage data, because LSP launches a child process. The solution is to move `coverage` configuration into a dedicated `.coveragerc` file. This PR does just that. Fixes #1363 Co-authored-by: Guenia Izquierdo Delgado <[email protected]>
1 parent e67c31a commit 53e5fde

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

.coveragerc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[run]
2+
branch = true
3+
parallel = true
4+
omit =
5+
src/databricks/labs/remorph/coverage/*
6+
src/databricks/labs/remorph/helpers/execution_time.py
7+
tests/resources/lsp_transpiler/lsp_server.py
8+
__about__.py
9+
10+
[report]
11+
exclude_lines =
12+
no cov
13+
if __name__ == .__main__.:
14+
if TYPE_CHECKING:
15+
def main()

pyproject.toml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -131,21 +131,6 @@ ban-relative-imports = "all"
131131
"ARG001" # tests may not use the provided fixtures
132132
]
133133

134-
[tool.coverage.run]
135-
branch = true
136-
parallel = true
137-
138-
[tool.coverage.report]
139-
omit = ["src/databricks/labs/remorph/coverage/*",
140-
"src/databricks/labs/remorph/helpers/execution_time.py",
141-
"__about__.py"]
142-
exclude_lines = [
143-
"no cov",
144-
"if __name__ == .__main__.:",
145-
"if TYPE_CHECKING:",
146-
"def main()",
147-
]
148-
149134
[tool.pylint.main]
150135
# PyLint configuration is adapted from Google Python Style Guide with modifications.
151136
# Sources https://google.github.io/styleguide/pylintrc

0 commit comments

Comments
 (0)