GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Refactor the testing setup a little · PeterDelis/python-docs-samples@0b0b55e

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .travis.yml
  • TESTING.md
  • scripts
    • README.md
    • decrypt-secrets.sh
    • encrypt-secrets.sh
    • travis.sh
  • secrets.tar.enc
  • testing
    • .gitignore
    • requirements-dev.in
    • requirements-dev.txt
    • secrets.tar.enc
    • test-env.tmpl.sh
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.travis.yml‎

Copy file name to clipboardExpand all lines: .travis.yml
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,7 @@ cache:
1212
- $HOME/.cache
1313
env:
1414
global:
15-
- PATH=${PATH}:${HOME}/gcloud/google-cloud-sdk/bin
16-
- GOOGLE_APPLICATION_CREDENTIALS=${TRAVIS_BUILD_DIR}/testing/resources/service-account.json
17-
- GOOGLE_CLIENT_SECRETS=${TRAVIS_BUILD_DIR}/testing/resources/client-secrets.json
18-
- GAE_ROOT=${HOME}/.cache/
19-
- secure: f3aU0nf8ZBV2QfZ03oeqvR0f/JM69P/7IH3IGoBcRUWVIXXhQ6Esh9SmCUILPtis1ZKu11I9c+NDebZio7PFgTqfvLbKzAkrg0ucx+Bsyx6379/S1trbLeKunERSGA3GqK6+OCoR5q/9sKxNvlm/c/e9h7xZmPfP5W0qwVR/K0M=
15+
secure: V8kTaIK8NYMEUVzaekLoVgJzz5/9yA/KKL8CVgOmiPEjt1o1wAXy+ojyXCgjGmB16OOcTYKtXKvOBndDg99MxUzMc9uLrHF4ub2fJZy3ZoCfPaxHNOpIOTTAhB8J/nog/JpW5NnJOBGE8fAQ/TUy8nSvOwe27n4qKO5eWqTy5kA=
2016
addons:
2117
apt:
2218
sources:
Collapse file

‎TESTING.md‎

Copy file name to clipboardExpand all lines: TESTING.md
+10-11Lines changed: 10 additions & 11 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -46,27 +46,26 @@ The script will also instruct you to follow a URL to enable APIs. You will need
4646

4747
### Getting a service account key
4848

49-
From the Cloud Console, create a new Service Account and download its json key. Place this file in `testing/resources/service-account.json`.
49+
From the Cloud Console, create a new Service Account and download its json key. Place this file in `testing/service-account.json`.
5050

