Skip to content

DOC: Add tips on where to locate test #50050

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion doc/source/development/contributing_codebase.rst
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,22 @@ Writing tests

All tests should go into the ``tests`` subdirectory of the specific package.
This folder contains many current examples of tests, and we suggest looking to these for
inspiration. Ideally, there should be one, and only one, obvious place for a test to reside.
inspiration.

As a general tip, you can use the search functionality in your integrated development
environment (IDE) or the git grep command in a terminal to find test files in which the method
is called. If you are unsure of the best location to put your test, take your best guess,
but note that reviewers may request that you move the test to a different location.

To use git grep, you can run the following command in a terminal:

``git grep "function_name("``

This will search through all files in your repository for the text ``function_name(``.
This can be a useful way to quickly locate the function in the
codebase and determine the best location to add a test for it.

Ideally, there should be one, and only one, obvious place for a test to reside.
Until we reach that ideal, these are some rules of thumb for where a test should
be located.

Expand Down