File: version.bats

package info (click to toggle)
pyenv 2.6.8-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 8,496 kB
  • sloc: sh: 4,914; python: 410; makefile: 161; ansic: 60
file content (38 lines) | stat: -rw-r--r-- 1,065 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env bats

load test_helper

python_build_bin="${BATS_TEST_DIRNAME}/../bin/python-build"
static_version="$(grep VERSION "$python_build_bin" | head -n1 | cut -d'"' -f 2)"

@test "python-build static version" {
  stub git 'echo "ASPLODE" >&2; exit 1'
  run python-build --version
  assert_success "python-build ${static_version}"
  unstub git
}

@test "python-build git version" {
  stub git \
    'remote -v : echo origin https://github.com/pyenv/pyenv.git' \
    "describe --tags HEAD : echo v1984-12-gSHA"
  run python-build --version
  assert_success "python-build 1984-12-gSHA"
  unstub git
}

@test "git describe fails" {
  stub git \
    'remote -v : echo origin https://github.com/pyenv/pyenv.git' \
    "describe --tags HEAD : echo ASPLODE >&2; exit 1"
  run python-build --version
  assert_success "python-build ${static_version}"
  unstub git
}

@test "git remote doesn't match" {
  stub git \
    'remote -v : echo origin https://github.com/Homebrew/homebrew.git'
  run python-build --version
  assert_success "python-build ${static_version}"
}