51-
Create a new OAuth client ID. Create a file `testing/resources/client-secrets.json` and write the `client_id` and `client_secret` to the file in the [Client Secrets JSON format](https://developers.google.com/api-client-library/python/guide/aaa_client_secrets).
51+
Create a new OAuth client ID. Create a file `testing/client-secrets.json` and write the `client_id` and `client_secret` to the file in the [Client Secrets JSON format](https://developers.google.com/api-client-library/python/guide/aaa_client_secrets).
5252

5353
## Environment variables
5454

55-
* Copy `testing/resources/test-env.tmpl.sh` to `testing/resources/test-env.sh`, and updated it with your configuration.
56-
* Run `source testing/resources/test-env.sh`.
57-
* Run `export GOOGLE_APPLICATION_CREDENTIALS=testing/resources/service-account.json`.
58-
* Run `export GOOGLE_CLIENT_SECRETS=testing/resources/client-secrets.json`.
55+
* Copy `testing/test-env.tmpl.sh` to `testing/test-env.sh`, and update it with your configuration.
56+
* Run `source testing/test-env.sh`.
57+
* Run `export GOOGLE_APPLICATION_CREDENTIALS=testing/service-account.json`.
58+
* Run `export GOOGLE_CLIENT_SECRETS=testing/client-secrets.json`.
5959

6060
### Test environments
6161

6262
We use [nox](https://nox.readthedocs.org/en/latest/) to configure
6363
multiple python sessions:
6464

65-
* ``tests`` contains tests for samples that run in a normal Python 2.7 or 3.4
66-
environment. This is everything outside of the ``appengine`` directory. It's
67-
parameterized to run all the tests using the 2.7 and 3.4 interpreters.
65+
* ``tests`` Run all the tests for every sample. It's parameterized to run all
66+
the tests using the 2.7 and 3.5 interpreters.
6867
* ``gae`` contains tests for samples that run only in Google App Engine. This is
69-
(mostly) everything in the ``appengine`` directory.
68+
everything in the ``appengine`` directory.
7069
* ``lint`` just runs the linter.
7170

7271
To see a list of the available sessions:
@@ -81,7 +80,7 @@ with the ``-s`` flag:
8180
To run one particular session or provide additional parameters to ``py.test``,
8281
invoke nox like this:
8382

84-
nox -s tests -- storage/api
83+
nox -s tests -- storage/cloud-client
8584

8685
### Adding new tests
8786
When adding a new top-level directory, be sure to edit ``.coveragerc`` to
Collapse file

‎scripts/README.md‎

Copy file name to clipboard
100644100755
Expand all lines: scripts/README.md
File mode changed.
Collapse file

‎scripts/decrypt-secrets.sh‎

Copy file name to clipboard
+25Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
# Copyright 2015 Google Inc. All rights reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
17+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
18+
ROOT=$( dirname "$DIR" )
19+
20+
# Work from the project root.
21+
cd $ROOT
22+
23+
openssl aes-256-cbc -k "$1" -in testing/secrets.tar.enc -out secrets.tar -d
24+
tar xvf secrets.tar
25+
rm secrets.tar
Collapse file

‎scripts/encrypt-secrets.sh‎

Copy file name to clipboardExpand all lines: scripts/encrypt-secrets.sh
+10-4Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,17 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
read -s -p "Enter password for encryption: " password
17+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
18+
ROOT=$( dirname "$DIR" )
19+
20+
# Work from the project root.
21+
cd $ROOT
22+
23+
read -s -p "Enter password for encryption: " PASSWORD
1824
echo
1925

20-
tar cvf secrets.tar testing/resources/{service-account.json,client-secrets.json,test-env.sh}
21-
openssl aes-256-cbc -k "$password" -in secrets.tar -out secrets.tar.enc
26+
tar cvf secrets.tar testing/{service-account.json,client-secrets.json,test-env.sh}
27+
openssl aes-256-cbc -k "$PASSWORD" -in secrets.tar -out testing/secrets.tar.enc
2228
rm secrets.tar
2329

24-
travis encrypt "secrets_password=$password" --add
30+
travis encrypt "SECRETS_PASSWORD=$PASSWORD" --add --override
Collapse file

‎scripts/travis.sh‎

Copy file name to clipboardExpand all lines: scripts/travis.sh
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22

33
# Decrypt secrets if not on an external PR.
44
if [[ $TRAVIS_SECURE_ENV_VARS == "true" ]]; then
5-
openssl aes-256-cbc -k "$secrets_password" -in secrets.tar.enc -out secrets.tar -d;
6-
tar xvf secrets.tar;
5+
scripts/decrypt-secrets.sh "$SECRETS_PASSWORD"
76
fi
87

98
if [[ $TRAVIS_SECURE_ENV_VARS == "true" ]]; then
10-
source ${TRAVIS_BUILD_DIR}/testing/resources/test-env.sh;
9+
source ${TRAVIS_BUILD_DIR}/testing/test-env.sh;
1110
nox --stop-on-first-error -s lint travis;
1211
else
1312
# only run lint on external PRs
Collapse file

‎secrets.tar.enc‎

Copy file name to clipboard
-9.53 KB
Binary file not shown.
Collapse file

‎testing/.gitignore‎

Copy file name to clipboard
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
test-env.sh
2+
service-account.json
3+
client-secrets.json
Collapse file

‎requirements-dev.in‎ ‎testing/requirements-dev.in‎requirements-dev.in renamed to testing/requirements-dev.in

Copy file name to clipboard
File renamed without changes.
Collapse file

‎requirements-dev.txt‎ ‎testing/requirements-dev.txt‎requirements-dev.txt renamed to testing/requirements-dev.txt

Copy file name to clipboard
File renamed without changes.

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.