-
Notifications
You must be signed in to change notification settings - Fork 949
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use mock.patch.object to avoid protected access errors. #2253
Use mock.patch.object to avoid protected access errors. #2253
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments, but the most important one:
You already submitted #2251 to solve this problem, seems you did not complete your work. Having 2 PR solving the same problem in the same file is over the top, and wasting my time, since I have to review them.
Please do not submit more PR to test_transaction.py unless they contain more than cosmetic changes, meaning real code change.
@@ -90,7 +91,9 @@ def test_calculate_exception_length(self): | |||
) | |||
|
|||
@mock.patch("pymodbus.transaction.time") | |||
def test_execute(self, mock_time): | |||
@mock.patch.object(SyncModbusTransactionManager, "_recv") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is wrong, it change the scope from class to local.
@@ -353,19 +353,18 @@ def callback(data): | |||
# for name in ("transaction_id", "protocol_id", "slave_id"): | |||
# assert getattr(expected, name) == getattr(actual, name) | |||
|
|||
def test_tcp_framer_packet(self): | |||
@mock.patch.object(ModbusRequest, "encode") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems a number of the patch objects could be done at class level.
Um, it's a different file right? Path for this PR looks to be |
If you had a look at the files you would see it’s the same file, just copied to prepare for major changes. tbc == to be changed |
Yeah...I missed that somehow, had assumed it wasn't an exact duplicate so had applied the same fixes from the other one.
Um, so I should make sure changes are duplicated between the files? |
No you should not touch a file marked "to be changed" unless you want to change it as intended. |
How is it intended to be changed? |
Read the issues, it will be integrated in framers. |
This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days. |
This PR was closed because it has been stalled for 10 days with no activity. |
No description provided.