Closed mx closed 4 years ago
Good stuff. I'm surprised the unit tests didn't catch any of this. Please add at least one unit test that would fail before the change and work after the change.
Some other github issues have been created on this same topic
Please reference these here so we could close them by merging this PR
Please reference these here so we could close them by merging this PR
385
Please add at least one unit test that would fail before the change and work after the change. Done
Not sure how it thinks coverage decreased when I added that test, but I'm gonna guess that's a false positive.
Not sure how it thinks coverage decreased when I added that test, but I'm gonna guess that's a false positive.
It decreased because the 2 lines you added in the unit test
except:
raised = True
were not executed hence decreased coverage (dumb I know..)
Perhaps restructure the unit test into something like
eth = Ethernet(data=b'12345')
assert str(eth)
Not sure how it thinks coverage decreased when I added that test, but I'm gonna guess that's a false positive.
It decreased because the 2 lines you added in the unit test
except: raised = True
were not executed hence decreased coverage (dumb I know..)
Perhaps restructure the unit test into something like
eth = Ethernet(data=b'12345') assert str(eth)
This feels less clear to the viewer than what's going on there now. I can do something like that if you want, but it feels like making it worse in order to please a metric (coverage).
This feels less clear to the viewer than what's going on there now. I can do something like that if you want, but it feels like making it worse in order to please a metric (coverage).
It's rather to satisfy the metric in order to be able to merge. Can't merge it with decreased coverage
This feels less clear to the viewer than what's going on there now. I can do something like that if you want, but it feels like making it worse in order to please a metric (coverage).
It's rather to satisfy the metric in order to be able to merge. Can't merge it with decreased coverage
Done, then.
The remaining coverage failure is because I added the test to main with the other tests.
I was performing a Python3 migration of code that depends on dpkt when I found a problem with bytes(packet) or str(packet). The header packing methods would throw with the following error: "struct.error: argument for 's' must be a bytes object"
Some other github issues have been created on this same topic for specific packet types; I went through and fixed every example that I could find. This should be a NOP in Python2 (as b'' is an alias for '' there), and fix the above errors in Python3.