NVIDIA / cuda-quantum

C++ and Python support for the CUDA Quantum programming model for heterogeneous quantum-classical workflows
https://nvidia.github.io/cuda-quantum/
Other
427 stars 149 forks source link

Python formatting of tests not enforced in CI #630

Open anthony-santana opened 10 months ago

anthony-santana commented 10 months ago

Required prerequisites

Describe the bug

We run a python formatting check in the CI with yapf, but it appears that it's not actually being enforced. This can be confirmed by pip install yapf, then pulling down CUDA Quantum main and running yapf cuda-quantum/python/tests/unittests -r -i. For main to be passing the CI, yapf should produce no changes to the code. Instead, it has to reformat multiple files -- indicating the python formatting step isn't throwing an error when it should be.

Steps to reproduce the bug

$ pip install yapf
$ yapf cuda-quantum/python/tests/unittests -r -i

Expected behavior

An error should be thrown in the CI if the python files have not been formatted through yapf.

Is this a regression? If it is, put the last known working version (or commit) here.

Not a regression

Environment

Suggestions

No response

bettinaheim commented 10 months ago

Hi @anthony-santana, I believe the style should be enforced, but certain folders, like the tests, are currently excluded for the style check. You can see which files are excluded here. I don't remember why I excluded them; it might be that they can be properly formatted, or it might be that some tests make that difficult.