Skip to content

Commit

Permalink
fix error message for different python version (#2099)
Browse files Browse the repository at this point in the history
Signed-off-by: changwangss <[email protected]>
  • Loading branch information
changwangss authored Dec 25, 2024
1 parent 9da8f80 commit def933a
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Use this module as an example of how to write new unit tests for layers."""

import os

import sys
import pytest
import torch

Expand Down Expand Up @@ -58,7 +58,12 @@ def run_predefined_config():
run_with_raised_exception(run_predefined_config, FileNotFoundError, "Failed to load file ")
# TODO [SW-196641]: fix the following issue:
elif quant_mode == QuantMode.SHAPE:
run_with_raised_exception(run_predefined_config, UnboundLocalError, "local variable 'fname_base' referenced before assignment")
error_message = (
"cannot access local variable 'fname_base' where it is not associated with a value"
if sys.version_info >= (3, 11)
else "local variable 'fname_base' referenced before assignment"
)
run_with_raised_exception(run_predefined_config, UnboundLocalError, error_message)
else:
run_predefined_config()

Expand Down

0 comments on commit def933a

Please sign in to comment.