spectral icon indicating copy to clipboard operation
spectral copied to clipboard

Unit Tests Fail

Open CA4GitHub opened this issue 4 years ago • 2 comments

With spectral 0.22.2 (installed via pip), numpy 1.21.1, and python 3.9.5, the spectral unit tests (e.g. python -m spectral.tests.run) fail. Note I do have the sample data files installed in a dir specified by the environment variable SPECTRAL_DATA.

The tests fail the "Running memep tests" portion as shown in the pic with the error:

image

I tried manually running memmap tests in memmap.py. It seemed to me that the issue is around the spy.envi.save_image call in create_test_image_file method of SpyFileMemmapTest class. From there it seems like the error is triggered by the builtins.open call in the _write_image method of the envi.py file.

CA4GitHub avatar Jul 26 '21 21:07 CA4GitHub

Thanks for the error report and additional info. I don't currently have access to a Windows system with python 3.9. Perhaps you could check a few additional things:

  1. Did the directory C:\spectral_test_files exist after you ran the unit tests and, if so, were there any files in it?
  2. Does the following work for you from the python command line?
import builtins
builtins.open('C:\\spectral_test_files\memmap_test_bil.img', 'wb', 1000)

tboggs avatar Jul 27 '21 17:07 tboggs

I've added python 3.9 to the build matrix for unit testing and it passes (on ubuntu):

https://github.com/spectralpython/spectral/actions/runs/1072623339

tboggs avatar Jul 27 '21 20:07 tboggs