spectralpython / spectral

Python module for hyperspectral image processing
MIT License
563 stars 138 forks source link

Unit Tests Fail #126

Open CA4GitHub opened 2 years ago

CA4GitHub commented 2 years ago

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.

tboggs commented 2 years ago

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 commented 2 years ago

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