-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Copy link
Labels
bugSomething isn't workingSomething isn't working
Description
Problem/Opportunity
The pingTest method conditionally logs the time taken for a device to respond to a ping based on the logPingTime flag. However, the variable elapsed_string—which stores the formatted duration—is only defined inside the if logPingTime: block. If the ping fails and logPingTime is set to False, the method attempts to reference elapsed_string in the error log, resulting in an UnboundLocalError.
This leads to a secondary failure that masks the original issue (i.e., the device not responding to ping), making debugging more difficult
Steps to reproduce
While running L4 WiFi Ethernet suite issue, we are able to reproduce it
Expected Behavior
Expected Behavior
- The pingTest method should execute reliably regardless of whether logPingTime is set to True or False.
- If the ping fails, the method should raise an exception with a clear and informative message.
- All variables used in exception messages (such as elapsed_string) should be properly defined in all code paths.
- The method should not raise unrelated runtime errors (e.g., UnboundLocalError) that obscure the actual cause of failure.
Actual Behavior
- When logPingTime is set to False and the ping fails, the method attempts to reference the variable elasped_string, which is only defined inside the if logPingTime: block.
- This results in an UnboundLocalError, such as:
UnboundLocalError: local variable 'elasped_string' referenced before assignment
Notes (Optional)
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working