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

pipx run coverage lcov -o coverage.lcov yields No data to report on GitHub actions (maybe namespace issue?) #730

Open
sgbaird opened this issue Aug 4, 2023 · 2 comments

Comments

@sgbaird
Copy link

sgbaird commented Aug 4, 2023

Description of your problem

I've been having a lot of trouble with coverage with the setup in PyScaffold. Maybe it has something to do with me using namespace packages. There's a discrepancy between what's running via GitHub actions and what runs locally, and it's not clear where in the tangle of packages and interfaces the issue is arising from.

Please provide a minimal, self-contained, and reproducible example.
Here is a Colab reproducer that shows I can get coverage manually pretty easily, though it's not exactly what happens in GitHub actions. I've found it really tough to debug things within GitHub actions, so any help in pointing me in the right direction if something sticks out to you is appreciated. The reproducer invokes tox followed by the coverage command.

!git clone https://github.com/sgbaird/honegumi.git # can pin to aa25acc810e8f5e26e5dd5cd14d6970459c58168 if needed
%cd /content/honegumi
!git checkout ax
%pip install tox
%pip install -e .[testing]
!tox

Workflow that failed

pipx run coverage lcov -o coverage.lcov
  pipx run coverage lcov -o coverage.lcov
  shell: /usr/bin/bash -e {0}
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.8.17/x64
    PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.8.17/x64/lib/pkgconfig
    Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.17/x64
    Python[2](https://github.com/sgbaird/honegumi/actions/runs/5765391843/job/15631277720?pr=4#step:6:2)_ROOT_DIR: /opt/hostedtoolcache/Python/[3](https://github.com/sgbaird/honegumi/actions/runs/5765391843/job/15631277720?pr=4#step:6:3).8.17/x6[4](https://github.com/sgbaird/honegumi/actions/runs/5765391843/job/15631277720?pr=4#step:6:4)
    Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.8.17/x[6](https://github.com/sgbaird/honegumi/actions/runs/5765391843/job/15631277720?pr=4#step:6:6)4
    LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.8.1[7](https://github.com/sgbaird/honegumi/actions/runs/5765391843/job/15631277720?pr=4#step:6:7)/x64/lib
creating virtual environment...
installing coverage...
No data to report.
Error: Process completed with exit code 1.

Versions and main components

  • PyScaffold Version: This project has been set up using PyScaffold 4.4.1 and the dsproject extension 0.7.2.
  • Python Version: 3.8.*
  • Operating system: Ubuntu (GitHub Actions)
  • How did you install PyScaffold: pip I think
sgbaird added a commit to sgbaird/honegumi that referenced this issue Aug 4, 2023
Until it gets resolved in pyscaffold/pyscaffold#730. Web of dependencies and use of GitHub actions makes it difficult to troubleshoot.
@abravalheri
Copy link
Collaborator

Hi @sgbaird, sorry for the delay.

I am trying to understand your reproducer and see what might be happening.
From the .coveragerc in your repo, we know that the only modules that the coverage will try to measure is honegumi.core and honegumi.ax:

# .coveragerc to control coverage.py
[run]
branch = True
source =
    honegumi.core
    honegumi.ax
# omit = bad_file.py

But in your honegumi/tests/generated_scripts/ax/test_* files you have:

from ax.service.ax_client import AxClient

I wonder how you are managing to import from ax when your package is honegumi.ax?

Maybe if your coverage is configured to report on honegumi.ax but you are importing ax, isn't it the reason why the coverage data files are missing?

@sgbaird
Copy link
Author

sgbaird commented Aug 21, 2023

Great catch. That was a bad naming convention on my part. I need to rename honegumi.ax to something else, since ax is coming from the ax-platform external dependency. Also, the directory called "generated" or something within tests is meant to be ignored (which I thought I specified adequately in other settings, but I can double check).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants