Skip to content
This repository was archived by the owner on Mar 13, 2022. It is now read-only.

Add tox and travis support #7

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# ref: https://docs.travis-ci.com/user/languages/python
language: python
env:
- TOXENV=py36
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

py36 is not available on default python image. Must be specified as image.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean travis default python image, right? It said it is supported here: https://docs.travis-ci.com/user/languages/python/ I assume they've added it.

- TOXENV=py35
- TOXENV=py34
- TOXENV=py27

install:
- pip install tox

script:
- tox

49 changes: 49 additions & 0 deletions run_tox.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/bash

# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Script to fetch latest swagger spec.
# Puts the updated spec at api/swagger-spec/

set -o errexit
set -o nounset
set -o pipefail

RUNNING_DIR=$(pwd)
TMP_DIR=$(mktemp -d)

function cleanup()
{
cd "${RUNNING_DIR}"
# rm -rf "${TMP_DIR}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment really required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove.

}
trap cleanup EXIT SIGINT


SCRIPT_ROOT=$(dirname "${BASH_SOURCE}")
pushd "${SCRIPT_ROOT}" > /dev/null
SCRIPT_ROOT=`pwd`
popd > /dev/null

cd "${TMP_DIR}"
git clone https://github.com/kubernetes-incubator/client-python.git
cd client-python
cp -r "${SCRIPT_ROOT}/." kubernetes/base
pip install -r requirements.txt
pip install -r test-requirements.txt

# Run the user-provided command.
"${@}"

11 changes: 11 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[tox]
skipsdist = True
envlist = py27, py34, py35, py36

[testenv]
passenv = TOXENV CI TRAVIS TRAVIS_*
commands =
python -V
pip install nose
./run_tox.sh nosetests []