nutanix / libvfio-user

framework for emulating devices in userspace
BSD 3-Clause "New" or "Revised" License
162 stars 51 forks source link

fix Python tests to work under flake8 5.0.4 #737

Closed brvtalcake closed 1 year ago

brvtalcake commented 1 year ago

Some of the tests didn't work, due to small syntax errors (at least for the last one). The second test didn't work either, but I don't know why, I didn't really dig further.

tmakatos commented 1 year ago

The current syntax is correct, can you explain what you mean by "Some of the tests didn't work, due to small syntax errors"?

brvtalcake commented 1 year ago

I do not remember the errors (and I'm not currently at home), but when running the tests python3 was unhappy about asserts with parentheses (I think I have 3.11). I do not know python to be honest, but removing the parentheses solved the problem for one of the tests (maybe python was actually not understanding why parentheses were attached to the asserts, thus corresponding to a function call ?). The only thing I can say for sure is that wasn't an assert failure, but a syntax error.

I'll be soon at home (≈ 45 minutes) to show you the error logs

brvtalcake commented 1 year ago

Here are the logs (without my fix, on Ubuntu 23.04, with python 3.11.2):

PXL_20230621_090212155.MP.jpg

tmakatos commented 1 year ago

This seems legitimate, I think it's more related to your flake8 version rather than Python itself, can you state both versions please?

brvtalcake commented 1 year ago

My flake8 version is 5.0.4 (mccabe: 0.7.0, pycodestyle: 2.10.0, pyflakes: 2.5.0)

brvtalcake commented 1 year ago

Oh actually yes it's for sure a flake8 "error". Then my bad I really thought that was python :/