Skip to content

Commit fc9a27d

Browse files
authored
Merge pull request #123 from pllim/tst-header
TST: Fix test header in tox, stricter PEP 8
2 parents 52edd86 + 17da462 commit fc9a27d

File tree

4 files changed

+38
-11
lines changed

4 files changed

+38
-11
lines changed

astrowidgets/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Packages may add whatever they like to this file, but
44
# should keep this content at the top.
55
# ----------------------------------------------------------------------------
6-
from ._astropy_init import *
6+
from ._astropy_init import * # noqa
77
# ----------------------------------------------------------------------------
88

9-
from .core import *
9+
from .core import * # noqa

astrowidgets/conftest.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# This file is used to configure the behavior of pytest when using the Astropy
22
# test infrastructure.
3-
import os
4-
53
try:
64
from pytest_astropy_header.display import (PYTEST_HEADER_MODULES,
75
TESTED_VERSIONS)
@@ -11,7 +9,7 @@
119

1210
# Uncomment the following line to treat all DeprecationWarnings as
1311
# exceptions.
14-
# from astropy.tests.helper import enable_deprecations_as_exceptions # noqa
12+
# from astropy.tests.helper import enable_deprecations_as_exceptions
1513
# enable_deprecations_as_exceptions()
1614

1715
# Uncomment and customize the following lines to add/remove entries from
@@ -20,15 +18,14 @@
2018
# the package uses other astropy affiliated packages.
2119
PYTEST_HEADER_MODULES['Astropy'] = 'astropy'
2220
PYTEST_HEADER_MODULES['Ginga'] = 'ginga'
23-
PYTEST_HEADER_MODULES.pop('h5py')
24-
PYTEST_HEADER_MODULES.pop('Pandas')
21+
PYTEST_HEADER_MODULES.pop('h5py', None)
22+
PYTEST_HEADER_MODULES.pop('Pandas', None)
2523

2624
# Uncomment the following lines to display the version number of the
2725
# package rather than the version number of Astropy in the top line when
2826
# running the tests.
2927
try:
30-
from .version import version
28+
from astrowidgets import __version__ as version
3129
except ImportError:
3230
version = 'unknown'
33-
packagename = os.path.basename(os.path.dirname(__file__))
34-
TESTED_VERSIONS[packagename] = version
31+
TESTED_VERSIONS['astrowidgets'] = version

conftest.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This file is used to configure the behavior of pytest when using the Astropy
2+
# test infrastructure.
3+
try:
4+
from pytest_astropy_header.display import (PYTEST_HEADER_MODULES,
5+
TESTED_VERSIONS)
6+
except ImportError:
7+
PYTEST_HEADER_MODULES = {}
8+
TESTED_VERSIONS = {}
9+
10+
# Uncomment the following line to treat all DeprecationWarnings as
11+
# exceptions.
12+
# from astropy.tests.helper import enable_deprecations_as_exceptions
13+
# enable_deprecations_as_exceptions()
14+
15+
# Uncomment and customize the following lines to add/remove entries from
16+
# the list of packages for which version numbers are displayed when running
17+
# the tests. Making it pass for KeyError is essential in some cases when
18+
# the package uses other astropy affiliated packages.
19+
PYTEST_HEADER_MODULES['Astropy'] = 'astropy'
20+
PYTEST_HEADER_MODULES['Ginga'] = 'ginga'
21+
PYTEST_HEADER_MODULES.pop('h5py', None)
22+
PYTEST_HEADER_MODULES.pop('Pandas', None)
23+
24+
# Uncomment the following lines to display the version number of the
25+
# package rather than the version number of Astropy in the top line when
26+
# running the tests.
27+
try:
28+
from astrowidgets import __version__ as version
29+
except ImportError:
30+
version = 'unknown'
31+
TESTED_VERSIONS['astrowidgets'] = version

setup.cfg

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ addopts = -p no:warnings
1111
# E501: line too long
1212
# W503: line break before binary operator
1313
ignore = E501,W503
14-
exclude = setup_package.py,conftest.py,__init__.py
1514

1615
[metadata]
1716
name = astrowidgets

0 commit comments

Comments
 (0)