-
Notifications
You must be signed in to change notification settings - Fork 45
Code style in the tests #144
Copy link
Copy link
Open
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentationenhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
It could be possible to change the tests code so that it is easier to read and maintain:
sys.path.appendfor the imports instead of importing torchquad, so__init__.pyis not executed. This also hinders the use of relative imports, e.g. in integration/utils.py.utils_integration_test.pyshows warnings while the other code uses pytest skips if a backend is not installed. The code could be changed so that pytest skips are used everywhere.Some of these changes may however make it more difficult to support the execution of the test files with
python3in addition topytest.A documentation on how to execute the tests could also be helpful, for example because of GPU out-of-memory problems due to the backend imports:
The test executions on GPU currently may require environment variables which change the memory allocation behaviour of the backends since all backends are imported one after another and some of them can reserve the whole GPU memory.
These environment variables are, for example,
XLA_PYTHON_CLIENT_PREALLOCATE=false,TF_FORCE_GPU_ALLOW_GROWTH=trueandTF_GPU_ALLOCATOR=cuda_malloc_async. It is also possible to execute the tests on the CPU withCUDA_VISIBLE_DEVICES="".