if we wanted to upload a `coverage.json` file from...
# general
n
if we wanted to upload a
coverage.json
file from Pytest to CI, would we have to
--keep-sandboxes
and get the file from there? thanks!
b
Pants has some built-in support for emitting coverage info: https://www.pantsbuild.org/2.19/docs/python/goals/test#coverage Are you currently using that?
n
yes, the question is now uploading that coverage file to a third-party code quality providre
b
Cool! As I understand it, activating the pants options causes it to synthesise a report and write it into the repository somewhere, not just leave it in a temporary sandbox. If you run one test, what’s pants’ output?
n
I don't see the file in my code folder where I edit code, but I do see the
coverage.json
file if I run
--keep-sandboxes
and check in that folder
b
Right. It sounds like somewhere along the line, pants isn’t behaving how it should. Can you share the output pants prints to the terminal? If you can, sharing your
pants.toml
file and the exact pants command you’re running will help me help you too
n
Copy code
pants --keep-sandboxes=always test ::
[GLOBAL]
pants_version = "2.19.0"
backend_packages = [
  "pants.backend.build_files.fmt.black",
  "pants.backend.shell",
  "pants.backend.docker",
  "pants.backend.docker.lint.hadolint",
  "pants.backend.python",
  "pants.backend.python.lint.autoflake",
  "pants.backend.python.lint.black",
  "pants.backend.python.lint.isort",
  "pants.backend.python.lint.pydocstyle",
  "pants.backend.python.typecheck.mypy",
]

[python-bootstrap]
search_path = [
  # This will use the pyenv version specified in the .python-version file
  "<PYENV_LOCAL>",
]

[python]
interpreter_constraints = ["==3.11.*"]
enable_resolves = true
resolves = { python-default = "python-default.lock" }
pip_version = "latest"

[isort]
args = ["--profile", "black"]

[pydocstyle]
args = ["--select", "D102,D105,D103"]

[source]
root_patterns = ["/"]

[hadolint]
args = ["--ignore", "DL3007"]

[test]
extra_env_vars = ["DATABASE_URL", "CI"]
use_coverage = true

[mypy]
args = ["--ignore-missing-imports"]

[coverage-py]
fail_under = 10
global_report = true
report = ["console", "lcov"]
oh nvm I see it in
dist/coverage/python
now
I probably had something wrong
b
Ah, cool! Found! 👍
🙏 1
n
thanks for the help!