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

[Test] Isolate test data from code #3

Closed
isdanni opened this issue May 1, 2023 · 2 comments
Closed

[Test] Isolate test data from code #3

isdanni opened this issue May 1, 2023 · 2 comments

Comments

@isdanni
Copy link

isdanni commented May 1, 2023

For test data such as X_phys and Y_phys in test files like test_Grassmann.py, a good practice would be put test data in a separate file(for example, tests/data/Grassmann.txt) and load it during the test, this way it's easier to manage all the tests. You can also reuse all the test data if needed.

When running pytest using Python 3, I got the following deprecation warnings, which seem to be caused by a few test data formatting. Reading test coordinates from .txt will give you the same error when reading the input, which can help you debug where the issue is.(lint would also be helpful)

====================================== warnings summary ======================================
../venv/lib/python3.8/site-packages/g2aero-0.1.1-py3.8.egg/g2aero/Grassmann.py:56
../venv/lib/python3.8/site-packages/g2aero-0.1.1-py3.8.egg/g2aero/Grassmann.py:56
  /home/user/Documents/code/venv/lib/python3.8/site-packages/g2aero-0.1.1-py3.8.egg/g2aero/Grassmann.py:56: DeprecationWarning: invalid escape sequence \D

../venv/lib/python3.8/site-packages/g2aero-0.1.1-py3.8.egg/g2aero/Grassmann.py:70
../venv/lib/python3.8/site-packages/g2aero-0.1.1-py3.8.egg/g2aero/Grassmann.py:70
  /home/user/Documents/code/venv/lib/python3.8/site-packages/g2aero-0.1.1-py3.8.egg/g2aero/Grassmann.py:70: DeprecationWarning: invalid escape sequence \D

../venv/lib/python3.8/site-packages/g2aero-0.1.1-py3.8.egg/g2aero/SPD.py:103
../venv/lib/python3.8/site-packages/g2aero-0.1.1-py3.8.egg/g2aero/SPD.py:103
  /home/user/Documents/code/venv/lib/python3.8/site-packages/g2aero-0.1.1-py3.8.egg/g2aero/SPD.py:103: DeprecationWarning: invalid escape sequence \i

../venv/lib/python3.8/site-packages/g2aero-0.1.1-py3.8.egg/g2aero/SPD.py:119
../venv/lib/python3.8/site-packages/g2aero-0.1.1-py3.8.egg/g2aero/SPD.py:119
  /home/user/Documents/code/venv/lib/python3.8/site-packages/g2aero-0.1.1-py3.8.egg/g2aero/SPD.py:119: DeprecationWarning: invalid escape sequence \D

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================= 14 passed, 8 warnings in 170.73s (0:02:50) =========================
@isdanni isdanni changed the title Pytest: Isolate test data from code [Test] Isolate test data from code May 1, 2023
@isdanni
Copy link
Author

isdanni commented May 15, 2023

linking openjournals/joss-reviews#5408 for tracking review progress.

@olgadoronina
Copy link
Collaborator

Thanks for the recommendation, we moved the data used for testing to separate files, see commit d10114a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants