25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

110 satır
2.9 KiB

10 yıl önce
10 yıl önce
10 yıl önce
10 yıl önce
10 yıl önce
10 yıl önce
  1. #!/usr/bin/env bats
  2. load test_helper
  3. NUM_DEFINITIONS="$(find "$BATS_TEST_DIRNAME"/../share/python-build -maxdepth 1 -type f | wc -l)"
  4. @test "list built-in definitions" {
  5. run python-build --definitions
  6. assert_success
  7. assert_output_contains "2.7.8"
  8. assert_output_contains "jython-2.5.3"
  9. assert [ "${#lines[*]}" -eq "$NUM_DEFINITIONS" ]
  10. }
  11. @test "custom PYTHON_BUILD_ROOT: nonexistent" {
  12. export PYTHON_BUILD_ROOT="$TMP"
  13. assert [ ! -e "${PYTHON_BUILD_ROOT}/share/python-build" ]
  14. run python-build --definitions
  15. assert_success ""
  16. }
  17. @test "custom PYTHON_BUILD_ROOT: single definition" {
  18. export PYTHON_BUILD_ROOT="$TMP"
  19. mkdir -p "${PYTHON_BUILD_ROOT}/share/python-build"
  20. touch "${PYTHON_BUILD_ROOT}/share/python-build/2.7.8-test"
  21. run python-build --definitions
  22. assert_success "2.7.8-test"
  23. }
  24. @test "one path via PYTHON_BUILD_DEFINITIONS" {
  25. export PYTHON_BUILD_DEFINITIONS="${TMP}/definitions"
  26. mkdir -p "$PYTHON_BUILD_DEFINITIONS"
  27. touch "${PYTHON_BUILD_DEFINITIONS}/2.7.8-test"
  28. run python-build --definitions
  29. assert_success
  30. assert_output_contains "2.7.8-test"
  31. assert [ "${#lines[*]}" -eq "$((NUM_DEFINITIONS + 1))" ]
  32. }
  33. @test "multiple paths via PYTHON_BUILD_DEFINITIONS" {
  34. export PYTHON_BUILD_DEFINITIONS="${TMP}/definitions:${TMP}/other"
  35. mkdir -p "${TMP}/definitions"
  36. touch "${TMP}/definitions/2.7.8-test"
  37. mkdir -p "${TMP}/other"
  38. touch "${TMP}/other/3.4.2-test"
  39. run python-build --definitions
  40. assert_success
  41. assert_output_contains "2.7.8-test"
  42. assert_output_contains "3.4.2-test"
  43. assert [ "${#lines[*]}" -eq "$((NUM_DEFINITIONS + 2))" ]
  44. }
  45. @test "installing definition from PYTHON_BUILD_DEFINITIONS by priority" {
  46. export PYTHON_BUILD_DEFINITIONS="${TMP}/definitions:${TMP}/other"
  47. mkdir -p "${TMP}/definitions"
  48. echo true > "${TMP}/definitions/2.7.8-test"
  49. mkdir -p "${TMP}/other"
  50. echo false > "${TMP}/other/2.7.8-test"
  51. run bin/python-build "2.7.8-test" "${TMP}/install"
  52. assert_success ""
  53. }
  54. @test "installing nonexistent definition" {
  55. run python-build "nonexistent" "${TMP}/install"
  56. assert [ "$status" -eq 2 ]
  57. assert_output "python-build: definition not found: nonexistent"
  58. }
  59. @test "sorting Python versions" {
  60. export PYTHON_BUILD_ROOT="$TMP"
  61. mkdir -p "${PYTHON_BUILD_ROOT}/share/python-build"
  62. expected="2.7-dev
  63. 2.7
  64. 2.7.1
  65. 2.7.2
  66. 2.7.3
  67. 3.4.0
  68. 3.4-dev
  69. 3.4.1
  70. 3.4.2
  71. jython-dev
  72. jython-2.5.0
  73. jython-2.5-dev
  74. jython-2.5.1
  75. jython-2.5.2
  76. jython-2.5.3
  77. jython-2.5.4-rc1
  78. jython-2.7-beta1
  79. jython-2.7-beta2
  80. jython-2.7-beta3"
  81. for ver in "$expected"; do
  82. touch "${PYTHON_BUILD_ROOT}/share/python-build/$ver"
  83. done
  84. run python-build --definitions
  85. assert_success "$expected"
  86. }
  87. @test "removing duplicate Python versions" {
  88. export PYTHON_BUILD_ROOT="$TMP"
  89. export PYTHON_BUILD_DEFINITIONS="${PYTHON_BUILD_ROOT}/share/python-build"
  90. mkdir -p "$PYTHON_BUILD_DEFINITIONS"
  91. touch "${PYTHON_BUILD_DEFINITIONS}/2.7.8"
  92. touch "${PYTHON_BUILD_DEFINITIONS}/3.4.2"
  93. run python-build --definitions
  94. assert_success
  95. assert_output <<OUT
  96. 2.7.8
  97. 3.4.2
  98. OUT
  99. }