Skip to content

Commit

Permalink
tests: pass '*session.posargs' for systests (#788)
Browse files Browse the repository at this point in the history
* tests: pass '*session.posargs' for systests

Permits running single tests, debugging on errors, etc.

* fix: typos
  • Loading branch information
tseaver authored Jul 8, 2021
1 parent d883921 commit d3944af
Showing 1 changed file with 66 additions and 19 deletions.
85 changes: 66 additions & 19 deletions system_tests/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,11 @@ def default(session, *test_paths):
def service_account_sync(session):
session.install(*TEST_DEPENDENCIES_SYNC)
session.install(LIBRARY_DIR)
default(session, "system_tests_sync/test_service_account.py")
default(
session,
"system_tests_sync/test_service_account.py",
*session.posargs,
)


@nox.session(python=PYTHON_VERSIONS_SYNC)
Expand All @@ -201,6 +205,7 @@ def default_explicit_service_account(session):
session,
"system_tests_sync/test_default.py",
"system_tests_sync/test_id_token.py",
*session.posargs,
)


Expand All @@ -210,7 +215,9 @@ def default_explicit_authorized_user(session):
session.install(*TEST_DEPENDENCIES_SYNC)
session.install(LIBRARY_DIR)
default(
session, "system_tests_sync/test_default.py",
session,
"system_tests_sync/test_default.py",
*session.posargs,
)


Expand All @@ -222,7 +229,9 @@ def default_explicit_authorized_user_explicit_project(session):
session.install(*TEST_DEPENDENCIES_SYNC)
session.install(LIBRARY_DIR)
default(
session, "system_tests_sync/test_default.py",
session,
"system_tests_sync/test_default.py",
*session.posargs,
)


Expand All @@ -233,7 +242,9 @@ def default_cloud_sdk_service_account(session):
session.install(*TEST_DEPENDENCIES_SYNC)
session.install(LIBRARY_DIR)
default(
session, "system_tests_sync/test_default.py",
session,
"system_tests_sync/test_default.py",
*session.posargs,
)


Expand All @@ -243,7 +254,9 @@ def default_cloud_sdk_authorized_user(session):
session.install(*TEST_DEPENDENCIES_SYNC)
session.install(LIBRARY_DIR)
default(
session, "system_tests_sync/test_default.py",
session,
"system_tests_sync/test_default.py",
*session.posargs,
)


Expand All @@ -254,7 +267,9 @@ def default_cloud_sdk_authorized_user_configured_project(session):
session.install(*TEST_DEPENDENCIES_SYNC)
session.install(LIBRARY_DIR)
default(
session, "system_tests_sync/test_default.py",
session,
"system_tests_sync/test_default.py",
*session.posargs,
)


Expand All @@ -266,7 +281,9 @@ def compute_engine(session):
del session.virtualenv.env["GOOGLE_APPLICATION_CREDENTIALS"]
session.install(LIBRARY_DIR)
default(
session, "system_tests_sync/test_compute_engine.py",
session,
"system_tests_sync/test_compute_engine.py",
*session.posargs,
)


Expand Down Expand Up @@ -320,7 +337,9 @@ def grpc(session):
session.install(*TEST_DEPENDENCIES_SYNC, "google-cloud-pubsub==1.7.0")
session.env[EXPLICIT_CREDENTIALS_ENV] = SERVICE_ACCOUNT_FILE
default(
session, "system_tests_sync/test_grpc.py",
session,
"system_tests_sync/test_grpc.py",
*session.posargs,
)


Expand All @@ -330,7 +349,9 @@ def requests(session):
session.install(*TEST_DEPENDENCIES_SYNC)
session.env[EXPLICIT_CREDENTIALS_ENV] = SERVICE_ACCOUNT_FILE
default(
session, "system_tests_sync/test_requests.py",
session,
"system_tests_sync/test_requests.py",
*session.posargs,
)


