Merge branch 'main' into avm99963-monorail
Merged commit 34d8229ae2b51fb1a15bd208e6fe6185c94f6266
GitOrigin-RevId: 7ee0917f93a577e475f8e09526dd144d245593f4
diff --git a/search/test/ast2ast_test.py b/search/test/ast2ast_test.py
index 9edeaf1..cd50b18 100644
--- a/search/test/ast2ast_test.py
+++ b/search/test/ast2ast_test.py
@@ -1,17 +1,17 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file or at
-# https://developers.google.com/open-source/licenses/bsd
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
"""Tests for the ast2ast module."""
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
+import six
import unittest
-from proto import ast_pb2
-from proto import tracker_pb2
+from mrproto import ast_pb2
+from mrproto import tracker_pb2
from search import ast2ast
from search import query2ast
from services import service_manager
@@ -182,7 +182,7 @@
self.assertEqual(
'Searching for issues accross multiple/all projects without '
'project prefixes is ambiguous and is currently not supported.',
- cm.exception.message)
+ str(cm.exception))
def testPreprocessBlockedOnCond_WithExternalIssues(self):
blockedon_field = BUILTIN_ISSUE_FIELDS['blockedon']
@@ -322,7 +322,7 @@
self.assertEqual(
'Searching for issues accross multiple/all projects without '
'project prefixes is ambiguous and is currently not supported.',
- cm.exception.message)
+ str(cm.exception))
def testPreprocessBlockingCond_WithExternalIssues(self):
blocking_field = BUILTIN_ISSUE_FIELDS['blocking']
@@ -452,19 +452,19 @@
ast_pb2.QueryOp.IS_DEFINED, [BUILTIN_ISSUE_FIELDS['label']],
['Priority', 'Severity'], [])
regex = ast2ast._MakePrefixRegex(cond)
- self.assertRegexpMatches('Priority-1', regex)
- self.assertRegexpMatches('Severity-3', regex)
- self.assertNotRegexpMatches('My-Priority', regex)
+ self.assertRegex('Priority-1', regex)
+ self.assertRegex('Severity-3', regex)
+ self.assertNotRegex('My-Priority', regex)
def testKeyValueRegex(self):
cond = ast_pb2.MakeCond(
ast_pb2.QueryOp.KEY_HAS, [BUILTIN_ISSUE_FIELDS['label']],
['Type-Feature', 'Type-Security'], [])
regex = ast2ast._MakeKeyValueRegex(cond)
- self.assertRegexpMatches('Type-Feature', regex)
- self.assertRegexpMatches('Type-Bug-Security', regex)
- self.assertNotRegexpMatches('Type-Bug', regex)
- self.assertNotRegexpMatches('Security-Feature', regex)
+ self.assertRegex('Type-Feature', regex)
+ self.assertRegex('Type-Bug-Security', regex)
+ self.assertNotRegex('Type-Bug', regex)
+ self.assertNotRegex('Security-Feature', regex)
def testKeyValueRegex_multipleKeys(self):
cond = ast_pb2.MakeCond(
@@ -478,8 +478,8 @@
ast_pb2.QueryOp.TEXT_HAS, [BUILTIN_ISSUE_FIELDS['label']],
['Type-Bug'], [])
regex = ast2ast._MakeKeyValueRegex(cond)
- self.assertRegexpMatches('Type-Bug-Security', regex)
- self.assertNotRegexpMatches('Type-BugSecurity', regex)
+ self.assertRegex('Type-Bug-Security', regex)
+ self.assertNotRegex('Type-BugSecurity', regex)
def testPreprocessLabelCond(self):
label_field = BUILTIN_ISSUE_FIELDS['label']
@@ -693,7 +693,7 @@
self.cnxn, cond, [1], self.services, None, True)
self.assertEqual(ast_pb2.QueryOp.EQ, actual.op)
self.assertEqual([hotlist_id_field], actual.field_defs)
- self.assertItemsEqual([10, 30, 40, 50, 60], actual.int_values)
+ six.assertCountEqual(self, [10, 30, 40, 50, 60], actual.int_values)
def testPreprocessHotlistCond_UserNotFound(self):
hotlist_field = BUILTIN_ISSUE_FIELDS['hotlist']
diff --git a/search/test/ast2select_test.py b/search/test/ast2select_test.py
index f20d524..903c8c8 100644
--- a/search/test/ast2select_test.py
+++ b/search/test/ast2select_test.py
@@ -1,7 +1,6 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file or at
-# https://developers.google.com/open-source/licenses/bsd
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
"""Tests for the ast2select module."""
from __future__ import print_function
@@ -13,8 +12,8 @@
import unittest
from framework import sql
-from proto import ast_pb2
-from proto import tracker_pb2
+from mrproto import ast_pb2
+from mrproto import tracker_pb2
from search import ast2select
from search import query2ast
from tracker import tracker_bizobj
diff --git a/search/test/ast2sort_test.py b/search/test/ast2sort_test.py
index 9d365e8..ac5a00b 100644
--- a/search/test/ast2sort_test.py
+++ b/search/test/ast2sort_test.py
@@ -1,7 +1,6 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file or at
-# https://developers.google.com/open-source/licenses/bsd
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
"""Tests for the ast2sort module."""
from __future__ import print_function
@@ -10,7 +9,7 @@
import unittest
-from proto import tracker_pb2
+from mrproto import tracker_pb2
from search import ast2sort
from search import query2ast
diff --git a/search/test/backendnonviewable_test.py b/search/test/backendnonviewable_test.py
index 5360a93..a1b16c7 100644
--- a/search/test/backendnonviewable_test.py
+++ b/search/test/backendnonviewable_test.py
@@ -1,7 +1,6 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file or at
-# https://developers.google.com/open-source/licenses/bsd
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
"""Unittests for monorail.search.backendnonviewable."""
from __future__ import print_function
diff --git a/search/test/backendsearch_test.py b/search/test/backendsearch_test.py
index 6a9a710..f018f2f 100644
--- a/search/test/backendsearch_test.py
+++ b/search/test/backendsearch_test.py
@@ -1,7 +1,6 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file or at
-# https://developers.google.com/open-source/licenses/bsd
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
"""Unittests for monorail.search.backendsearch."""
from __future__ import print_function
@@ -125,4 +124,4 @@
self.mox.VerifyAll()
self.assertEqual([], json_data['unfiltered_iids'])
self.assertFalse(json_data['search_limit_reached'])
- self.assertEqual(error.message, json_data['error'])
+ self.assertEqual(str(error), json_data['error'])
diff --git a/search/test/backendsearchpipeline_test.py b/search/test/backendsearchpipeline_test.py
index dab2dba..1da86e7 100644
--- a/search/test/backendsearchpipeline_test.py
+++ b/search/test/backendsearchpipeline_test.py
@@ -1,7 +1,6 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file or at
-# https://developers.google.com/open-source/licenses/bsd
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
"""Tests for the backendsearchpipeline module."""
from __future__ import print_function
@@ -21,8 +20,8 @@
from framework import framework_helpers
from framework import sorting
from framework import sql
-from proto import ast_pb2
-from proto import tracker_pb2
+from mrproto import ast_pb2
+from mrproto import tracker_pb2
from search import backendsearchpipeline
from search import ast2ast
from search import query2ast
diff --git a/search/test/frontendsearchpipeline_test.py b/search/test/frontendsearchpipeline_test.py
index 9a94c3d..09883ad 100644
--- a/search/test/frontendsearchpipeline_test.py
+++ b/search/test/frontendsearchpipeline_test.py
@@ -1,7 +1,6 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file or at
-# https://developers.google.com/open-source/licenses/bsd
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
"""Tests for the frontendsearchpipeline module."""
from __future__ import print_function
@@ -23,9 +22,9 @@
from framework import framework_helpers
from framework import sorting
from framework import urls
-from proto import ast_pb2
-from proto import project_pb2
-from proto import tracker_pb2
+from mrproto import ast_pb2
+from mrproto import project_pb2
+from mrproto import tracker_pb2
from search import frontendsearchpipeline
from search import searchpipeline
from search import query2ast
diff --git a/search/test/query2ast_test.py b/search/test/query2ast_test.py
index fc92e72..a122d99 100644
--- a/search/test/query2ast_test.py
+++ b/search/test/query2ast_test.py
@@ -1,7 +1,6 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file or at
-# https://developers.google.com/open-source/licenses/bsd
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
"""Tests for the query2ast module."""
from __future__ import print_function
@@ -13,8 +12,8 @@
import unittest
import mock
-from proto import ast_pb2
-from proto import tracker_pb2
+from mrproto import ast_pb2
+from mrproto import tracker_pb2
from search import query2ast
from tracker import tracker_bizobj
@@ -751,7 +750,7 @@
query2ast.ParseUserQuery(
'modified>=' + val, '', BUILTIN_ISSUE_FIELDS,
self.default_config)
- self.assertEqual('Could not parse date: ' + val, cm.exception.message)
+ self.assertEqual('Could not parse date: ' + val, str(cm.exception))
def testQueryToSubqueries_BasicQuery(self):
self.assertEqual(['owner:me'], query2ast.QueryToSubqueries('owner:me'))
diff --git a/search/test/search_helpers_test.py b/search/test/search_helpers_test.py
index b9cfb51..e5746a6 100644
--- a/search/test/search_helpers_test.py
+++ b/search/test/search_helpers_test.py
@@ -1,7 +1,6 @@
-# Copyright 2018 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file or at
-# https://developers.google.com/open-source/licenses/bsd
+# Copyright 2018 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
"""Unit tests for monorail.search.search_helpers."""
from __future__ import print_function
@@ -19,7 +18,7 @@
from google.appengine.ext import testbed
from framework import permissions
from framework import sql
-from proto import user_pb2
+from mrproto import user_pb2
from services import chart_svc
from services import service_manager
from testing import fake
diff --git a/search/test/searchpipeline_test.py b/search/test/searchpipeline_test.py
index 5d23316..ce4426a 100644
--- a/search/test/searchpipeline_test.py
+++ b/search/test/searchpipeline_test.py
@@ -1,7 +1,6 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file or at
-# https://developers.google.com/open-source/licenses/bsd
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
"""Tests for the searchpipeline module."""
from __future__ import print_function
@@ -10,8 +9,8 @@
import unittest
-from proto import ast_pb2
-from proto import tracker_pb2
+from mrproto import ast_pb2
+from mrproto import tracker_pb2
from search import searchpipeline
from services import service_manager
from testing import fake