Skip to content

Commit

Permalink
ci: create sponge_log.xml files (#722)
Browse files Browse the repository at this point in the history
* ci: create sponge_log.xml files

* test: fix noxfile

Co-authored-by: arithmetic1728 <[email protected]>
  • Loading branch information
busunkim96 and arithmetic1728 authored Mar 15, 2021
1 parent 199da47 commit e87b1ec
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 24 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ db.sqlite3
# Coverage files
.coverage
coverage.xml
*sponge_log.xml
nosetests.xml
htmlcov/

Expand Down
9 changes: 8 additions & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ def unit(session):
session.install(".")
session.run(
"pytest",
f"--junitxml=unit_{session.python}_sponge_log.xml",
"--cov=google.auth",
"--cov=google.oauth2",
"--cov=tests",
Expand All @@ -100,7 +101,12 @@ def unit_prev_versions(session):
session.install(".")
session.install(*TEST_DEPENDENCIES)
session.run(
"pytest", "--cov=google.auth", "--cov=google.oauth2", "--cov=tests", "tests"
"pytest",
f"--junitxml=unit_{session.python}_sponge_log.xml",
"--cov=google.auth",
"--cov=google.oauth2",
"--cov=tests",
"tests",
)


Expand Down Expand Up @@ -170,6 +176,7 @@ def pypy(session):
session.install(".")
session.run(
"pytest",
f"--junitxml=unit_{session.python}_sponge_log.xml",
"--cov=google.auth",
"--cov=google.oauth2",
"--cov=tests",
Expand Down
99 changes: 76 additions & 23 deletions system_tests/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,21 @@ def configure_cloud_sdk(session, application_default_credentials, project=False)
PYTHON_VERSIONS_SYNC = ["2.7", "3.7"]


def default(session, *test_paths):
# replace 'session._runner.friendly_name' with
# session.name once nox has released a new version
# https://github.com/theacodes/nox/pull/386
sponge_log = f"--junitxml=system_{str(session._runner.friendly_name)}_sponge_log.xml"
session.run(
"pytest", sponge_log, *test_paths,
)


@nox.session(python=PYTHON_VERSIONS_SYNC)
def service_account_sync(session):
session.install(*TEST_DEPENDENCIES_SYNC)
session.install(LIBRARY_DIR)
session.run("pytest", "system_tests_sync/test_service_account.py")
default(session, "system_tests_sync/test_service_account.py")


@nox.session(python=PYTHON_VERSIONS_SYNC)
Expand All @@ -187,15 +197,21 @@ def default_explicit_service_account(session):
session.env[EXPECT_PROJECT_ENV] = "1"
session.install(*TEST_DEPENDENCIES_SYNC)
session.install(LIBRARY_DIR)
session.run("pytest", "system_tests_sync/test_default.py", "system_tests_sync/test_id_token.py")
default(
session,
"system_tests_sync/test_default.py",
"system_tests_sync/test_id_token.py",
)


@nox.session(python=PYTHON_VERSIONS_SYNC)
def default_explicit_authorized_user(session):
session.env[EXPLICIT_CREDENTIALS_ENV] = AUTHORIZED_USER_FILE
session.install(*TEST_DEPENDENCIES_SYNC)
session.install(LIBRARY_DIR)
session.run("pytest", "system_tests_sync/test_default.py")
default(
session, "system_tests_sync/test_default.py",
)


@nox.session(python=PYTHON_VERSIONS_SYNC)
Expand All @@ -205,7 +221,9 @@ def default_explicit_authorized_user_explicit_project(session):
session.env[EXPECT_PROJECT_ENV] = "1"
session.install(*TEST_DEPENDENCIES_SYNC)
session.install(LIBRARY_DIR)
session.run("pytest", "system_tests_sync/test_default.py")
default(
session, "system_tests_sync/test_default.py",
)


@nox.session(python=PYTHON_VERSIONS_SYNC)
Expand All @@ -214,15 +232,19 @@ def default_cloud_sdk_service_account(session):
session.env[EXPECT_PROJECT_ENV] = "1"
session.install(*TEST_DEPENDENCIES_SYNC)
session.install(LIBRARY_DIR)
session.run("pytest", "system_tests_sync/test_default.py")
default(
session, "system_tests_sync/test_default.py",
)


@nox.session(python=PYTHON_VERSIONS_SYNC)
def default_cloud_sdk_authorized_user(session):
configure_cloud_sdk(session, AUTHORIZED_USER_FILE)
session.install(*TEST_DEPENDENCIES_SYNC)
session.install(LIBRARY_DIR)
session.run("pytest", "system_tests_sync/test_default.py")
default(
session, "system_tests_sync/test_default.py",
)


@nox.session(python=PYTHON_VERSIONS_SYNC)
Expand All @@ -231,7 +253,10 @@ def default_cloud_sdk_authorized_user_configured_project(session):
session.env[EXPECT_PROJECT_ENV] = "1"
session.install(*TEST_DEPENDENCIES_SYNC)
session.install(LIBRARY_DIR)
session.run("pytest", "system_tests_sync/test_default.py")
default(
session, "system_tests_sync/test_default.py",
)


@nox.session(python=PYTHON_VERSIONS_SYNC)
def compute_engine(session):
Expand All @@ -240,7 +265,9 @@ def compute_engine(session):
# credentials are detected from environment
del session.virtualenv.env["GOOGLE_APPLICATION_CREDENTIALS"]
session.install(LIBRARY_DIR)
session.run("pytest", "system_tests_sync/test_compute_engine.py")
default(
session, "system_tests_sync/test_compute_engine.py",
)


@nox.session(python=["2.7"])
Expand Down Expand Up @@ -282,48 +309,61 @@ def app_engine(session):
# Run the tests
session.env["TEST_APP_URL"] = application_url
session.chdir(HERE)
session.run("pytest", "system_tests_sync/test_app_engine.py")
default(
session, "system_tests_sync/test_app_engine.py",
)


@nox.session(python=PYTHON_VERSIONS_SYNC)
def grpc(session):
session.install(LIBRARY_DIR)
session.install(*TEST_DEPENDENCIES_SYNC, "google-cloud-pubsub==1.7.0")
session.env[EXPLICIT_CREDENTIALS_ENV] = SERVICE_ACCOUNT_FILE
session.run("pytest", "system_tests_sync/test_grpc.py")
default(
session, "system_tests_sync/test_grpc.py",
)


@nox.session(python=PYTHON_VERSIONS_SYNC)
def requests(session):
session.install(LIBRARY_DIR)
session.install(*TEST_DEPENDENCIES_SYNC)
session.env[EXPLICIT_CREDENTIALS_ENV] = SERVICE_ACCOUNT_FILE
session.run("pytest", "system_tests_sync/test_requests.py")
default(
session, "system_tests_sync/test_requests.py",
)


@nox.session(python=PYTHON_VERSIONS_SYNC)
def urllib3(session):
session.install(LIBRARY_DIR)
session.install(*TEST_DEPENDENCIES_SYNC)
session.env[EXPLICIT_CREDENTIALS_ENV] = SERVICE_ACCOUNT_FILE
session.run("pytest", "system_tests_sync/test_urllib3.py")
default(
session, "system_tests_sync/test_urllib3.py",
)


@nox.session(python=PYTHON_VERSIONS_SYNC)
def mtls_http(session):
session.install(LIBRARY_DIR)
session.install(*TEST_DEPENDENCIES_SYNC, "pyopenssl")
session.env[EXPLICIT_CREDENTIALS_ENV] = SERVICE_ACCOUNT_FILE
session.run("pytest", "system_tests_sync/test_mtls_http.py")
default(
session, "system_tests_sync/test_mtls_http.py",
)


#ASYNC SYSTEM TESTS
# ASYNC SYSTEM TESTS


@nox.session(python=PYTHON_VERSIONS_ASYNC)
def service_account_async(session):
session.install(*(TEST_DEPENDENCIES_SYNC+TEST_DEPENDENCIES_ASYNC))
session.install(*(TEST_DEPENDENCIES_SYNC + TEST_DEPENDENCIES_ASYNC))
session.install(LIBRARY_DIR)
session.run("pytest", "system_tests_async/test_service_account.py")
default(
session, "system_tests_async/test_service_account.py",
)


@nox.session(python=PYTHON_VERSIONS_ASYNC)
Expand All @@ -332,16 +372,21 @@ def default_explicit_service_account_async(session):
session.env[EXPECT_PROJECT_ENV] = "1"
session.install(*(TEST_DEPENDENCIES_SYNC + TEST_DEPENDENCIES_ASYNC))
session.install(LIBRARY_DIR)
session.run("pytest", "system_tests_async/test_default.py",
"system_tests_async/test_id_token.py")
default(
session,
"system_tests_async/test_default.py",
"system_tests_async/test_id_token.py",
)


@nox.session(python=PYTHON_VERSIONS_ASYNC)
def default_explicit_authorized_user_async(session):
session.env[EXPLICIT_CREDENTIALS_ENV] = AUTHORIZED_USER_FILE
session.install(*(TEST_DEPENDENCIES_SYNC + TEST_DEPENDENCIES_ASYNC))
session.install(LIBRARY_DIR)
session.run("pytest", "system_tests_async/test_default.py")
default(
session, "system_tests_async/test_default.py",
)


@nox.session(python=PYTHON_VERSIONS_ASYNC)
Expand All @@ -351,7 +396,9 @@ def default_explicit_authorized_user_explicit_project_async(session):
session.env[EXPECT_PROJECT_ENV] = "1"
session.install(*(TEST_DEPENDENCIES_SYNC + TEST_DEPENDENCIES_ASYNC))
session.install(LIBRARY_DIR)
session.run("pytest", "system_tests_async/test_default.py")
default(
session, "system_tests_async/test_default.py",
)


@nox.session(python=PYTHON_VERSIONS_ASYNC)
Expand All @@ -360,15 +407,19 @@ def default_cloud_sdk_service_account_async(session):
session.env[EXPECT_PROJECT_ENV] = "1"
session.install(*(TEST_DEPENDENCIES_SYNC + TEST_DEPENDENCIES_ASYNC))
session.install(LIBRARY_DIR)
session.run("pytest", "system_tests_async/test_default.py")
default(
session, "system_tests_async/test_default.py",
)


@nox.session(python=PYTHON_VERSIONS_ASYNC)
def default_cloud_sdk_authorized_user_async(session):
configure_cloud_sdk(session, AUTHORIZED_USER_FILE)
session.install(*(TEST_DEPENDENCIES_SYNC + TEST_DEPENDENCIES_ASYNC))
session.install(LIBRARY_DIR)
session.run("pytest", "system_tests_async/test_default.py")
default(
session, "system_tests_async/test_default.py",
)


@nox.session(python=PYTHON_VERSIONS_ASYNC)
Expand All @@ -377,4 +428,6 @@ def default_cloud_sdk_authorized_user_configured_project_async(session):
session.env[EXPECT_PROJECT_ENV] = "1"
session.install(*(TEST_DEPENDENCIES_SYNC + TEST_DEPENDENCIES_ASYNC))
session.install(LIBRARY_DIR)
session.run("pytest", "system_tests_async/test_default.py")
default(
session, "system_tests_async/test_default.py",
)

0 comments on commit e87b1ec

Please sign in to comment.