Skip to content

Commit

Permalink
Merge pull request #38 from radio-astro-tools/astropy6compat
Browse files Browse the repository at this point in the history
Replace astropy-init w/spectral-cube version
  • Loading branch information
keflavich authored Dec 12, 2023
2 parents a10e664 + 3d7ca32 commit d491f5f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 36 deletions.
9 changes: 4 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py{36,37,38,39}-test{,-all,-dev,-novis,-cov,-noopenfiles}
py{36,37,38,39}-test{,-all,-dev,-novis,-cov}
build_docs
codestyle
requires =
Expand Down Expand Up @@ -37,9 +37,8 @@ extras =
all: all
commands =
pip freeze
!cov-!noopenfiles: pytest --open-files --pyargs uvcombine {toxinidir}/docs {posargs}
noopenfiles: pytest --pyargs uvcombine {toxinidir}/docs {posargs}
cov: pytest --open-files --pyargs uvcombine {toxinidir}/docs --cov uvcombine --cov-config={toxinidir}/setup.cfg {posargs}
!cov: pytest --pyargs uvcombine {toxinidir}/docs {posargs}
cov: pytest --pyargs uvcombine {toxinidir}/docs --cov uvcombine --cov-config={toxinidir}/setup.cfg {posargs}
cov: coverage xml -o {toxinidir}/coverage.xml

[testenv:build_docs]
Expand All @@ -56,4 +55,4 @@ commands =
deps = flake8
skip_install = true
commands =
flake8 --max-line-length=100 uvcombine
flake8 --max-line-length=100 uvcombine
35 changes: 4 additions & 31 deletions uvcombine/_astropy_init.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,16 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst

__all__ = ['__version__', '__githash__']

import os
from warnings import warn
from astropy.config.configuration import (
update_default_config,
ConfigurationDefaultMissingError,
ConfigurationDefaultMissingWarning)

from astropy.tests.runner import TestRunner

__all__ = ['__version__', 'test']

try:
from .version import version as __version__
except ImportError:
__version__ = ''

# Create the test function for self test
from astropy.tests.runner import TestRunner
test = TestRunner.make_test_runner_in(os.path.dirname(__file__))
test.__test__ = False
__all__ += ['test']

# add these here so we only need to cleanup the namespace at the end
config_dir = None

if not os.environ.get('ASTROPY_SKIP_CONFIG_UPDATE', False):
config_dir = os.path.dirname(__file__)
config_template = os.path.join(config_dir, __package__ + ".cfg")
if os.path.isfile(config_template):
try:
update_default_config(
__package__, config_dir, version=__version__)
except TypeError as orig_error:
try:
update_default_config(__package__, config_dir)
except ConfigurationDefaultMissingError as e:
wmsg = (e.args[0] +
" Cannot install default profile. If you are "
"importing from source, this is expected.")
warn(ConfigurationDefaultMissingWarning(wmsg))
del e
except Exception:
raise orig_error

0 comments on commit d491f5f

Please sign in to comment.