Expand All @@ -340,7 +361,9 @@ def urllib3(session):
session.install(*TEST_DEPENDENCIES_SYNC)
session.env[EXPLICIT_CREDENTIALS_ENV] = SERVICE_ACCOUNT_FILE
default(
session, "system_tests_sync/test_urllib3.py",
session,
"system_tests_sync/test_urllib3.py",
*session.posargs,
)


Expand All @@ -350,14 +373,25 @@ def mtls_http(session):
session.install(*TEST_DEPENDENCIES_SYNC, "pyopenssl")
session.env[EXPLICIT_CREDENTIALS_ENV] = SERVICE_ACCOUNT_FILE
default(
session, "system_tests_sync/test_mtls_http.py",
session,
"system_tests_sync/test_mtls_http.py",
*session.posargs,
)


@nox.session(python=PYTHON_VERSIONS_SYNC)
def external_accounts(session):
session.install(*TEST_DEPENDENCIES_SYNC, "google-auth", "google-api-python-client", "enum34")
default(session, "system_tests_sync/test_external_accounts.py")
session.install(
*TEST_DEPENDENCIES_SYNC,
"google-auth",
"google-api-python-client",
"enum34",
)
default(
session,
"system_tests_sync/test_external_accounts.py",
*session.posargs,
)


# ASYNC SYSTEM TESTS
Expand All @@ -367,7 +401,9 @@ def service_account_async(session):
session.install(*(TEST_DEPENDENCIES_SYNC + TEST_DEPENDENCIES_ASYNC))
session.install(LIBRARY_DIR)
default(
session, "system_tests_async/test_service_account.py",
session,
"system_tests_async/test_service_account.py",
*session.posargs,
)


Expand All @@ -381,6 +417,7 @@ def default_explicit_service_account_async(session):
session,
"system_tests_async/test_default.py",
"system_tests_async/test_id_token.py",
*session.posargs,
)


Expand All @@ -390,7 +427,9 @@ def default_explicit_authorized_user_async(session):
session.install(*(TEST_DEPENDENCIES_SYNC + TEST_DEPENDENCIES_ASYNC))
session.install(LIBRARY_DIR)
default(
session, "system_tests_async/test_default.py",
session,
"system_tests_async/test_default.py",
*session.posargs,
)


Expand All @@ -402,7 +441,9 @@ def default_explicit_authorized_user_explicit_project_async(session):
session.install(*(TEST_DEPENDENCIES_SYNC + TEST_DEPENDENCIES_ASYNC))
session.install(LIBRARY_DIR)
default(
session, "system_tests_async/test_default.py",
session,
"system_tests_async/test_default.py",
*session.posargs,
)


Expand All @@ -413,7 +454,9 @@ def default_cloud_sdk_service_account_async(session):
session.install(*(TEST_DEPENDENCIES_SYNC + TEST_DEPENDENCIES_ASYNC))
session.install(LIBRARY_DIR)
default(
session, "system_tests_async/test_default.py",
session,
"system_tests_async/test_default.py",
*session.posargs,
)


Expand All @@ -423,7 +466,9 @@ def default_cloud_sdk_authorized_user_async(session):
session.install(*(TEST_DEPENDENCIES_SYNC + TEST_DEPENDENCIES_ASYNC))
session.install(LIBRARY_DIR)
default(
session, "system_tests_async/test_default.py",
session,
"system_tests_async/test_default.py",
*session.posargs,
)


Expand All @@ -434,5 +479,7 @@ def default_cloud_sdk_authorized_user_configured_project_async(session):
session.install(*(TEST_DEPENDENCIES_SYNC + TEST_DEPENDENCIES_ASYNC))
session.install(LIBRARY_DIR)
default(
session, "system_tests_async/test_default.py",
session,
"system_tests_async/test_default.py",
*session.posargs,
)

0 comments on commit d3944af

Please sign in to comment.