Skip to content

Commit 078c024

Browse files
DOC: Add tips on where to locate test (#50050)
1 parent 7c208c8 commit 078c024

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

doc/source/development/contributing_codebase.rst

+16-1
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,22 @@ Writing tests
338338

339339
All tests should go into the ``tests`` subdirectory of the specific package.
340340
This folder contains many current examples of tests, and we suggest looking to these for
341-
inspiration. Ideally, there should be one, and only one, obvious place for a test to reside.
341+
inspiration.
342+
343+
As a general tip, you can use the search functionality in your integrated development
344+
environment (IDE) or the git grep command in a terminal to find test files in which the method
345+
is called. If you are unsure of the best location to put your test, take your best guess,
346+
but note that reviewers may request that you move the test to a different location.
347+
348+
To use git grep, you can run the following command in a terminal:
349+
350+
``git grep "function_name("``
351+
352+
This will search through all files in your repository for the text ``function_name(``.
353+
This can be a useful way to quickly locate the function in the
354+
codebase and determine the best location to add a test for it.
355+
356+
Ideally, there should be one, and only one, obvious place for a test to reside.
342357
Until we reach that ideal, these are some rules of thumb for where a test should
343358
be located.
344359

0 commit comments

Comments
 (0)