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

Possible Python version issues with test framework #46

Open
jlyke-keck opened this issue Jan 12, 2017 · 1 comment
Open

Possible Python version issues with test framework #46

jlyke-keck opened this issue Jan 12, 2017 · 1 comment

Comments

@jlyke-keck
Copy link
Contributor

From Mate Adamkovics:

Hi Jim,

I've just installed the OSIRIS pipeline and ran into the following error on the tests. I think it just has to do with which files are listed in sky.xml vs which ones are most recently used as reference files on the repo.

Not a huge deal, hope this helps. run_odrp works fine and I'll let you know if I run into any other issues.

Also of minor note, the Ureka python is deprecated (see here; http://ssb.stsci.edu/ureka/), but with AstroPy I didn't need it anyway.

Lastly, it seems that just a few print statements and the urllib might be keeping the code from being python3 compatible. You might consider if it is worth bothering to put in a few control statements for python versions or maybe even a few try/except sections to make the drp more universal.

Just some thoughts! Hope all is well and thanks.

-Mate

haze:/Applications/OsirisDRP$ /Library/Frameworks/Python.framework/Versions/2.7/bin/py.test
======================================================================================= test session starts ========================================================================================
platform darwin -- Python 2.7.9, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
rootdir: /Applications/OsirisDRP, inifile:
collected 2 items

tests/test_checkskylines/test_checkskylines.py E
tests/test_emission_line/test_emission_line.py .

======================================================== ERRORS ========================================================
____________________________________________ ERROR at setup of test_skyline ____________________________________________

request = <SubRequest 'drf_queue' for <Function 'test_skyline'>>

@pytest.fixture(scope="module")
def drf_queue(request):
    """Fixture for preparing the queue."""
    queue_directory = os.path.dirname(str(request.fspath))
  setup_test_data(queue_directory)

tests/drptestbones/fixtures.py:17:


tests/drptestbones/fetchdata.py:33: in setup_test_data
get_calib_file(file_to_fetch)


file_name = 's160416_c006___infl_Kbb_035.fits', refresh = False

def get_calib_file(file_name, refresh=False):
    """
    Fetch a file for the specified test from a URL.
    The mapping between test name, file name, and URL is in the file
    map_file_urls.txt.
    """
    # Get directories.
    dir_testbones = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
    dir_tests = os.path.dirname(dir_testbones)
    dir_calib = dir_tests + '/calib/'

    # Get the file name where we will deposit the file.
    file_save_name = dir_calib + file_name

    if os.path.exists(file_save_name) and not refresh:
        return

    # Read the map
    map_file = dir_testbones + '/map_file_urls.txt'
    data_map = Table.read(map_file, format='ascii.commented_header')

    # Search for the requested filename
    idx = np.where((data_map['test_name'] == 'calib') & (data_map['file_name'] == file_name))[0]

    if len(idx) > 1:
        print 'Found duplicate entries in map_file: {0:s}. '.format(map_file)
        print 'Using the first one. Duplicates are:'
        print data_map[idx]

    if len(idx) == 0:
      raise KeyError(file_name)

E KeyError: 's160416_c006___infl_Kbb_035.fits'

tests/drptestbones/fetchdata.py:126: KeyError
========================================== 1 passed, 1 error in 41.18 seconds ==========================================

think it's just a matter of filen

@followthesheep
Copy link
Contributor

I think the problem with the test has to do with the correct files not being available in dropbox.

The python 3 issues I think we'll need to push to the next release.

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