From e03f97abef944f54705adece9692f882be601ed2 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Mon, 4 Dec 2023 17:55:11 +0000 Subject: [PATCH 1/8] build: treat warnings as errors --- tests/unit/test_iam.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/unit/test_iam.py b/tests/unit/test_iam.py index fbd242e5..8a71a126 100644 --- a/tests/unit/test_iam.py +++ b/tests/unit/test_iam.py @@ -174,7 +174,7 @@ def test_owners_setter(self): expected = set([MEMBER]) policy = self._make_one() - with warnings.catch_warnings(record=True) as warned: + with pytest.warns(DeprecationWarning, match="Assigning to 'owners' is deprecated.") as warned: policy.owners = [MEMBER] (warning,) = warned @@ -198,7 +198,7 @@ def test_editors_setter(self): expected = set([MEMBER]) policy = self._make_one() - with warnings.catch_warnings(record=True) as warned: + with pytest.warns(DeprecationWarning, match="Assigning to 'editors' is deprecated.") as warned: policy.editors = [MEMBER] (warning,) = warned @@ -222,7 +222,7 @@ def test_viewers_setter(self): expected = set([MEMBER]) policy = self._make_one() - with warnings.catch_warnings(record=True) as warned: + with pytest.warns(DeprecationWarning, match="Assigning to 'viewers' is deprecated.") as warned: policy.viewers = [MEMBER] (warning,) = warned @@ -342,7 +342,7 @@ def test_to_api_repr_binding_w_duplicates(self): OWNER = "group:cloud-logs@google.com" policy = self._make_one() - with warnings.catch_warnings(record=True): + with pytest.warns(DeprecationWarning, match="Assigning to 'owners' is deprecated."): policy.owners = [OWNER, OWNER] assert policy.to_api_repr() == { "bindings": [{"role": OWNER_ROLE, "members": [OWNER]}] From 0912436ba4a7358c402fde9e270a3ca5e3339303 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Mon, 4 Dec 2023 17:56:47 +0000 Subject: [PATCH 2/8] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- tests/unit/test_iam.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/unit/test_iam.py b/tests/unit/test_iam.py index 8a71a126..68ab2abb 100644 --- a/tests/unit/test_iam.py +++ b/tests/unit/test_iam.py @@ -174,7 +174,9 @@ def test_owners_setter(self): expected = set([MEMBER]) policy = self._make_one() - with pytest.warns(DeprecationWarning, match="Assigning to 'owners' is deprecated.") as warned: + with pytest.warns( + DeprecationWarning, match="Assigning to 'owners' is deprecated." + ) as warned: policy.owners = [MEMBER] (warning,) = warned @@ -198,7 +200,9 @@ def test_editors_setter(self): expected = set([MEMBER]) policy = self._make_one() - with pytest.warns(DeprecationWarning, match="Assigning to 'editors' is deprecated.") as warned: + with pytest.warns( + DeprecationWarning, match="Assigning to 'editors' is deprecated." + ) as warned: policy.editors = [MEMBER] (warning,) = warned @@ -222,7 +226,9 @@ def test_viewers_setter(self): expected = set([MEMBER]) policy = self._make_one() - with pytest.warns(DeprecationWarning, match="Assigning to 'viewers' is deprecated.") as warned: + with pytest.warns( + DeprecationWarning, match="Assigning to 'viewers' is deprecated." + ) as warned: policy.viewers = [MEMBER] (warning,) = warned @@ -342,7 +348,9 @@ def test_to_api_repr_binding_w_duplicates(self): OWNER = "group:cloud-logs@google.com" policy = self._make_one() - with pytest.warns(DeprecationWarning, match="Assigning to 'owners' is deprecated."): + with pytest.warns( + DeprecationWarning, match="Assigning to 'owners' is deprecated." + ): policy.owners = [OWNER, OWNER] assert policy.to_api_repr() == { "bindings": [{"role": OWNER_ROLE, "members": [OWNER]}] From f6400e8490d9740a95aa0653d4666331c07c5241 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Mon, 4 Dec 2023 17:57:24 +0000 Subject: [PATCH 3/8] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- tests/unit/test_iam.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tests/unit/test_iam.py b/tests/unit/test_iam.py index 8a71a126..68ab2abb 100644 --- a/tests/unit/test_iam.py +++ b/tests/unit/test_iam.py @@ -174,7 +174,9 @@ def test_owners_setter(self): expected = set([MEMBER]) policy = self._make_one() - with pytest.warns(DeprecationWarning, match="Assigning to 'owners' is deprecated.") as warned: + with pytest.warns( + DeprecationWarning, match="Assigning to 'owners' is deprecated." + ) as warned: policy.owners = [MEMBER] (warning,) = warned @@ -198,7 +200,9 @@ def test_editors_setter(self): expected = set([MEMBER]) policy = self._make_one() - with pytest.warns(DeprecationWarning, match="Assigning to 'editors' is deprecated.") as warned: + with pytest.warns( + DeprecationWarning, match="Assigning to 'editors' is deprecated." + ) as warned: policy.editors = [MEMBER] (warning,) = warned @@ -222,7 +226,9 @@ def test_viewers_setter(self): expected = set([MEMBER]) policy = self._make_one() - with pytest.warns(DeprecationWarning, match="Assigning to 'viewers' is deprecated.") as warned: + with pytest.warns( + DeprecationWarning, match="Assigning to 'viewers' is deprecated." + ) as warned: policy.viewers = [MEMBER] (warning,) = warned @@ -342,7 +348,9 @@ def test_to_api_repr_binding_w_duplicates(self): OWNER = "group:cloud-logs@google.com" policy = self._make_one() - with pytest.warns(DeprecationWarning, match="Assigning to 'owners' is deprecated."): + with pytest.warns( + DeprecationWarning, match="Assigning to 'owners' is deprecated." + ): policy.owners = [OWNER, OWNER] assert policy.to_api_repr() == { "bindings": [{"role": OWNER_ROLE, "members": [OWNER]}] From 154dc8c8aa4aa85658c1c24838b2b75edfa7560c Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Mon, 4 Dec 2023 13:39:01 -0500 Subject: [PATCH 4/8] lint --- tests/unit/test_iam.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/unit/test_iam.py b/tests/unit/test_iam.py index 68ab2abb..3de15288 100644 --- a/tests/unit/test_iam.py +++ b/tests/unit/test_iam.py @@ -167,7 +167,6 @@ def test_owners_getter(self): assert policy.owners == expected def test_owners_setter(self): - import warnings from google.api_core.iam import OWNER_ROLE MEMBER = "user:phred@example.com" @@ -193,7 +192,6 @@ def test_editors_getter(self): assert policy.editors == expected def test_editors_setter(self): - import warnings from google.api_core.iam import EDITOR_ROLE MEMBER = "user:phred@example.com" @@ -219,7 +217,6 @@ def test_viewers_getter(self): assert policy.viewers == expected def test_viewers_setter(self): - import warnings from google.api_core.iam import VIEWER_ROLE MEMBER = "user:phred@example.com" @@ -343,7 +340,6 @@ def test_to_api_repr_binding_wo_members(self): assert policy.to_api_repr() == {} def test_to_api_repr_binding_w_duplicates(self): - import warnings from google.api_core.iam import OWNER_ROLE OWNER = "group:cloud-logs@google.com" From bdcb490bb28889f05b1e6adee37c1f2da4a5edde Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Mon, 4 Dec 2023 18:49:36 +0000 Subject: [PATCH 5/8] add pytest.ini --- pytest.ini | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 pytest.ini diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 00000000..fac7aa2b --- /dev/null +++ b/pytest.ini @@ -0,0 +1,15 @@ +[pytest] +filterwarnings = + # treat all warnings as errors + error + # Remove once https://github.com/pytest-dev/pytest-cov/issues/621 is fixed + ignore:.*The --rsyncdir command line argument and rsyncdirs config variable are deprecated:DeprecationWarning + # Remove once https://github.com/protocolbuffers/protobuf/issues/12186 is fixed + ignore:.*custom tp_new.*in Python 3.14:DeprecationWarning + # Remove once https://github.com/googleapis/python-api-common-protos/pull/187/files is merged + ignore:.*pkg_resources.declare_namespace:DeprecationWarning + ignore:.*pkg_resources is deprecated as an API:DeprecationWarning + # Remove once release PR https://github.com/googleapis/proto-plus-python/pull/391 is merged + ignore:datetime.datetime.utcfromtimestamp\(\) is deprecated:DeprecationWarning:proto.datetime_helpers + # Remove once https://github.com/grpc/grpc/issues/35086 is fixed + ignore:There is no current event loop:DeprecationWarning \ No newline at end of file From 8fb63ac10a8ac7d877e891bc24e6050ac188534e Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Mon, 4 Dec 2023 18:50:04 +0000 Subject: [PATCH 6/8] add line break --- pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest.ini b/pytest.ini index fac7aa2b..7bbb2b6d 100644 --- a/pytest.ini +++ b/pytest.ini @@ -12,4 +12,4 @@ filterwarnings = # Remove once release PR https://github.com/googleapis/proto-plus-python/pull/391 is merged ignore:datetime.datetime.utcfromtimestamp\(\) is deprecated:DeprecationWarning:proto.datetime_helpers # Remove once https://github.com/grpc/grpc/issues/35086 is fixed - ignore:There is no current event loop:DeprecationWarning \ No newline at end of file + ignore:There is no current event loop:DeprecationWarning From 3d89989b62a6289112d0c0c250ddb0e69104707e Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Mon, 4 Dec 2023 19:51:01 +0000 Subject: [PATCH 7/8] filter warning which appears only in python 3.7 --- pytest.ini | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pytest.ini b/pytest.ini index 7bbb2b6d..9423bc4b 100644 --- a/pytest.ini +++ b/pytest.ini @@ -6,6 +6,9 @@ filterwarnings = ignore:.*The --rsyncdir command line argument and rsyncdirs config variable are deprecated:DeprecationWarning # Remove once https://github.com/protocolbuffers/protobuf/issues/12186 is fixed ignore:.*custom tp_new.*in Python 3.14:DeprecationWarning + # Remove once support for python 3.7 is dropped + # This warning only appears when using python 3.7 + ignore:.*Using or importing the ABCs from.*collections:DeprecationWarning # Remove once https://github.com/googleapis/python-api-common-protos/pull/187/files is merged ignore:.*pkg_resources.declare_namespace:DeprecationWarning ignore:.*pkg_resources is deprecated as an API:DeprecationWarning From 94ba313a668ee0ea7c65caca1ae4673d77656e88 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Mon, 4 Dec 2023 19:56:41 +0000 Subject: [PATCH 8/8] filter deprecation warning for grpcio-gcp --- pytest.ini | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pytest.ini b/pytest.ini index 9423bc4b..66f72e41 100644 --- a/pytest.ini +++ b/pytest.ini @@ -9,6 +9,9 @@ filterwarnings = # Remove once support for python 3.7 is dropped # This warning only appears when using python 3.7 ignore:.*Using or importing the ABCs from.*collections:DeprecationWarning + # Remove once support for grpcio-gcp is deprecated + # See https://github.com/googleapis/python-api-core/blob/42e8b6e6f426cab749b34906529e8aaf3f133d75/google/api_core/grpc_helpers.py#L39-L45 + ignore:.*Support for grpcio-gcp is deprecated:DeprecationWarning # Remove once https://github.com/googleapis/python-api-common-protos/pull/187/files is merged ignore:.*pkg_resources.declare_namespace:DeprecationWarning ignore:.*pkg_resources is deprecated as an API:DeprecationWarning