Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor gaia/tests/test_gaiatap.py #2556

Merged
merged 7 commits into from
Nov 9, 2022

Conversation

eerovaher
Copy link
Member

It was possible to shorten the gaia non-remote tests quite a lot without losing any test coverage. The refactored code is much less verbose and much easier to read. See the commit messages for more details.

The section about server messages has been removed from
`test_query_object()` because it duplicates code in
`test_show_message()`.
The function `__check_results_column()` tested if the attributes (e.g.
description) of the columns of the query results match the expectation.
This function is now replaced with
`astropy.table.BaseColumn.attrs_equal()`, and the comparison data is now
provided by a `pytest` fixture.
The new module level fixtures allowed removing setup code from many
tests.
By refactoring the code it was possible to shorten it without losing
test coverage.
`pytest` produces informative assert failure messages automatically.
Grouping the tests together in a test class served no purpose and
eliminating the class removed a level of indentation.
@codecov
Copy link

codecov bot commented Oct 12, 2022

Codecov Report

Merging #2556 (01dc91c) into main (5af5780) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main    #2556   +/-   ##
=======================================
  Coverage   63.97%   63.97%           
=======================================
  Files         132      132           
  Lines       16984    16984           
=======================================
  Hits        10866    10866           
  Misses       6118     6118           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

One of the effects of
astropy/astropy@e9d13fc is that
`"_votable_string_dtype"` key together with the corresponding value gets
added to the metadata of columns read from a VOTable. That commit is
included in `astropy` versions 4.1 and later, but is missing from 4.0.
The fixture that generates data for column attribute comparison in
`gaia` tests now takes the `astropy` version into account.
Copy link
Member

@bsipocz bsipocz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @eerovaher!

@bsipocz bsipocz merged commit 76b046b into astropy:main Nov 9, 2022
@eerovaher eerovaher deleted the gaia-tests-refactor branch November 9, 2022 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants