Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code style in the tests #144

Open
FHof opened this issue Apr 30, 2022 · 0 comments
Open

Code style in the tests #144

FHof opened this issue Apr 30, 2022 · 0 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@FHof
Copy link
Collaborator

FHof commented Apr 30, 2022

It could be possible to change the tests code so that it is easier to read and maintain:

  • Currently the tests use sys.path.append for the imports instead of importing torchquad, so __init__.py is not executed. This also hinders the use of relative imports, e.g. in integration/utils.py.
  • It may be possible to shorten the code by replacing the setup_test_for_backend with parameterized tests.
  • utils_integration_test.py shows 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 python3 in addition to pytest.

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=true and TF_GPU_ALLOCATOR=cuda_malloc_async. It is also possible to execute the tests on the CPU with CUDA_VISIBLE_DEVICES="".

@gomezzz gomezzz added documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed labels May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants