10000 fix: migrate to native namespace packages (#193) · googleapis/google-cloud-python@1c7f079 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1c7f079

Browse files
fix: migrate to native namespace packages (#193)
* test: add import test * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * add unit nox session * refactor tests * fix: migrate to native namespace packages --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 076fc97 commit 1c7f079

File tree

4 files changed

+36
-15
lines changed

4 files changed

+36
-15
lines changed

packages/google-cloud-access-context-manager/noxfile.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,11 @@
6868
nox.options.sessions = [
6969
"system",
7070
"lint",
71-
"test",
71+
"integration_test",
7272
"lint_setup_py",
7373
"blacken",
7474
"docs",
75+
"unit",
7576
]
7677

7778
# Error if a python version is missing
@@ -183,11 +184,6 @@ def default(session):
183184
)
184185

185186

186-
def unit(session):
187-
"""Run the unit test suite."""
188-
default(session)
189-
190-
191187
def install_systemtest_dependencies(session, *constraints):
192188

193189
# Use pre-release gRPC for system tests.
@@ -225,7 +221,7 @@ def install_systemtest_dependencies(session, *constraints):
225221
],
226222
ids=["asset"],
227223
)
228-
def test(session, library):
224+
def integration_test(session, library):
229225
"""Run tests from a downstream libraries.
230226
To verify that any changes we make here will not break downstream libraries, clone
231227
a few and run their unit and system tests.
@@ -249,7 +245,7 @@ def test(session, library):
249245
session.cd(library)
250246
if package:
251247
session.cd(f"packages/{package}")
252-
unit(session)
248+
default(session)
253249
# system tests are run 3.7 only
254250
if session.python == "3.7":
255251
system(session)
@@ -401,3 +397,9 @@ def docfx(session):
401397
os.path.join("docs", ""),
402398
os.path.join("docs", "_build", "html", ""),
403399
)
400+
401+
402+
@nox.session(python=UNIT_TEST_PYTHON_VERSIONS)
403+
def unit(session):
404+
"""Run the unit test suite."""
405+
default(session)

packages/google-cloud-access-context-manager/setup.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import os
1717

1818
import setuptools
19+
from setuptools import find_namespace_packages
1920

2021
# Package metadata.
2122

@@ -39,12 +40,6 @@
3940
with io.open(readme_filename, encoding="utf-8") as readme_file:
4041
readme = readme_file.read()
4142

42-
# Only include packages under the 'google' namespace. Do not include tests,
43-
# benchmarks, etc.
44-
packages = [
45-
package for package in setuptools.find_packages() if package.startswith("google")
46-
]
47-
4843
setuptools.setup(
4944
name=name,
5045
version=version,
@@ -70,7 +65,7 @@
7065
"Topic :: Internet",
7166
],
7267
platforms="Posix; MacOS X; Windows",
73-
packages=packages,
68+
packages=find_namespace_packages(exclude=("tests*", "testing*")),
7469
install_requires=dependencies,
7570
python_requires=">=3.7",
7671
include_package_data=True,
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# Copyright 2020 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
18+
from google.identity.accesscontextmanager.v1 import access_level_pb2
19+
20+
21+
def test_create_audit_log():
22+
# just check that the import works
23+
# and that an AuditLog instance can be instantiated
24+
access_level_pb2.BasicLevel()

0 commit comments

Comments
 (0)
0