From d12f178134bb492bcf4ec44c1f6d0d10a7910923 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Mon, 15 Oct 2018 16:49:21 -0700 Subject: [PATCH 1/4] Use new nox --- nox.py => noxfile.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) rename nox.py => noxfile.py (95%) diff --git a/nox.py b/noxfile.py similarity index 95% rename from nox.py rename to noxfile.py index e1f04e36eec..74884c6facb 100644 --- a/nox.py +++ b/noxfile.py @@ -208,10 +208,10 @@ def _session_tests(session, sample, post_install=None): success_codes=[0, 5]) +@nox.session(python='2.7') @nox.parametrize('sample', GAE_STANDARD_SAMPLES) -def session_gae(session, sample): +def gae(session, sample): """Runs py.test for an App Engine standard sample.""" - session.interpreter = 'python2.7' # Create a lib directory if needed, otherwise the App Engine vendor library # will complain. @@ -221,22 +221,23 @@ def session_gae(session, sample): _session_tests(session, sample, _setup_appengine_sdk) +@nox.session(python='2.7') @nox.parametrize('sample', NON_GAE_STANDARD_SAMPLES_PY2) -def session_py27(session, sample): +def py27(session, sample): """Runs py.test for a sample using Python 2.7""" - session.interpreter = 'python2.7' _session_tests(session, sample) +@nox.session(python='3.6') @nox.parametrize('sample', NON_GAE_STANDARD_SAMPLES_PY3) -def session_py36(session, sample): +def py36(session, sample): """Runs py.test for a sample using Python 3.6""" - session.interpreter = 'python3.6' _session_tests(session, sample) +@nox.session @nox.parametrize('sample', ALL_SAMPLE_DIRECTORIES) -def session_lint(session, sample): +def lint(session, sample): """Runs flake8 on the sample.""" session.install('flake8', 'flake8-import-order') @@ -253,10 +254,9 @@ def session_lint(session, sample): # Utility sessions # - -def session_missing_tests(session): +@nox.session +def missing_tests(session): """Lists all sample directories that do not have tests.""" - session.virtualenv = False print('The following samples do not have tests:') for sample in set(ALL_SAMPLE_DIRECTORIES) - set(ALL_TESTED_SAMPLES): print('* {}'.format(sample)) @@ -266,8 +266,9 @@ def session_missing_tests(session): list(_collect_dirs('.', suffix='.rst.in'))) +@nox.session @nox.parametrize('sample', SAMPLES_WITH_GENERATED_READMES) -def session_readmegen(session, sample): +def readmegen(session, sample): """(Re-)generates the readme for a sample.""" session.install('jinja2', 'pyyaml') @@ -278,7 +279,8 @@ def session_readmegen(session, sample): session.run('python', 'scripts/readme-gen/readme_gen.py', in_file) -def session_check_requirements(session): +@nox.session +def check_requirements(session): """Checks for out of date requirements and optionally updates them. This is intentionally not parametric, as it's desired to never have two From 87949fa16cfa947c259250728baf88c99a9fbb91 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Mon, 15 Oct 2018 17:04:42 -0700 Subject: [PATCH 2/4] Update Travis to use new nox --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2365aa29a28..b94d73c7835 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,7 @@ addons: - python3.6-dev install: - pip install --upgrade pip wheel virtualenv -- pip install --upgrade nox-automation +- pip install --upgrade nox - pip install --upgrade git+https://github.com/dhermes/ci-diff-helper.git script: - "./scripts/travis.sh" From 54f5f2d3a1bf3d7903ee531b82a6fd45cea52696 Mon Sep 17 00:00:00 2001 From: Charles Engelke Date: Tue, 16 Oct 2018 13:02:49 -0700 Subject: [PATCH 3/4] Handling of paths has changed. --- noxfile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/noxfile.py b/noxfile.py index 74884c6facb..1f553df53cd 100644 --- a/noxfile.py +++ b/noxfile.py @@ -193,7 +193,7 @@ def _session_tests(session, sample, post_install=None): session.chdir(sample) - if os.path.exists(os.path.join(sample, 'requirements.txt')): + if os.path.exists('requirements.txt'): session.install('-r', 'requirements.txt') if post_install: From ff3ff0529130a3d9d7f108b1a7f1906a02cf5b0c Mon Sep 17 00:00:00 2001 From: Charles Engelke Date: Tue, 16 Oct 2018 13:32:57 -0700 Subject: [PATCH 4/4] Run travis under Python 3.6 instead of 2 for nox --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index b94d73c7835..e518ee8d4d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,7 @@ sudo: false language: python +python: +- "3.6" services: - memcached - mysql