From 59a4fd102ef3cea2a9e2fece6e78dcc1bf75d484 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Bot Date: Fri, 19 Feb 2021 09:43:59 -0800 Subject: [PATCH] docs: update python contributing guide (#63) Adds details about blacken, updates version for system tests, and shows how to pass through pytest arguments. --- packages/google-cloud-build/CONTRIBUTING.rst | 22 ++++++++++++++++---- packages/google-cloud-build/synth.metadata | 4 ++-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/packages/google-cloud-build/CONTRIBUTING.rst b/packages/google-cloud-build/CONTRIBUTING.rst index 2d03749d02c2..5909ed160edf 100644 --- a/packages/google-cloud-build/CONTRIBUTING.rst +++ b/packages/google-cloud-build/CONTRIBUTING.rst @@ -70,9 +70,14 @@ We use `nox `__ to instrument our tests. - To test your changes, run unit tests with ``nox``:: $ nox -s unit-2.7 - $ nox -s unit-3.7 + $ nox -s unit-3.8 $ ... +- Args to pytest can be passed through the nox command separated by a `--`. For + example, to run a single test:: + + $ nox -s unit-3.8 -- -k + .. note:: The unit tests and system tests are described in the @@ -93,8 +98,12 @@ On Debian/Ubuntu:: ************ Coding Style ************ +- We use the automatic code formatter ``black``. You can run it using + the nox session ``blacken``. This will eliminate many lint errors. Run via:: + + $ nox -s blacken -- PEP8 compliance, with exceptions defined in the linter configuration. +- PEP8 compliance is required, with exceptions defined in the linter configuration. If you have ``nox`` installed, you can test that you have not introduced any non-compliant code via:: @@ -133,13 +142,18 @@ Running System Tests - To run system tests, you can execute:: - $ nox -s system-3.7 + # Run all system tests + $ nox -s system-3.8 $ nox -s system-2.7 + # Run a single system test + $ nox -s system-3.8 -- -k + + .. note:: System tests are only configured to run under Python 2.7 and - Python 3.7. For expediency, we do not run them in older versions + Python 3.8. For expediency, we do not run them in older versions of Python 3. This alone will not run the tests. You'll need to change some local diff --git a/packages/google-cloud-build/synth.metadata b/packages/google-cloud-build/synth.metadata index 223c87fb313e..e62af30988ef 100644 --- a/packages/google-cloud-build/synth.metadata +++ b/packages/google-cloud-build/synth.metadata @@ -4,7 +4,7 @@ "git": { "name": ".", "remote": "https://github.com/googleapis/python-cloudbuild.git", - "sha": "401f07e0765ce9747602b609ef15eb356156072b" + "sha": "ef773da37190bda9de1581c9d5f68d400857098d" } }, { @@ -19,7 +19,7 @@ "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "33366574ffb9e11737b3547eb6f020ecae0536e8" + "sha": "4679e7e415221f03ff2a71e3ffad75b9ec41d87e" } } ],