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

python-helper: update deprecated code #417

Merged
merged 1 commit into from
Mar 9, 2024

Conversation

perillo
Copy link
Contributor

@perillo perillo commented Mar 9, 2024

Currently python-helper.py imports the imp module, but this module has been deprecated since version 3.4 and removed in version 3.12.

Refactorize the code to handle Python versioning by moving the code at the start of the file.

Use one block for python>=3.0, declaring the report_trace_real function. Use a second block for python>=3.5, declaring the new_module function.

Add tests for python2 support.

Fix incorrect code using comparison to None instead of cond is None. Reported by ruff check.

Format the code with ruff format, with line-length = 100.

Currently python-helper.py imports the imp module, but this module has
been deprecated since version 3.4 and removed in version 3.12.

Refactorize the code to handle Python versioning by moving the code at
the start of the file.

Use one block for python>=3.0, declaring the report_trace_real function.
Use a second block for python>=3.5, declaring the new_module function.

Add tests for python2 support.

Fix incorrect code using comparison to `None` instead of `cond is None`.
Reported by ruff check.

Format the code with ruff format, with line-length = 100.
@perillo
Copy link
Contributor Author

perillo commented Mar 9, 2024

Before this change, when building kcov from old master, I got a lot of errors, but now this is fixed. I'm not sure what was causing these failures, probably the deprecation warning for the imp module, when using python3.11.

The only tests that have problems are:

  • bash.bash_stderr_redirection.runTest
    I suspect the problem is that /usr/bin is dash and not bash on my system.
    The fix is simple and I plan to create a new PR.

  • system_mode.system_mode_can_record_and_report_binary.runTest
    No idea about why it hangs forever.

@SimonKagstrom
Copy link
Owner

The system mode test can be removed. System mode has never worked satisfactory anyway, so can be disabled until some major future refactoring.

Thanks a lot for the PR!

@SimonKagstrom SimonKagstrom merged commit 9873fc3 into SimonKagstrom:master Mar 9, 2024
2 of 7 checks passed
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

Successfully merging this pull request may close these issues.

2 participants