Skip to content

Broken test for duplicate error codes #71

Closed
@sbrugman

Description

@sbrugman

Issue

The test that checks whether there are any duplicate error codes never fails.
The TOR203 error code is defined three times and the test still passes:

https://github.com/pytorch-labs/torchfix/blob/main/torchfix/visitors/vision/singleton_import.py#L9

Root cause

The test itself checks if it has already seen the TorchError object, not the specific error code:

https://github.com/pytorch-labs/torchfix/blob/main/tests/test_torchfix.py#L68

Because the object is initialised three times, the objects are distinct.

Solution

The test should check on the error code and the TorchError should only be initialised once in singleton import.

As a fix I'd like to directly address #6, by improving the TorchError data structure. (Already got the code)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions