mwilliamson / spur.py

Run commands and manipulate files locally or over SSH using the same interface
BSD 2-Clause "Simplified" License
267 stars 37 forks source link

Add method to test if result classes are equal #70

Closed ghost closed 6 years ago

ghost commented 6 years ago

This commit adds a method to the ExecutionResult class to allow result classes to be compared and determine if they are equal (contain the exact same values in their attributes). This is useful when tracking multiple results over many SSH connections and also when trying to maintain persistence. When results are stored it is useful to be able to compare to see if data has been changed in any way.

mwilliamson commented 6 years ago

Thanks for the pull request. Is there a reason that this comparison can't be performed without using __eq__ i.e. comparing the attributes individually? I'm somewhat hesitant to change this since it would change the existing behaviour. I wouldn't expect anybody to be relying on the current behaviour, but this seems like a small issue to break backwards compatibility over.

In case it's useful, some feedback on the code itself:

mwilliamson commented 6 years ago

Closing for now, but happy to reconsider. Feel free to leave further comments.