Skip to content

Commit

Permalink
added new _astropy_init.py
Browse files Browse the repository at this point in the history
  • Loading branch information
wkerzendorf committed Mar 6, 2015
1 parent f6b00b0 commit 65f1285
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions tardis/_astropy_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def test(package=None, test_path=None, args=None, plugins=None,
open_files : bool, optional
Fail when any tests leave files open. Off by default, because
this adds extra run time to the test suite. Works only on
platforms with a working ``lsof`` command.
this adds extra run time to the test suite. Requires the
`psutil` package.
parallel : int, optional
When provided, run the tests in parallel on the specified
Expand All @@ -111,7 +111,6 @@ def test(package=None, test_path=None, args=None, plugins=None,
coverage=coverage, open_files=open_files, **kwargs)

if not _ASTROPY_SETUP_:

import os
from warnings import warn
from astropy import config
Expand All @@ -121,10 +120,19 @@ def test(package=None, test_path=None, args=None, plugins=None,

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

0 comments on commit 65f1285

Please sign in to comment.