Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 6.7k
Fixup nox#462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Fixup nox #462
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -30,7 +30,6 @@ | ||
| """ | ||
| import fnmatch | ||
| import itertools | ||
| import os | ||
| import subprocess | ||
| import tempfile | ||
| @@ -46,16 +45,6 @@ | ||
| '-x', '--no-success-flaky-report', '--cov', '--cov-config', | ||
| '.coveragerc', '--cov-append', '--cov-report='] | ||
| # Blacklists of samples to ingnore. | ||
| # Bigtable and Speech are disabled because they use gRPC, which does not yet | ||
| # support Python 3. See: https://github.com/grpc/grpc/issues/282 | ||
| TESTS_BLACKLIST = set(( | ||
| './appengine/standard', | ||
| './bigtable', | ||
| './speech', | ||
| './testing')) | ||
| APPENGINE_BLACKLIST = set() | ||
| # Libraries that only work on Python 2.7 | ||
| PY27_ONLY_LIBRARIES = ['mysql-python'] | ||
| @@ -132,8 +121,11 @@ def filter_samples(sample_dirs, changed_files): | ||
| def setup_appengine(session): | ||
| """Installs the App Engine SDK.""" | ||
| # Install the app engine sdk and setup import paths. | ||
| if session.interpreter.startswith('python3'): | ||
| return | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like this check makes more sense in the caller, no? ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. meh. | ||
| gae_root = os.environ.get('GAE_ROOT', tempfile.gettempdir()) | ||
| session.env['PYTHONPATH'] = os.path.join(gae_root, 'google_appengine') | ||
| session.env['GAE_SDK_PATH'] = os.path.join(gae_root, 'google_appengine') | ||
| session.run('gcprepotools', 'download-appengine-sdk', gae_root) | ||
| # Create a lib directory to prevent the GAE vendor library from | ||
| @@ -143,8 +135,8 @@ def setup_appengine(session): | ||
| def run_tests_in_sesssion( | ||
| session, interpreter, use_appengine=False, skip_flaky=False, | ||
| changed_only=False, sample_directories=None): | ||
| session, interpreter, sample_directories, use_appengine=True, | ||
| skip_flaky=False, changed_only=False): | ||
| """This is the main function for executing tests. | ||
| It: | ||
| @@ -173,13 +165,6 @@ def run_tests_in_sesssion( | ||
| if skip_flaky: | ||
| pytest_args.append('-m not slow and not flaky') | ||
| # session.posargs is any leftover arguments from the command line, | ||
| # which allows users to run a particular test instead of all of them. | ||
| if session.posargs: | ||
| sample_directories = session.posargs | ||
| elif sample_directories is None: | ||
| sample_directories = collect_sample_dirs('.', TESTS_BLACKLIST) | ||
| if changed_only: | ||
| changed_files = get_changed_files() | ||
| sample_directories = filter_samples( | ||
| @@ -204,43 +189,38 @@ def run_tests_in_sesssion( | ||
| @nox.parametrize('interpreter', ['python2.7', 'python3.4']) | ||
| def session_tests(session, interpreter): | ||
| """Runs tests""" | ||
| run_tests_in_sesssion(session, interpreter) | ||
| """Runs tests for all non-gae standard samples.""" | ||
| # session.posargs is any leftover arguments from the command line, | ||
| # which allows users to run a particular test instead of all of them. | ||
| sample_directories = session.posargs | ||
| if not sample_directories: | ||
| sample_directories = collect_sample_dirs('.') | ||
| def session_gae(session): | ||
| """Runs test for GAE Standard samples.""" | ||
| run_tests_in_sesssion( | ||
| session, 'python2.7', use_appengine=True, | ||
| sample_directories=collect_sample_dirs( | ||
| 'appengine/standard', | ||
| APPENGINE_BLACKLIST)) | ||
| session, interpreter, sample_directories) | ||
| def session_grpc(session): | ||
| """Runs tests for samples that need grpc.""" | ||
| # TODO: Remove this when grpc supports Python 3. | ||
| def session_gae(session): | ||
| """Runs test for GAE Standard samples.""" | ||
| sample_directories = collect_sample_dirs('appengine/standard') | ||
| run_tests_in_sesssion( | ||
| session, | ||
| 'python2.7', | ||
| sample_directories=itertools.chain( | ||
| collect_sample_dirs('speech'), | ||
| collect_sample_dirs('bigtable'))) | ||
| session, 'python2.7', sample_directories, use_appengine=True) | ||
| @nox.parametrize('subsession', ['gae', 'tests']) | ||
| def session_travis(session, subsession): | ||
| """On travis, just run with python3.4 and don't run slow or flaky tests.""" | ||
| if subsession == 'tests': | ||
| sample_directories = collect_sample_dirs( | ||
| '.', set('./appengine/standard')) | ||
| run_tests_in_sesssion( | ||
| session, 'python3.4', skip_flaky=True, changed_only=True) | ||
| session, 'python3.4', sample_directories, | ||
| skip_flaky=True, changed_only=True) | ||
| else: | ||
| sample_directories = collect_sample_dirs('appengine/standard') | ||
| run_tests_in_sesssion( | ||
| session, 'python2.7', use_appengine=True, skip_flaky=True, | ||
| changed_only=True, | ||
| sample_directories=collect_sample_dirs( | ||
| 'appengine/standard', | ||
| APPENGINE_BLACKLIST)) | ||
| session, 'python2.7', sample_directories, | ||
| skip_flaky=True, changed_only=True) | ||
| def session_lint(session): | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this have some
sixmagic for python2 compatibility?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think Jon is just fixing a double encode? I think in general if you want Python strings as bytes, do the encode, no six necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah cool. I totally didn't look at the context ^_^;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah fixing a double encode. No idea how this worked on py2.7 other than luck.