fix: silence SyntaxWarning and tensor copy-construct UserWarning in tests#654
Conversation
swahtz
left a comment
There was a problem hiding this comment.
Thanks for your contribution @mvanhorn. This looks fine to me but I'm not sure where the changes are you mention regarding the regex/string literal warnings; perhaps it's in a commit not pushed up here? Otherwise the fixes for the other issues look good to me, thanks
The two test failures are just:
- DCO: The ASWF requires that all commits are signed off. This can be done with
git commit -swhen committing and the only thing to watch out for is that your sign-off uses the same email address that you use for your Github account. You'll just have to do re-write those comments and do a force push up to your branch to clear that status check - Pip env test failures. I believe this issue was fixed after you branched from
main, so you just need to mergemaininto your branch. The issue is that pip is pulling in a newer pytorch version than desired (since a new minor version was released recently).
…ests Tests had Python 3.12 SyntaxWarnings from invalid escape sequences in regex strings and torch UserWarnings from copy-constructing tensors. Switch the strings to raw literals and use `tensor.clone()` instead of `torch.tensor(existing_tensor)` so the warnings disappear without changing test behavior. Fixes openvdb#260 Signed-off-by: Matt Van Horn <mvanhorn@gmail.com>
00fc4f9 to
938789d
Compare
|
Amended the commit with Signed-off-by in 938789d for the DCO check. The CUDA Doc/Unit test failures look unrelated to this test-only diff (which just silences |
|
The test failure that you're encountering above has been fixed. Please merge in the latest from the |
|
Merged the latest main into the branch. CI is re-running now and should pick up the fix. Thanks for sorting that out. |
Summary
Silences two classes of test noise reported in #260:
SyntaxWarning: invalid escape sequencefrom regex strings using\d,\s, etc. in non-raw literals.UserWarning: To copy construct from a tensorfromtorch.tensor(existing_tensor)calls.Test behavior is unchanged - this is purely warning hygiene.
Why this matters
The test output is loud enough that real failure signal gets lost in the warning stream. #260 specifically asked for the warning-cleanup pass.
Changes
tests/unit/test_dense_interface.py- raw-string regex literals.tests/unit/test_inject.py- raw-string regex literals +tensor.clone()for the copy-construct sites.tests/unit/test_types.py- raw-string regex literal.Testing
Running the affected test files produces 0 warnings now; all assertions still pass.
Fixes #260