Skip to content

Avoid initializing output arguments in translated tests#263

Merged
avalentino merged 1 commit into
liberfa:mainfrom
eerovaher:no-output-initialization-in-tests
Jun 3, 2026
Merged

Avoid initializing output arguments in translated tests#263
avalentino merged 1 commit into
liberfa:mainfrom
eerovaher:no-output-initialization-in-tests

Conversation

@eerovaher
Copy link
Copy Markdown
Contributor

Among other things, erfa_generator translates the ERFA tests in t_erfa_c.c into a pytest test suite for pyerfa ufuncs. The C tests have to initialize output arguments (or at least allocate them), but in the Python tests that step can be skipped without losing any test coverage. This PR shortens the generated erfa/tests/test_ufunc.py from 3764 lines to 3617.

Among other things, `erfa_generator` translates the ERFA tests in
`t_erfa_c.c` into a `pytest` test suite for `pyerfa` ufuncs. The C tests
have to initialize output arguments (or at least allocate them), but in
the Python tests that step can be skipped without losing any test
coverage.
Comment thread erfa_generator.py
Comment on lines -416 to +419
# If not, or one of iymdf or ihmsf, ignore (latter are outputs only).
if not rest or rest[:2] == "4]":
if (
not rest
or name in self.func.doc.output # no need to initialize outputs
or name == "iydmf" # eraJdcalf test has a typo
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The typo in the eraJdcalf test also means that iymdf the old comment refers to cannot be found by grepping.

@avalentino avalentino merged commit 1279066 into liberfa:main Jun 3, 2026
28 checks passed
@eerovaher eerovaher deleted the no-output-initialization-in-tests branch June 3, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants