darshan-hpc / darshan

Darshan I/O characterization tool
Other
55 stars 27 forks source link

CI: fix mypy errors #977

Closed shanedsnyder closed 4 months ago

shanedsnyder commented 4 months ago

We're getting errors like this in the PyDarshan CI now related to the mypy step:

darshan/tests/test_summary.py:180: error: Module has no attribute "has_log_repo"  [attr-defined]
darshan/tests/test_report.py:32: error: Module has no attribute "has_log_repo"  [attr-defined]

which I think is caused by injecting variables into pytest (and later referencing them in tests), like in conftest.py:

def pytest_configure():
    pytest.has_log_repo = has_log_repo

As a temporary workaround, just remove offending pytest skipif decorators -- it looks like this modification just works and still properly skips tests due to not having the log file repo. The only downside is the skip reason is less helpful now, e.g. instead of:

SKIPPED [1] darshan/tests/test_report.py:32: missing darshan_logs

we now get:

SKIPPED [1] darshan/tests/test_report.py:32: got empty parameter set ['log_filepath'], function test_jobid_type_all_logs_repo_files at /home/shane/software/darshan/darshan-python/darshan-util/pydarshan/darshan/tests/test_report.py:31

I'm open to alternative solutions. I couldn't come up with anything that allows us to detect the presence of the log repo from inside a decorator like that.

shanedsnyder commented 4 months ago

That works for me, too, thanks for the suggestion. I've just pushed in that change and will merge assuming everything passes.