always use assertutil for assertions #1968

Open
opened 2013-05-09 21:55:53 +00:00 by zooko · 2 comments

Debugging #1742, we have the following report from a customer:

  File "/root/allmydata-tahoe-1.10.0/src/allmydata/mutable/retrieve.py", line 299, in _setup_download
    assert len(self.remaining_sharemap) >= k
exceptions.AssertionError: 

It would be helpful if we had instead received this from the customer:

  File "/root/allmydata-tahoe-1.10.0/src/allmydata/mutable/retrieve.py", line 299, in _setup_download
    _assert(len(self.remaining_sharemap) >= k, lenr=len(self.remaining_sharemap), k=k)
  File "/root/allmydata-tahoe-1.10.0/src/allmydata/util/assertutil.py", line 24, in _assert
    raise AssertionError, "".join(msgbuf)
AssertionError: lenr: 0 <type 'int'>, 'k': 1 <type 'int'>

Our wiki/CodingStandards doc says to use assertutil. To close this ticket, find all uses of assert in our codebase and change them to assertutil.

Debugging #1742, we have the following report from a customer: ``` File "/root/allmydata-tahoe-1.10.0/src/allmydata/mutable/retrieve.py", line 299, in _setup_download assert len(self.remaining_sharemap) >= k exceptions.AssertionError: ``` It would be helpful if we had instead received this from the customer: ``` File "/root/allmydata-tahoe-1.10.0/src/allmydata/mutable/retrieve.py", line 299, in _setup_download _assert(len(self.remaining_sharemap) >= k, lenr=len(self.remaining_sharemap), k=k) File "/root/allmydata-tahoe-1.10.0/src/allmydata/util/assertutil.py", line 24, in _assert raise AssertionError, "".join(msgbuf) AssertionError: lenr: 0 <type 'int'>, 'k': 1 <type 'int'> ``` Our [wiki/CodingStandards](wiki/CodingStandards) doc says to use assertutil. To close this ticket, find all uses of `assert` in our codebase and change them to assertutil.
zooko added the
code
minor
defect
1.10.0
labels 2013-05-09 21:55:53 +00:00
zooko added this to the undecided milestone 2013-05-09 21:55:53 +00:00
daira commented 2013-05-11 00:25:33 +00:00
Owner

This would also fix #1944.

This would also fix #1944.
daira commented 2013-05-23 17:52:04 +00:00
Owner

This would also fix #1085.

This would also fix #1085.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Reference: tahoe-lafs/trac-2024-07-25#1968
No description provided.