Skip to content

Commit

Permalink
fix(deps): Require proto-plus >= 1.22.3 (#626)
Browse files Browse the repository at this point in the history
* fix(deps): add dependency on proto-plus

* remove unused import
  • Loading branch information
parthea authored Feb 29, 2024
1 parent 475ff2e commit 4fed37c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 31 deletions.
25 changes: 6 additions & 19 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,6 @@
]


def _greater_or_equal_than_37(version_string):
tokens = version_string.split(".")
for i, token in enumerate(tokens):
try:
tokens[i] = int(token)
except ValueError:
pass
return tokens >= [3, 7]


@nox.session(python=DEFAULT_PYTHON_VERSION)
def lint(session):
"""Run linters.
Expand Down Expand Up @@ -129,16 +119,13 @@ def default(session, install_grpc=True):
),
]

# Inject AsyncIO content and proto-plus, if version >= 3.7.
# proto-plus is needed for a field mask test in test_protobuf_helpers.py
if _greater_or_equal_than_37(session.python):
session.install("asyncmock", "pytest-asyncio", "proto-plus")
session.install("asyncmock", "pytest-asyncio")

# Having positional arguments means the user wants to run specific tests.
# Best not to add additional tests to that list.
if not session.posargs:
pytest_args.append("--cov=tests.asyncio")
pytest_args.append(os.path.join("tests", "asyncio"))
# Having positional arguments means the user wants to run specific tests.
# Best not to add additional tests to that list.
if not session.posargs:
pytest_args.append("--cov=tests.asyncio")
pytest_args.append(os.path.join("tests", "asyncio"))

session.run(*pytest_args)

Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
dependencies = [
"googleapis-common-protos >= 1.56.2, < 2.0.dev0",
"protobuf>=3.19.5,<5.0.0.dev0,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5",
"proto-plus >= 1.22.3, <2.0.0dev",
"google-auth >= 2.14.1, < 3.0.dev0",
"requests >= 2.18.0, < 3.0.0.dev0",
]
Expand Down
1 change: 1 addition & 0 deletions testing/constraints-3.7.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ packaging==14.3
grpcio==1.33.2
grpcio-status==1.33.2
grpcio-gcp==0.2.2
proto-plus==1.22.3
12 changes: 0 additions & 12 deletions tests/unit/test_protobuf_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import sys

import pytest

from google.api import http_pb2
Expand Down Expand Up @@ -476,11 +474,6 @@ def test_field_mask_different_level_diffs():
]


@pytest.mark.skipif(
sys.version_info.major == 2,
reason="Field names with trailing underscores can only be created"
"through proto-plus, which is Python 3 only.",
)
def test_field_mask_ignore_trailing_underscore():
import proto

Expand All @@ -496,11 +489,6 @@ class Foo(proto.Message):
]


@pytest.mark.skipif(
sys.version_info.major == 2,
reason="Field names with trailing underscores can only be created"
"through proto-plus, which is Python 3 only.",
)
def test_field_mask_ignore_trailing_underscore_with_nesting():
import proto

Expand Down

0 comments on commit 4fed37c

Please sign in to comment.