diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index 30ca3f5c8f..aaca04c675 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -6,8 +6,6 @@ branchProtectionRules: isAdminEnforced: true requiredStatusCheckContexts: - 'cla/google' - - 'codecov/patch' - - 'codecov/project' - 'conventionalcommits.org' - 'docs' - 'mypy' diff --git a/noxfile.py b/noxfile.py index 674fe965f9..5296514a68 100644 --- a/noxfile.py +++ b/noxfile.py @@ -34,7 +34,7 @@ def unit(session): """Run the unit test suite.""" session.install( - "pytest", "pytest-xdist", "pyfakefs", + "coverage", "pytest-cov", "pytest", "pytest-xdist", "pyfakefs", ) session.install("-e", ".") @@ -45,6 +45,10 @@ def unit(session): or [ "-vv", "-n=auto", + "--cov=gapic", + "--cov-config=.coveragerc", + "--cov-report=term", + "--cov-fail-under=100", path.join("tests", "unit"), ] ), @@ -115,7 +119,7 @@ def showcase_library( ) # Install the library. - session.install(tmp_dir) + session.install("-e", tmp_dir) yield tmp_dir @@ -181,7 +185,9 @@ def showcase_mtls_alternative_templates(session): def run_showcase_unit_tests(session, fail_under=100): session.install( + "coverage", "pytest", + "pytest-cov", "pytest-xdist", "asyncmock", "pytest-asyncio", @@ -192,6 +198,9 @@ def run_showcase_unit_tests(session, fail_under=100): "py.test", "-n=auto", "--quiet", + "--cov=google", + "--cov-append", + f"--cov-fail-under={str(fail_under)}", *(session.posargs or [path.join("tests", "unit")]), ) @@ -217,11 +226,11 @@ def showcase_unit( # google-auth is a transitive dependency so it isn't in the # lower bound constraints file produced above. session.install("google-auth==1.21.1") - run_showcase_unit_tests(session) + run_showcase_unit_tests(session, fail_under=0) # 2. Run the tests again with latest version of dependencies session.install(".", "--upgrade", "--force-reinstall") - run_showcase_unit_tests(session) + run_showcase_unit_tests(session, fail_under=100) @nox.session(python=["3.7", "3.8", "3.9"]) @@ -248,11 +257,11 @@ def showcase_unit_add_iam_methods(session): # google-auth is a transitive dependency so it isn't in the # lower bound constraints file produced above. session.install("google-auth==1.21.1") - run_showcase_unit_tests(session) + run_showcase_unit_tests(session, fail_under=0) # 2. Run the tests again with latest version of dependencies session.install(".", "--upgrade", "--force-reinstall") - run_showcase_unit_tests(session) + run_showcase_unit_tests(session, fail_under=100) @nox.session(python="3.8") diff --git a/tests/unit/schema/wrappers/test_service.py b/tests/unit/schema/wrappers/test_service.py index ef14e27a6f..9c47797daf 100644 --- a/tests/unit/schema/wrappers/test_service.py +++ b/tests/unit/schema/wrappers/test_service.py @@ -298,6 +298,45 @@ def test_service_any_streaming(): assert service.any_server_streaming == server +def test_service_any_deprecated(): + service = make_service( + name='Service', + methods=( + ( + make_method( + f"GetMollusc", + input_message=make_message( + "GetMolluscRequest", + ), + output_message=make_message( + "GetMolluscResponse", + ), + ), + ) + )) + + assert service.any_deprecated == False + + deprecated_service = make_service( + name='ServiceWithDeprecatedMethod', + methods=( + ( + make_method( + f"GetMollusc", + input_message=make_message( + "GetMolluscRequest", + ), + output_message=make_message( + "GetMolluscResponse", + ), + is_deprecated=True, + ), + ) + )) + + assert deprecated_service.any_deprecated == True + + def test_has_pagers(): paged = make_field(name='foos', message=make_message('Foo'), repeated=True) input_msg = make_message(