Skip to content

BUG: cadc invompatibility with dev versions of numpy #2811

Closed
@bsipocz

Description

@bsipocz

It's not yet clear whether it's an astroquery issue or something upstream, so I'm cc-ing @pllim, too.
It showed up 2 days ago, CI runs 3 days ago were still fine.

=================================== FAILURES ===================================
________________________________ test_exec_sync ________________________________

tmp_path = PosixPath('/tmp/pytest-of-runner/pytest-0/test_exec_sync0')

    @patch('astroquery.cadc.core.get_access_url',
           Mock(side_effect=lambda x, capability=None: 'https://some.url/'))
    def test_exec_sync(tmp_path):
        # save results in a file
        # create the VOTable result
        # example from http://docs.astropy.org/en/stable/io/votable/
        votable = VOTableFile()
        resource = Resource()
        votable.resources.append(resource)
        table = Table(votable)
        resource.tables.append(table)
        table.fields.extend([
            Field(votable, name="filename", datatype="char", arraysize="*"),
            Field(votable, name="matrix", datatype="double", arraysize="2x2")])
        table.create_arrays(2)
        table.array[0] = ('test1.xml', [[1, 0], [0, 1]])
        table.array[1] = ('test2.xml', [[0.5, 0.3], [0.2, 0.1]])
        buffer = BytesIO()
        votable.to_xml(buffer)
        cadc = Cadc(auth_session=requests.Session())
        response = Mock()
        response.to_table.return_value = table.to_table()
        cadc.cadctap.search = Mock(return_value=response)
    
        output_files = [os.path.join(tmp_path, 'test_vooutput.xml'),
                        Path(tmp_path, 'test_path_vooutput.xml')]
    
        for output_file in output_files:
            cadc.exec_sync('some query', output_file=output_file)
    
            actual = parse(output_file)
            assert len(votable.resources) == len(actual.resources) == 1
            assert len(votable.resources[0].tables) ==\
                len(actual.resources[0].tables) == 1
            actual_table = actual.resources[0].tables[0]
    
>           assert report_diff_values(table, actual_table, fileobj=sys.stdout)
E           assert False
E            +  where False = report_diff_values(<VOTable length=2>\n filename    matrix   \n  object  float64[2,2]\n--------- ------------\ntest1.xml   1.0 .. 1.0\ntest2.xml   0.5 .. 0.1, <VOTable length=2>\n filename    matrix   \n  object  float64[2,2]\n--------- ------------\ntest1.xml     -- .. --\ntest2.xml     -- .. --, fileobj=<_io.TextIOWrapper name="<_io.FileIO name=6 mode='rb+' closefd=True>" mode='r+' encoding='utf-8'>)
E            +    where <_io.TextIOWrapper name="<_io.FileIO name=6 mode='rb+' closefd=True>" mode='r+' encoding='utf-8'> = sys.stdout

../../.tox/py311-test-alldeps-devdeps-cov/lib/python3.11/site-packages/astroquery/cadc/tests/test_cadctap.py:397: AssertionError
----------------------------- Captured stdout call -----------------------------
  a>  filename   matrix  
   ?            -       -
  b>  filename  matrix 
  a> --------- ----------
   ?                   --
  b> --------- --------
  a> test1.xml 1.0 .. 1.0
  a> test2.xml 0.5 .. 0.1
  b> test1.xml -- .. --
  b> test2.xml -- .. --

---------- coverage: platform linux, python 3.11.4-final-0 -----------

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions