Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple install tests on Travis CI #23

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
28 changes: 28 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
language: python

python:
- "3.7-dev"
- "3.6"
- "3.5"
- "3.4"
- "3.3"
- "3.2"
- "2.7"
- "2.6"

env:
- SCRIPT_SRC=local
- SCRIPT_SRC=remote
Copy link
Member

Choose a reason for hiding this comment

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

I'm not at all sure that we should be testing "remote" here. The tests should be testing what's in the repository - for example, the test runs for a PR shouldn't fail because the published version was broken.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, will remove it.

Copy link
Member

Choose a reason for hiding this comment

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

We can move tests for remote to run only when triggered manually (or via API) and not PR. Deal? I don't want to completely eliminate them.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Not sure I care much, TBH. As noted, I'm against this approach (of using a shell script) anyway.


cache:
pip: true

install:
- pip uninstall --yes setuptools pip

script:
- .travis/helpers.sh "$TRAVIS_PYTHON_VERSION" "$SCRIPT_SRC"
- pip -V

jobs:
fast_finish: true
53 changes: 53 additions & 0 deletions .travis/helpers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#! /usr/bin/env bash

DEBUG=$DEBUG

set -euo pipefail

[[ -n "$DEBUG" ]] && set -xv

declare -a SPECIAL_VERSIONS=('2.6' '3.2' '3.3')

function find_get_pip_version() {
local version="$1"

for v in "${SPECIAL_VERSIONS[@]}"
do
[[ "$version" == "$v" ]] && echo "$version" && return 0
done

return 1
}

function cat_get_pip() {
local version=$(find_get_pip_version "$1")

local path="get-pip.py"
[[ -n "$version" ]] && path="$version/$path"
local src="$2"
local cmd=cat
if [[ "$src" == "remote" ]]
then
path="https://bootstrap.pypa.io/$path"
cmd='wget -O - '
>&2 echo Downloading bootstrap script from remote...
elif [[ "$src" != "local" ]]
then
>&2 echo Wrong source argument: $src
exit 1
fi

>&2 echo Version $1 requires following script: $path
$cmd $path
Copy link
Member

Choose a reason for hiding this comment

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

Are you testing an install into an environment that currently doesn't have pip installed? I can't tell (but I don't think you are)... Someone who has pip installed can simply do python -m pip install -U pip. (Sure, we have to support that case, but the key use case is someone trying to bootstrap pip into an empty environment).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

OK, thanks for the pointer.

}

function main() {
local python_version="$1"
local get_pip_src="$2"
cat_get_pip "$python_version" "$get_pip_src" | python -
}

# Reset settings
set +eu

main $*