Skip to content

Commit

Permalink
feat: add support for per type and partition export (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored and dandhlee committed Nov 29, 2022
1 parent f78522d commit 6155be9
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions asset/snippets/snippets/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,24 @@

TEST_CONFIG = {
# You can opt out from the test for specific Python versions.
"ignored_versions": ["2.7"],
'ignored_versions': ["2.7"],

# An envvar key for determining the project id to use. Change it
# to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a
# build specific Cloud project. You can also use your own string
# to use your own Cloud project.
"gcloud_project_env": "GOOGLE_CLOUD_PROJECT",
'gcloud_project_env': 'GOOGLE_CLOUD_PROJECT',
# 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT',

# A dictionary you want to inject into your test. Don't put any
# secrets here. These values will override predefined values.
"envs": {},
'envs': {},
}


try:
# Ensure we can import noxfile_config in the project's directory.
sys.path.append(".")
sys.path.append('.')
from noxfile_config import TEST_CONFIG_OVERRIDE
except ImportError as e:
print("No user noxfile_config found: detail: {}".format(e))
Expand All @@ -67,12 +69,12 @@ def get_pytest_env_vars():
ret = {}

# Override the GCLOUD_PROJECT and the alias.
env_key = TEST_CONFIG["gcloud_project_env"]
env_key = TEST_CONFIG['gcloud_project_env']
# This should error out if not set.
ret["GOOGLE_CLOUD_PROJECT"] = os.environ[env_key]
ret['GOOGLE_CLOUD_PROJECT'] = os.environ[env_key]

# Apply user supplied envs.
ret.update(TEST_CONFIG["envs"])
ret.update(TEST_CONFIG['envs'])
return ret


Expand All @@ -81,7 +83,7 @@ def get_pytest_env_vars():
ALL_VERSIONS = ["2.7", "3.6", "3.7", "3.8"]

# Any default versions that should be ignored.
IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"]
IGNORED_VERSIONS = TEST_CONFIG['ignored_versions']

TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS])

Expand Down Expand Up @@ -136,7 +138,7 @@ def lint(session):
args = FLAKE8_COMMON_ARGS + [
"--application-import-names",
",".join(local_names),
".",
"."
]
session.run("flake8", *args)

Expand Down Expand Up @@ -180,9 +182,9 @@ def py(session):
if session.python in TESTED_VERSIONS:
_session_tests(session)
else:
session.skip(
"SKIPPED: {} tests are disabled for this sample.".format(session.python)
)
session.skip("SKIPPED: {} tests are disabled for this sample.".format(
session.python
))


#
Expand Down

0 comments on commit 6155be9

Please sign in to comment.