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

pytest-cmake does not discover new tests #50

Closed
AmeyaVSingh opened this issue Jan 9, 2025 · 3 comments
Closed

pytest-cmake does not discover new tests #50

AmeyaVSingh opened this issue Jan 9, 2025 · 3 comments
Assignees

Comments

@AmeyaVSingh
Copy link

When developing tests using pytest.

The pytest_discover_tests cmake function does not automatically update new tests if new tests are implemented.
In the build directory if not cleaned every time.

Possible workaround to explicitly list the python sources as dependencies under pytest_discover_tests function.

pytest_discover_tests(
    PythonTest
    DEPENDS <list of python test files>
)
@buddly27
Copy link
Collaborator

I'm a bit reluctant to rely on DEPENDS for this, as it is already used for dependent libraries. That said, it does get the job done, and I agree that manually cleaning the build directory each time is quite cumbersome. I'll have a look at it over the weekend!

@buddly27
Copy link
Collaborator

I considered reusing the pytest --collect-only command to deduce dependent Python test files for the target, but I feel this approach would add unnecessary complexity to the script and increase the potential for errors. It could also negatively impact configuration performance, especially when collecting tests from a large directory structure.

So, I reverted to your suggestion of simply documenting using DEPENDS to ensure that the target is rebuilding whenever a Python test is changed (#52)

Thanks for pointing it out!

@AmeyaVSingh
Copy link
Author

Thank you for the update.

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

No branches or pull requests

2 participants