| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 632ff88 commit 1c4adc0
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -50,8 +50,10 @@ docs.metadata | |||
| 50 | 50 | ||
| 51 | 51 | # Virtual environment | |
| 52 | 52 | env/ | |
| 53 | + | ||
| 54 | + # Test logs | ||
| 53 | 55 | coverage.xml | |
| 54 | - sponge_log.xml | ||
| 56 | + *sponge_log.xml | ||
| 55 | 57 | ||
| 56 | 58 | # System test environment variables. | |
| 57 | 59 | system_tests/local_test_setup | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,6 +40,16 @@ python3 -m pip uninstall --yes --quiet nox-automation | |||
| 40 | 40 | python3 -m pip install --upgrade --quiet nox | |
| 41 | 41 | python3 -m nox --version | |
| 42 | 42 | ||
| 43 | + # If this is a continuous build, send the test log to the FlakyBot. | ||
| 44 | + # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot. | ||
| 45 | + if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"continuous"* ]]; then | ||
| 46 | + cleanup() { | ||
| 47 | + chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot | ||
| 48 | + $KOKORO_GFILE_DIR/linux_amd64/flakybot | ||
| 49 | + } | ||
| 50 | + trap cleanup EXIT HUP | ||
| 51 | + fi | ||
| 52 | + | ||
| 43 | 53 | # If NOX_SESSION is set, it only runs the specified session, | |
| 44 | 54 | # otherwise run all the sessions. | |
| 45 | 55 | if [[ -n "${NOX_SESSION:-}" ]]; then | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -70,9 +70,14 @@ We use `nox <https://nox.readthedocs.io/en/latest/>`__ to instrument our tests. | |||
| 70 | 70 | - To test your changes, run unit tests with ``nox``:: | |
| 71 | 71 | ||
| 72 | 72 | $ nox -s unit-2.7 | |
| 73 | - $ nox -s unit-3.7 | ||
| 73 | + $ nox -s unit-3.8 | ||
| 74 | 74 | $ ... | |
| 75 | 75 | ||
| 76 | + - Args to pytest can be passed through the nox command separated by a `--`. For | ||
| 77 | + example, to run a single test:: | ||
| 78 | + | ||
| 79 | + $ nox -s unit-3.8 -- -k <name of test> | ||
| 80 | + | ||
| 76 | 81 | .. note:: | |
| 77 | 82 | ||
| 78 | 83 | The unit tests and system tests are described in the | |
@@ -93,8 +98,12 @@ On Debian/Ubuntu:: | |||
| 93 | 98 | ************ | |
| 94 | 99 | Coding Style | |
| 95 | 100 | ************ | |
| 101 | + - We use the automatic code formatter ``black``. You can run it using | ||
| 102 | + the nox session ``blacken``. This will eliminate many lint errors. Run via:: | ||
| 103 | + | ||
| 104 | + $ nox -s blacken | ||
| 96 | 105 | ||
| 97 | - - PEP8 compliance, with exceptions defined in the linter configuration. | ||
| 106 | + - PEP8 compliance is required, with exceptions defined in the linter configuration. | ||
| 98 | 107 | If you have ``nox`` installed, you can test that you have not introduced | |
| 99 | 108 | any non-compliant code via:: | |
| 100 | 109 | ||
@@ -133,13 +142,18 @@ Running System Tests | |||
| 133 | 142 | ||
| 134 | 143 | - To run system tests, you can execute:: | |
| 135 | 144 | ||
| 136 | - $ nox -s system-3.7 | ||
| 145 | + # Run all system tests | ||
| 146 | + $ nox -s system-3.8 | ||
| 137 | 147 | $ nox -s system-2.7 | |
| 138 | 148 | ||
| 149 | + # Run a single system test | ||
| 150 | + $ nox -s system-3.8 -- -k <name of test> | ||
| 151 | + | ||
| 152 | + | ||
| 139 | 153 | .. note:: | |
| 140 | 154 | ||
| 141 | 155 | System tests are only configured to run under Python 2.7 and | |
| 142 | - Python 3.7. For expediency, we do not run them in older versions | ||
| 156 | + Python 3.8. For expediency, we do not run them in older versions | ||
| 143 | 157 | of Python 3. | |
| 144 | 158 | ||
| 145 | 159 | This alone will not run the tests. You'll need to change some local | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -16,10 +16,10 @@ | |||
| 16 | 16 | ||
| 17 | 17 | # Generated by synthtool. DO NOT EDIT! | |
| 18 | 18 | include README.rst LICENSE | |
| 19 | - recursive-include google *.json *.proto | ||
| 19 | + recursive-include google *.json *.proto py.typed | ||
| 20 | 20 | recursive-include tests * | |
| 21 | 21 | global-exclude *.py[co] | |
| 22 | 22 | global-exclude __pycache__ | |
| 23 | 23 | ||
| 24 | 24 | # Exclude scripts for samples readmegen | |
| 25 | - prune scripts/readme-gen | ||
| 25 | + prune scripts/readme-gen | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -93,6 +93,7 @@ def default(session): | |||
| 93 | 93 | session.run( | |
| 94 | 94 | "py.test", | |
| 95 | 95 | "--quiet", | |
| 96 | + f"--junitxml=unit_{session.python}_sponge_log.xml", | ||
| 96 | 97 | "--cov=google/cloud", | |
| 97 | 98 | "--cov=tests/unit", | |
| 98 | 99 | "--cov-append", | |
@@ -122,6 +123,9 @@ def system(session): | |||
| 122 | 123 | # Sanity check: Only run tests if the environment variable is set. | |
| 123 | 124 | if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""): | |
| 124 | 125 | session.skip("Credentials must be set via environment variable") | |
| 126 | + # Install pyopenssl for mTLS testing. | ||
| 127 | + if os.environ.get("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true": | ||
| 128 | + session.install("pyopenssl") | ||
| 125 | 129 | ||
| 126 | 130 | system_test_exists = os.path.exists(system_test_path) | |
| 127 | 131 | system_test_folder_exists = os.path.exists(system_test_folder_path) | |
@@ -141,9 +145,21 @@ def system(session): | |||
| 141 | 145 | ||
| 142 | 146 | # Run py.test against the system tests. | |
| 143 | 147 | if system_test_exists: | |
| 144 | - session.run("py.test", "--quiet", system_test_path, *session.posargs) | ||
| 148 | + session.run( | ||
| 149 | + "py.test", | ||
| 150 | + "--quiet", | ||
| 151 | + f"--junitxml=system_{session.python}_sponge_log.xml", | ||
| 152 | + system_test_path, | ||
| 153 | + *session.posargs, | ||
| 154 | + ) | ||
| 145 | 155 | if system_test_folder_exists: | |
| 146 | - session.run("py.test", "--quiet", system_test_folder_path, *session.posargs) | ||
| 156 | + session.run( | ||
| 157 | + "py.test", | ||
| 158 | + "--quiet", | ||
| 159 | + f"--junitxml=system_{session.python}_sponge_log.xml", | ||
| 160 | + system_test_folder_path, | ||
| 161 | + *session.posargs, | ||
| 162 | + ) | ||
| 147 | 163 | ||
| 148 | 164 | ||
| 149 | 165 | @nox.session(python=DEFAULT_PYTHON_VERSION) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,7 +4,7 @@ | |||
| 4 | 4 | "git": { | |
| 5 | 5 | "name": ".", | |
| 6 | 6 | "remote": "https://github.com/googleapis/python-workflows.git", | |
| 7 | - "sha": "639fadf257c4cbc9e3152ba5e78786da28ab07fe" | ||
| 7 | + "sha": "22bf4f1fdaf8bf1781821fc13ca03e1b5745f01f" | ||
| 8 | 8 | } | |
| 9 | 9 | }, | |
| 10 | 10 | { | |
@@ -19,14 +19,14 @@ | |||
| 19 | 19 | "git": { | |
| 20 | 20 | "name": "synthtool", | |
| 21 | 21 | "remote": "https://github.com/googleapis/synthtool.git", | |
| 22 | - "sha": "778d8beae28d6d87eb01fdc839a4b4d966ed2ebe" | ||
| 22 | + "sha": "0780323da96d5a53925fe0547757181fe76e8f1e" | ||
| 23 | 23 | } | |
| 24 | 24 | }, | |
| 25 | 25 | { | |
| 26 | 26 | "git": { | |
| 27 | 27 | "name": "synthtool", | |
| 28 | 28 | "remote": "https://github.com/googleapis/synthtool.git", | |
| 29 | - "sha": "778d8beae28d6d87eb01fdc839a4b4d966ed2ebe" | ||
| 29 | + "sha": "0780323da96d5a53925fe0547757181fe76e8f1e" | ||
| 30 | 30 | } | |
| 31 | 31 | } | |
| 32 | 32 | ], | |
| Back | FazBrowse Home | New Git URL |
0 commit comments