Failed tests: cannot represent an object: RepresenterError
Closed this issue · 6 comments
Hi,
During the upgrade of dependencies chain for Guix astro packages, I've faced with error
when asdf-astropy is failed to pass unit tests with new asdf@3.1.0
<...>
_____________________ test_serialization[version6-time18] ______________________
[gw2] linux -- Python 3.10.7 /gnu/store/jh59fh48mcffyz5wmsjj0p96xkkflbz0-python-wrapper-3.10.7/bin/python
time = <Time object: scale='utc' format='ymdhms' value=(2010, 3, 1, 0, 0, 0.)>
version = AsdfVersion('1.6.0')
tmp_path = PosixPath('/tmp/guix-build-python-asdf-astropy-0.5.0.drv-0/pytest-of-nixbld/pytest-0/popen-gw2/test_serialization_version6_ti2')
@pytest.mark.parametrize("time", create_times())
@pytest.mark.parametrize("version", asdf.versioning.supported_versions)
def test_serialization(time, version, tmp_path):
file_path = tmp_path / "test.asdf"
with asdf.AsdfFile(version=version) as af:
af["time"] = time
> af.write_to(file_path)
asdf_astropy/converters/time/tests/test_time.py:55:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/gnu/store/f3b1r7ivvz64qx00bmqbbxqz3y8cak71-python-asdf-3.1.0/lib/python3.10/site-packages/asdf/_asdf.py:1231: in write_to
self._serial_write(fd, pad_blocks, include_block_index)
/gnu/store/f3b1r7ivvz64qx00bmqbbxqz3y8cak71-python-asdf-3.1.0/lib/python3.10/site-packages/asdf/_asdf.py:998: in _serial_write
self._write_tree(tree, fd, pad_blocks)
/gnu/store/f3b1r7ivvz64qx00bmqbbxqz3y8cak71-python-asdf-3.1.0/lib/python3.10/site-packages/asdf/_asdf.py:970: in _write_tree
yamlutil.dump_tree(
/gnu/store/f3b1r7ivvz64qx00bmqbbxqz3y8cak71-python-asdf-3.1.0/lib/python3.10/site-packages/asdf/yamlutil.py:408: in dump_tree
yaml.dump_all(
/gnu/store/5waxhk0gwydl7gq6jlzhy56pry8pvjf2-python-pyyaml-6.0/lib/python3.10/site-packages/yaml/__init__.py:241: in dump_all
dumper.represent(data)
/gnu/store/5waxhk0gwydl7gq6jlzhy56pry8pvjf2-python-pyyaml-6.0/lib/python3.10/site-packages/yaml/representer.py:27: in represent
node = self.represent_data(data)
/gnu/store/f3b1r7ivvz64qx00bmqbbxqz3y8cak71-python-asdf-3.1.0/lib/python3.10/site-packages/asdf/yamlutil.py:39: in represent_data
node = super().represent_data(data)
/gnu/store/5waxhk0gwydl7gq6jlzhy56pry8pvjf2-python-pyyaml-6.0/lib/python3.10/site-packages/yaml/representer.py:48: in represent_data
node = self.yaml_representers[data_types[0]](self, data)
/gnu/store/f3b1r7ivvz64qx00bmqbbxqz3y8cak71-python-asdf-3.1.0/lib/python3.10/site-packages/asdf/yamlutil.py:59: in represent_mapping
node = super(AsdfDumper, dumper).represent_mapping(None, mapping.data, flow_style)
/gnu/store/5waxhk0gwydl7gq6jlzhy56pry8pvjf2-python-pyyaml-6.0/lib/python3.10/site-packages/yaml/representer.py:118: in represent_mapping
node_value = self.represent_data(item_value)
/gnu/store/f3b1r7ivvz64qx00bmqbbxqz3y8cak71-python-asdf-3.1.0/lib/python3.10/site-packages/asdf/yamlutil.py:39: in represent_data
node = super().represent_data(data)
/gnu/store/5waxhk0gwydl7gq6jlzhy56pry8pvjf2-python-pyyaml-6.0/lib/python3.10/site-packages/yaml/representer.py:58: in represent_data
node = self.yaml_representers[None](self, data)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <asdf.yamlutil.AsdfDumper object at 0x27c1cc0>
data = <Time object: scale='utc' format='ymdhms' value=(2010, 3, 1, 0, 0, 0.)>
def represent_undefined(self, data):
> raise RepresenterError("cannot represent an object", data)
E yaml.representer.RepresenterError: ('cannot represent an object', <Time object: scale='utc' format='ymdhms' value=(2010, 3, 1, 0, 0, 0.)>)
/gnu/store/5waxhk0gwydl7gq6jlzhy56pry8pvjf2-python-pyyaml-6.0/lib/python3.10/site-packages/yaml/representer.py:231: RepresenterError
=========================== short test summary info ============================
FAILED asdf_astropy/converters/time/tests/test_time.py::test_serialization[version6-time7]
FAILED asdf_astropy/converters/time/tests/test_time.py::test_serialization[version6-time3]
FAILED asdf_astropy/converters/time/tests/test_time.py::test_serialization[version6-time15]
FAILED asdf_astropy/converters/time/tests/test_time.py::test_serialization[version6-time4]
FAILED asdf_astropy/converters/time/tests/test_time.py::test_serialization[version6-time5]
FAILED asdf_astropy/converters/time/tests/test_time.py::test_serialization[version6-time11]
FAILED asdf_astropy/converters/time/tests/test_time.py::test_serialization[version6-time6]
FAILED asdf_astropy/converters/time/tests/test_time.py::test_serialization[version6-time12]
FAILED asdf_astropy/converters/time/tests/test_time.py::test_serialization[version6-time13]
FAILED asdf_astropy/converters/time/tests/test_time.py::test_serialization[version6-time19]
FAILED asdf_astropy/converters/time/tests/test_time.py::test_serialization[version6-time1]
FAILED asdf_astropy/converters/time/tests/test_time.py::test_serialization[version6-time2]
FAILED asdf_astropy/converters/time/tests/test_time.py::test_serialization[version6-time14]
FAILED asdf_astropy/converters/time/tests/test_time.py::test_serialization[version6-time0]
FAILED asdf_astropy/converters/time/tests/test_time.py::test_serialization[version6-time9]
FAILED asdf_astropy/converters/time/tests/test_time.py::test_serialization[version6-time10]
FAILED asdf_astropy/converters/time/tests/test_time.py::test_serialization[version6-time8]
FAILED asdf_astropy/converters/time/tests/test_time.py::test_serialization[version6-time20]
FAILED asdf_astropy/converters/time/tests/test_time.py::test_serialization[version6-time16]
FAILED asdf_astropy/converters/time/tests/test_time.py::test_serialization[version6-time17]
FAILED asdf_astropy/converters/time/tests/test_time.py::test_serialization[version6-time18]
======================= 21 failed, 3981 passed in 22.61s =======================
python-asdf-astropy@0.5.0
- python-asdf-coordinates-schemas@0.2.0
- python-asdf-transform-schemas@0.5.0
- python-asdf@3.1.0
- python-astropy@6.0.0
- python-coverage@6.4.3
- python-h5py@3.8.0
- python-numpy@1.23.2
- python-packaging@21.3
- python-pandas@1.5.3
- python-pytest-astropy@0.11.0
- python-scipy@1.12.0
- python-semantic-version@2.8.5
- python-setuptools-scm@7.1.0
Thanks for opening the issue. This failure is expected.
Unfortunately the released versions of asdf-astropy contain tests for a development version of the standard (the version6
mentioned in the test name). The development version of the standard has changed which is resulting in the test failure(s). This has been addressed in main
(see #219) and a new version of asdf-astropy will be released.
Is it possible to skip these tests for the older version during packaging?
Hi @braingram
Thank you for detailed response!
I've skipped one test for asdf-astropy@0.5.0
-k not test_serialization
Meanwhile I've bumped all ASDF related projects to their latest versions which
were released few days ago. May I keep this issue open until a new version of
asdf-astropy is released?
Thanks! Keeping this open sounds great. I will pin it in case others run into the same issue.
A new version of asdf-astropy (0.6.0) is now available:
https://pypi.org/project/asdf-astropy/0.6.0/
that fixes the failing tests.
I'm going to unpin this issue but leave it open. Let me know if you run into any issues. Also feel free to close this issue if you have a chance to test if the new release fixes the issue.
Hi,
Thank you for the update.
I've refreshed the asdf-astropy
version to prepare it for the Guix scheduled
update to 0.6.0. It was built and all unit tests passed successfully!
...
============================ 4013 passed in 23.73s =============================
The first level of inputs:
- python-coverage@6.4.3
- python-h5py@3.8.0
- python-pandas@1.5.3
- python-pytest-astropy@0.11.0
- python-scipy@1.12.0
- python-semantic-version@2.8.5
- python-setuptools-scm@7.1.0
- python-asdf@3.1.0
- python-asdf-coordinates-schemas@0.3.0
- python-asdf-transform-schemas@0.5.0
- python-astropy@6.0.0
- python-numpy@1.23.2
- python-packaging@21.3
Dependent packages were also checked and re-built successfully.
guix refresh --list-dependent python-asdf-astropy
Building the following 6 packages would ensure 24 dependent packages are
rebuilt: python-astroalign@2.5.1 python-aplpy@2.1.0 ginga-qt5@5.0.0
python-ginga@5.0.0 python-radiospectra@0.5.0 python-jwst@1.13.4
Closing as resolved with 0.6.0 verion.
Thanks for the update, for opening the issue and for packaging asdf-astropy!