-
Notifications
You must be signed in to change notification settings - Fork 124
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
Failing unit tests when the CLIMADA API is not responding #978
Comments
@emanuel-schmid I had a closer look and I understand where this comes from, but I am not sure how to go about it because I do not fully understand the rationale behind the test files lying in the climada API. I am sure you can enlighten me on this one 😄 My initial guess (but from my current understanding it is wrong) was that Would it not make more sense to have all test files (beside maybe for integration tests) within the git repository, rather than relying on the API? I am sure there are good reasons for the latter. How would you go about solving my issue? I am happy to create a PR if there are small adjustments which would enable to go around this. Let me know what you think. |
@bguillod : thanks for the note. Your initial guess has been correct. The
The crucial values are I'd suggest to replace the target pathes in the sqlite database. You can do that, e.g., like this: import pandas as pd
import sqlite3
old_download_db = "/home/x/climada/data/.downloads.db"
new_download_db = "/home/y/climada/data/.downloads.db"
old_sysdir = "/home/x/climada/data/"
new_sysdir = "/home/y/climada/data/"
downloads = pd.read_sql("select * from download", sqlite3.connect(old_download_db), index_col='id')
downloads.path = downloads.path.apply(lambda x: x.replace(old_sysdir, new_sysdir))
downloads.to_sql("download", sqlite3.connect(new_download_db)) |
The reason why we try to avoid having binary files in the git repository is mainly because we try to avoid binary files, as they are useless for git just increase the size of the repo. |
Describe the bug
Some unit tests rely on the CLIMADA API. This is a problem when automated workflows (e.g. github workflows) are being run which run these tests, as the workflow might fail if the data API happens to be down or not responding at that moment.
I would like to be able to run the
climada.engine.test.test_impact
unit tests independently of the CLIMADA API.To Reproduce
Steps to reproduce the behavior/error:
Code example:
The following error is raised::
Expected behavior
The
climada.engine.test.test_impact
tests (and imho all unit tests) should ideally not rely on the climada API or any internet connection. The latter should only happen in integration tests.Climada Version: 5.0.0
System Information (please complete the following information):
This issue should be system-independent.
The text was updated successfully, but these errors were encountered: