[path] Add warning for tests using "api.path[...]"

Bug: 329113288
Change-Id: Id624ef0e7bc0bc6d5f63b66641f2f398e97a098c
Reviewed-on: https://chromium-review.googlesource.com/c/infra/luci/recipes-py/+/5546654
Reviewed-by: Robbie Iannucci <iannucci@chromium.org>
Commit-Queue: Rob Mohr <mohrr@google.com>
diff --git a/recipe.warnings b/recipe.warnings
index c1c2d87..3f65abd 100644
--- a/recipe.warnings
+++ b/recipe.warnings
@@ -105,6 +105,15 @@
 }
 
 warning {
+  name: "PATH_GETITEM_DEPRECATED"
+  description: "Accessors like api.path['start_dir'] are deprecated."
+  description: ""
+  description: "Use a member like api.path.start_dir instead"
+  deadline: "2024-07-15"
+  google_issue { id: 329113288 }
+}
+
+warning {
   name: "PATH_IS_PARENT_OF_DEPRECATED"
   description: "config_types.Path.is_parent_of() is deprecated."
   description: ""
diff --git a/recipe_modules/path/test_api.py b/recipe_modules/path/test_api.py
index aac30ae..a37fae7 100644
--- a/recipe_modules/path/test_api.py
+++ b/recipe_modules/path/test_api.py
@@ -73,6 +73,9 @@
       * checkout_dir (but use of checkout_dir is generally discouraged - just
       pass the Paths around instead of using this global variable).
     """
+
+    self.m.warning.issue('PATH_GETITEM_DEPRECATED')
+
     match name:
       case 'cache':
         return self.cache_dir
diff --git a/recipe_modules/path/tests/deprecated.py b/recipe_modules/path/tests/deprecated.py
index 20c0035..e1f98fd 100644
--- a/recipe_modules/path/tests/deprecated.py
+++ b/recipe_modules/path/tests/deprecated.py
@@ -25,6 +25,8 @@
 
 
 def GenTests(api):
+
+  @recipe_api.ignore_warnings('recipe_engine/PATH_GETITEM_DEPRECATED')
   def equals(name):
     return api.post_process(post_process.StepTextEquals, name, api.path[name])