Quandela / Perceval

An open source framework for programming photonic quantum computers
https://perceval.quandela.net
Other
133 stars 63 forks source link

Unit test modifies access permissions of critical system directory [macOS] #403

Closed burlemarxiste closed 4 weeks ago

burlemarxiste commented 1 month ago

As part of the unit test checking persistent data saving and loading, the access permissions of the parent directory are changed.

https://github.com/Quandela/Perceval/blob/f6669a0da0c5409c197df241265401b240028972/tests/test_persistent_data.py#L116

On macOS, this changes the permissions of /Users/my_user/Library/Application Support/, which contains settings and data for all other installed applications.

Consequences:

In addition, 0o755 or 0o700 might be a more reasonable setting than 0o777 for the folder storing Perceval settings.

Suggested fix: something like pyfakefs if test coverage is essential, if not, excluding the test involving the parent directory?

ericbrts commented 1 month ago

Hi, thanks for this issue. We'll look into it ASAP

ericbrts commented 4 weeks ago

Thanks again for pointing that issue - I've removed problematic parts of the tests, and avoided the removal of actual persistent data while running the test.