|
1 | 1 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
|
| 2 | +import os |
2 | 3 |
|
3 |
| -__all__ = ['__version__'] |
4 |
| - |
5 |
| -# this indicates whether or not we are in the package's setup.py |
6 |
| -try: |
7 |
| - _ASTROPY_SETUP_ |
8 |
| -except NameError: |
9 |
| - import builtins |
10 |
| - builtins._ASTROPY_SETUP_ = False |
| 4 | +__all__ = ['__version__', 'test'] |
11 | 5 |
|
12 | 6 | try:
|
13 | 7 | from .version import version as __version__
|
14 | 8 | except ImportError:
|
15 | 9 | __version__ = ''
|
16 | 10 |
|
17 |
| - |
18 |
| -if not _ASTROPY_SETUP_: # noqa |
19 |
| - import os |
20 |
| - from warnings import warn |
21 |
| - from astropy.config.configuration import ( |
22 |
| - update_default_config, |
23 |
| - ConfigurationDefaultMissingError, |
24 |
| - ConfigurationDefaultMissingWarning) |
25 |
| - |
26 |
| - # Create the test function for self test |
27 |
| - from astropy.tests.runner import TestRunner |
28 |
| - test = TestRunner.make_test_runner_in(os.path.dirname(__file__)) |
29 |
| - test.__test__ = False |
30 |
| - __all__ += ['test'] |
31 |
| - |
32 |
| - # add these here so we only need to cleanup the namespace at the end |
33 |
| - config_dir = None |
34 |
| - |
35 |
| - if not os.environ.get('ASTROPY_SKIP_CONFIG_UPDATE', False): |
36 |
| - config_dir = os.path.dirname(__file__) |
37 |
| - config_template = os.path.join(config_dir, __package__ + ".cfg") |
38 |
| - if os.path.isfile(config_template): |
39 |
| - try: |
40 |
| - update_default_config( |
41 |
| - __package__, config_dir, version=__version__) |
42 |
| - except TypeError as orig_error: |
43 |
| - try: |
44 |
| - update_default_config(__package__, config_dir) |
45 |
| - except ConfigurationDefaultMissingError as e: |
46 |
| - wmsg = (e.args[0] + |
47 |
| - " Cannot install default profile. If you are " |
48 |
| - "importing from source, this is expected.") |
49 |
| - warn(ConfigurationDefaultMissingWarning(wmsg)) |
50 |
| - del e |
51 |
| - except Exception: |
52 |
| - raise orig_error |
| 11 | +# Create the test function for self test |
| 12 | +from astropy.tests.runner import TestRunner |
| 13 | +test = TestRunner.make_test_runner_in(os.path.dirname(__file__)) |
0 commit comments