You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 line
1.1 KiB

  1. #!/usr/bin/env bats
  2. load test_helper
  3. bats_bin="${BATS_TEST_DIRNAME}/../bin/python-build"
  4. static_version="$(grep VERSION "$bats_bin" | head -1 | cut -d'"' -f 2)"
  5. @test "python-build static version" {
  6. stub git 'echo "ASPLODE" >&2; exit 1'
  7. run python-build --version
  8. assert_success "python-build ${static_version}"
  9. unstub git
  10. }
  11. @test "python-build git version" {
  12. stub git \
  13. 'remote -v : echo origin https://github.com/yyuu/pyenv.git' \
  14. "describe --tags HEAD : echo v1984-12-gSHA"
  15. run python-build --version
  16. assert_success "python-build 1984-12-gSHA"
  17. unstub git
  18. }
  19. @test "git describe fails" {
  20. stub git \
  21. 'remote -v : echo origin https://github.com/yyuu/pyenv.git' \
  22. "describe --tags HEAD : echo ASPLODE >&2; exit 1"
  23. run python-build --version
  24. assert_success "python-build ${static_version}"
  25. unstub git
  26. }
  27. @test "git remote doesn't match" {
  28. stub git \
  29. 'remote -v : echo origin https://github.com/Homebrew/homebrew.git' \
  30. "describe --tags HEAD : echo v1984-12-gSHA"
  31. run python-build --version
  32. assert_success "python-build ${static_version}"
  33. }