Description
When run independently, specifically without the config tests run before, all cosmology tests under mypackage/io are failing with
astropy.io.registry.base.IORegistryError: No writer defined for format 'mypackage' ...
Expected behavior
Modular testing of subpackages and filtered subsets should pass in the same way as when running the full suite.
Actual behavior
astropy.test(package='cosmology') and/or
Steps to Reproduce
astropy.test(args='-vk test_package')
...
plugins: arraydiff-0.3, astropy-header-0.1.2, mock-3.6.1, flaky-3.7.0, remotedata-0.3.2, xdist-2.4.0, asdf-2.8.1, forked-1.3.0, openfiles-0.5.0, doctestplus-0.11.0, cov-3.0.0, filter-subpackage-0.1.1, flake8-1.0.7, mpl-0.13, expect-1.1.0, hypothesis-6.8.9
collected 19675 items / 19657 deselected / 3 skipped / 15 selected
../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_convert.py::TestAstropyCosmologyConvert::test_package_equality[acosmo0] FAILED [ 5%]
../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_convert.py::TestAstropyCosmologyConvert::test_package_equality[acosmo1] FAILED [ 11%]
../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_convert.py::TestAstropyCosmologyConvert::test_package_equality[acosmo2] FAILED [ 16%]
../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_convert.py::TestAstropyCosmologyConvert::test_package_equality[acosmo3] FAILED [ 22%]
../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_convert.py::TestAstropyCosmologyConvert::test_package_equality[acosmo4] FAILED [ 27%]
../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_convert.py::TestAstropyCosmologyConvert::test_package_equality[acosmo5] FAILED [ 33%]
../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_convert.py::TestAstropyCosmologyConvert::test_package_equality[acosmo6] FAILED [ 38%]
../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_convert.py::TestAstropyCosmologyConvert::test_package_equality[acosmo7] FAILED [ 44%]
../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_convert.py::TestAstropyCosmologyConvert::test_package_equality[acosmo8] FAILED [ 50%]
../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_io.py::TestAstropyCosmologyIO::test_package_equality[Planck18-myformat] FAILED [ 55%]
../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_io.py::TestAstropyCosmologyIO::test_package_equality[Planck18_arXiv_v2-myformat] FAILED [ 61%]
../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_io.py::TestAstropyCosmologyIO::test_package_equality[Planck15-myformat] FAILED [ 66%]
../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_io.py::TestAstropyCosmologyIO::test_package_equality[Planck13-myformat] FAILED [ 72%]
../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_io.py::TestAstropyCosmologyIO::test_package_equality[WMAP9-myformat] FAILED [ 77%]
../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_io.py::TestAstropyCosmologyIO::test_package_equality[WMAP7-myformat] FAILED [ 83%]
../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_io.py::TestAstropyCosmologyIO::test_package_equality[WMAP5-myformat] FAILED [ 88%]
../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_io.py::TestAstropyCosmologyIO::test_package_equality[WMAP3-myformat] FAILED [ 94%]
../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_io.py::TestAstropyCosmologyIO::test_package_equality[WMAP1-myformat] FAILED [100%]
===================================================================================== FAILURES =====================================================================================
____________________________________________________________ TestAstropyCosmologyConvert.test_package_equality[acosmo0] ____________________________________________________________
self = <astropy.cosmology.tests.mypackage.io.tests.test_astropy_convert.TestAstropyCosmologyConvert object at 0x12f3efbe0>
acosmo = FlatLambdaCDM(name="Planck18", H0=67.7 km / (Mpc s), Om0=0.31, Tcmb0=2.725 K, Neff=3.05, m_nu=[0. 0. 0.06] eV, Ob0=0.049)
@pytest.mark.parametrize("acosmo", astropy_cosmos)
def test_package_equality(self, acosmo):
"""
The most important test: are the ``mypackage`` and ``astropy``
cosmologies equivalent!? They should be if read from the same source
file.
"""
# convert to ``mypacakge``
> mycosmo = acosmo.to_format("mypackage")
/opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_convert.py:72:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/opt/lib/python3.8/site-packages/astropy/cosmology/connect.py:265: in __call__
return self.registry.write(self._instance, None, *args, format=format,
/opt/lib/python3.8/site-packages/astropy/io/registry/core.py:353: in write
writer = self.get_writer(format, data.__class__)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <astropy.io.registry.core.UnifiedIORegistry object at 0x10fdd74c0>, data_format = 'mypackage', data_class = <class 'astropy.cosmology.flrw.FlatLambdaCDM'>
def get_writer(self, data_format, data_class):
"""Get writer for ``data_format``.
Parameters
----------
data_format : str
The data format identifier. This is the string that is used to
specify the data type when reading/writing.
data_class : class
The class of the object that can be written.
Returns
-------
writer : callable
The registered writer function for this format and class.
"""
writers = [(fmt, cls) for fmt, cls in self._writers if fmt == data_format]
for writer_format, writer_class in writers:
if self._is_best_match(data_class, writer_class, writers):
return self._writers[(writer_format, writer_class)][0]
else:
format_table_str = self._get_format_table_str(data_class, 'Write')
> raise IORegistryError(
"No writer defined for format '{}' and class '{}'.\n\nThe "
"available formats are:\n\n{}".format(
data_format, data_class.__name__, format_table_str))
E astropy.io.registry.base.IORegistryError: No writer defined for format 'mypackage' and class 'FlatLambdaCDM'.
E
E The available formats are:
E
E Format Read Write Auto-identify
E ------------- ---- ----- -------------
E astropy.model Yes Yes Yes
E astropy.table Yes Yes Yes
E mapping Yes Yes Yes
/opt/lib/python3.8/site-packages/astropy/io/registry/core.py:309: IORegistryError
...
FAILED ../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_convert.py::TestAstropyCosmologyConvert::test_package_equality[acosmo0] - as...
FAILED ../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_convert.py::TestAstropyCosmologyConvert::test_package_equality[acosmo1] - as...
FAILED ../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_convert.py::TestAstropyCosmologyConvert::test_package_equality[acosmo2] - as...
FAILED ../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_convert.py::TestAstropyCosmologyConvert::test_package_equality[acosmo3] - as...
FAILED ../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_convert.py::TestAstropyCosmologyConvert::test_package_equality[acosmo4] - as...
FAILED ../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_convert.py::TestAstropyCosmologyConvert::test_package_equality[acosmo5] - as...
FAILED ../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_convert.py::TestAstropyCosmologyConvert::test_package_equality[acosmo6] - as...
FAILED ../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_convert.py::TestAstropyCosmologyConvert::test_package_equality[acosmo7] - as...
FAILED ../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_convert.py::TestAstropyCosmologyConvert::test_package_equality[acosmo8] - as...
FAILED ../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_io.py::TestAstropyCosmologyIO::test_package_equality[Planck18-myformat] - as...
FAILED ../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_io.py::TestAstropyCosmologyIO::test_package_equality[Planck18_arXiv_v2-myformat]
FAILED ../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_io.py::TestAstropyCosmologyIO::test_package_equality[Planck15-myformat] - as...
FAILED ../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_io.py::TestAstropyCosmologyIO::test_package_equality[Planck13-myformat] - as...
FAILED ../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_io.py::TestAstropyCosmologyIO::test_package_equality[WMAP9-myformat] - astro...
FAILED ../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_io.py::TestAstropyCosmologyIO::test_package_equality[WMAP7-myformat] - astro...
FAILED ../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_io.py::TestAstropyCosmologyIO::test_package_equality[WMAP5-myformat] - astro...
FAILED ../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_io.py::TestAstropyCosmologyIO::test_package_equality[WMAP3-myformat] - astro...
FAILED ../../opt/lib/python3.8/site-packages/astropy/cosmology/tests/mypackage/io/tests/test_astropy_io.py::TestAstropyCosmologyIO::test_package_equality[WMAP1-myformat] - astro...
=========================================================== 18 failed, 3 skipped, 18806 deselected, 3 warnings in 6.19s ============================================================
The tests all pass as soon as astropy.test(package='config') has been run beforehand.
System Details
[same for Python 3.9.6 + 3.10.0 and Matplotlib 3.5.0rc1]
Running tests with Astropy version 5.0rc1.
Running tests in astropy.
Date: 2021-11-06T00:28:41
Platform: macOS-10.14.6-x86_64-i386-64bit
Executable: /opt/bin/python3.8
Full Python Version:
3.8.11 (default, Jul 19 2021, 15:45:25)
[Clang 11.0.0 (clang-1100.0.33.17)]
encodings: sys: utf-8, locale: UTF-8, filesystem: utf-8
byteorder: little
float info: dig: 15, mant_dig: 15
Package versions:
Numpy: 1.21.2
Scipy: 1.7.1
Matplotlib: 3.4.2
h5py: 2.10.0
Pandas: 1.2.4
PyERFA: 2.0.0
Cython: 0.29.24
Scikit-image: not available
asdf: 2.8.1
Description
When run independently, specifically without the config tests run before, all cosmology tests under mypackage/io are failing with
astropy.io.registry.base.IORegistryError: No writer defined for format 'mypackage' ...
Expected behavior
Modular testing of subpackages and filtered subsets should pass in the same way as when running the full suite.
Actual behavior
astropy.test(package='cosmology') and/or
Steps to Reproduce
The tests all pass as soon as astropy.test(package='config') has been run beforehand.
System Details
[same for Python 3.9.6 + 3.10.0 and Matplotlib 3.5.0rc1]
Running tests with Astropy version 5.0rc1.
Running tests in astropy.
Date: 2021-11-06T00:28:41
Platform: macOS-10.14.6-x86_64-i386-64bit
Executable: /opt/bin/python3.8
Full Python Version:
3.8.11 (default, Jul 19 2021, 15:45:25)
[Clang 11.0.0 (clang-1100.0.33.17)]
encodings: sys: utf-8, locale: UTF-8, filesystem: utf-8
byteorder: little
float info: dig: 15, mant_dig: 15
Package versions:
Numpy: 1.21.2
Scipy: 1.7.1
Matplotlib: 3.4.2
h5py: 2.10.0
Pandas: 1.2.4
PyERFA: 2.0.0
Cython: 0.29.24
Scikit-image: not available
asdf: 2.8.1