OpenwaterHealth / OpenwaterHealth/openlifu-python

Logger issue when running test_sim by itself

Open
#328 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs-triage:reproduced
Dominant language
Python
Stars
27
Forks
21
Avg merge
1d 20m
Merged PRs (30d)
6

Description

When running pytest -k test_sim rather than just pytest, we get a logging related error

def getMessage(self):
        """
        Return the message for this LogRecord.
    
        Return the message for this LogRecord after merging any user-supplied
        arguments with the message.
        """
        msg = str(self.msg)
        if self.args:
>           msg = msg % self.args
E           TypeError: not all arguments converted during string formatting

msg        = '  reference sound speed: '
self       = <LogRecord: root, 20, /home/ebrahim/openwater/.venv3.11/lib/python3.11/site-packages/kwave/kWaveSimulation_helper/set_sound_speed_ref.py, 89, "  reference sound speed: ">

/usr/local/lib/python3.11/logging/__init__.py:377: TypeError

This is a k-wave bug that was solved in https://github.com/waltsims/k-wave-python/pull/458, however sicne k-wave dropped python3.9 support before they fixed this bug we cannot upgrade just yet (see #167).

We don't see the issue in the CI because when all tests are run at once the logging handlers are probably set to some kind of null handler.

We can wait until the constraint #167 is relaxed and this will be fixed. Or we can fix it right away by silencing logs in an appropriate way.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running pytest -k test_sim and compare it with a full pytest run to reproduce the logging failure. Read the logging setup around the isolated test and constraint #167, then use k-wave PR #458 as context; done means the focused test completes without the TypeError while the Python 3.9 constraint remains respected.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.