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

Avoid unnecessary rebuilds of test targets #47

Merged
merged 1 commit into from
Oct 27, 2024

Conversation

mhx
Copy link
Contributor

@mhx mhx commented Oct 24, 2024

Currently, all targets created by pytest_discover_tests will cause a rebuild every time make / ninja is called, even if no files have changed since the last build.

Quoting the CMake documentation for add_custom_target:

The target has no output file and is always considered out of
date even if the commands try to create a file with the name of
the target. Use the add_custom_command() command to generate a
file with dependencies.

This change should be functionally equivalent, but avoids the indefinite rebuilds because the target will only check for the presence of ${_tests_file} rather than unconditionally building it.

Currently, all targets created by `pytest_discover_tests` will cause
a rebuild *every time* `make` / `ninja` is called, even if no files
have changed since the last build.

Quoting the CMake documentation for `add_custom_target`:

> The target has no output file and is always considered out of
> date even if the commands try to create a file with the name of
> the target. Use the add_custom_command() command to generate a
> file with dependencies.

This change should be functionally equivalent, but avoids the
indefinite rebuilds because the target will only check for the
presence of `${_tests_file}` rather than unconditionally building
it.
@buddly27
Copy link
Collaborator

That's a great update, thanks for contributing!

@buddly27 buddly27 merged commit 7170f87 into python-cmake:main Oct 27, 2024
72 checks passed
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