Skip to content

Commit

Permalink
Merge pull request #140 from pllim/astropy-4.3-compat
Browse files Browse the repository at this point in the history
MNT: Compat with astropy 4.3
  • Loading branch information
pllim committed Dec 23, 2020
2 parents 2932486 + c7823d3 commit 2960341
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
13 changes: 11 additions & 2 deletions pysynphot/test/test_locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@

import os

from astropy.utils.data import get_pkg_data_filename, _find_pkg_data_path
import astropy
from astropy.utils.data import get_pkg_data_filename
from astropy.utils.introspection import minversion

from .. import locations

ASTROPY_LT_4_3 = not minversion(astropy, '4.3')

if ASTROPY_LT_4_3:
from astropy.utils.data import _find_pkg_data_path as get_pkg_data_path
else:
from astropy.utils.data import get_pkg_data_path


class TestGetRedLaws(object):
"""
Expand All @@ -14,7 +23,7 @@ class TestGetRedLaws(object):
"""
def setup_class(self):
self.old_cdbs = os.environ['PYSYN_CDBS']
locations.rootdir = _find_pkg_data_path(os.path.join('data', 'cdbs'))
locations.rootdir = get_pkg_data_path(os.path.join('data', 'cdbs'))
locations._get_RedLaws()

def teardown_class(self):
Expand Down
15 changes: 12 additions & 3 deletions pysynphot/test/test_ticket157.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

import os

import astropy
import numpy as np
import pytest
from astropy.utils.data import _find_pkg_data_path, get_pkg_data_filename
from astropy.utils.data import get_pkg_data_filename
from astropy.utils.introspection import minversion
from numpy.testing import assert_allclose

from .. import locations, refs
Expand All @@ -18,6 +20,13 @@
old_comptable = None
old_vegafile = None

ASTROPY_LT_4_3 = not minversion(astropy, '4.3')

if ASTROPY_LT_4_3:
from astropy.utils.data import _find_pkg_data_path as get_pkg_data_path
else:
from astropy.utils.data import get_pkg_data_path


def setup_module(module):
"""
Expand Down Expand Up @@ -183,8 +192,8 @@ def setup_class(self):
# (el1302a.fits * 0.5) +
# (el1356a.fits * 0.5) +
# (el2471a.fits * 0.5)
path = _find_pkg_data_path(os.path.join('data', 'generic'),
package='pysynphot')
path = get_pkg_data_path(os.path.join('data', 'generic'),
package='pysynphot')
spz = FileSourceSpectrum(os.path.join(path, 'Zodi.fits')).renorm(
22.7, 'vegamag', ObsBandpass('V'))
self.sp = ((FileSourceSpectrum(os.path.join(path, 'earthshine.fits')) +
Expand Down

0 comments on commit 2960341

Please sign in to comment.