eqcorrscan / EQcorrscan

Earthquake detection and analysis in Python.
https://eqcorrscan.readthedocs.io/en/latest/
Other
166 stars 86 forks source link

[BUG] test_eqcorrscan.py fails when data download fails. #435

Open darren-tpk opened 4 years ago

darren-tpk commented 4 years ago

What do you need help with?

Hi, I am trying to install eqcorrscan but running test_eqcorrscan.py yields "61 failed, 260 passed, 103 errors". I am also trying to go through the tutorials in the docs, but it does not seem to run smoothly. I will raise separate issues as I go along, but I want to make sure the tests run correctly first.

Provide an example so that we can reproduce your problem

Install eqcorrscan via conda install, pip install pytest, run test_eqcorrscan.py.

What help would you like?

"61 failed, 260 passed, 103 errors" does not seem like expected behaviour. Is something not installing right?

What is your setup? (please complete the following information):**

See log here: test_log.txt

calum-chamberlain commented 4 years ago

Kia Ora Darren, it looks like the failed tests were due to a failure to download the test data: all the failed tests that I saw in the log seem to be associated with fails not existing.

Can you please try deleting the test_data directory (/Users/darrentpk/opt/anaconda3/envs/eqcorrscan/lib/python3.8/site-packages/eqcorrscan/tests/test_data) and trying again - this should prompt test_eqcorrscan.py to re-download the test dataset.

darren-tpk commented 4 years ago

Thank you for the prompt response! I tried that, but it seems like the test data still failed to download. I have attached the log again, that includes me removing the test_data directory and running test_eqcorrscan.py twice.

test2_log.txt

calum-chamberlain commented 4 years ago

Ah, apologies, it looks like you need to remove your ~/.eqcorrscan directory as well - the error at the start of the log:

shutil.Error: Destination path '/Users/darrentpk/.eqcorrscan/pytest.ini' already exists

was the failure to overwrite the existing directory that some other necessary files for running the tests are stored. This is annoying, sorry - this should have a change to this line to add in a check for the file and ask for a user response to allow the file to be overwritten, or keep the existing file.

Sorry about that Darren!

darren-tpk commented 4 years ago

No worries! I just ran the test code again and it works well now, with only 1 failed test. I've attached the latest log for your reference. I will be trying out the rest of the tutorials in the days to come. Thank you for your help!

test3_log.txt

calum-chamberlain commented 4 years ago

Thanks for that. That one fail is an annoying doc test fail comparing 1 to 1.0 so nothing to worry about.

calum-chamberlain commented 4 years ago

I'm actually going to re-open this as a reminder to make the test_eqcorrscan script more resilient to failed downloads.

It should:

  1. Take command line args to allow re-downloading without the user having to manually remove directories;
  2. Cope with config files already being there and ask the user if they want to replace them or keep the existing ones (in case the user has changed them)

It would also be good if the script could know what files were expected in the test_data directory and at least tell the user that tests will fail without those files. Not sure how to do that.

calum-chamberlain commented 3 years ago

Bumping to 0.5.0 as we need to get 0.4.3 out and I won't have time to make this improvement before then.