From 2f8c625a7dde6dae516a824a9ffa6591b09e70e8 Mon Sep 17 00:00:00 2001 From: Ivan Pozdeev Date: Mon, 20 Sep 2021 07:43:08 +0300 Subject: [PATCH] Fix test failures --- plugins/python-build/test/build.bats | 8 +++----- plugins/python-build/test/compiler.bats | 8 ++------ plugins/python-build/test/pyenv_ext.bats | 26 +++++++++--------------- plugins/python-build/test/version.bats | 3 +-- 4 files changed, 16 insertions(+), 29 deletions(-) diff --git a/plugins/python-build/test/build.bats b/plugins/python-build/test/build.bats index 3113b37b..e2f95331 100644 --- a/plugins/python-build/test/build.bats +++ b/plugins/python-build/test/build.bats @@ -160,17 +160,15 @@ OUT brew_libdir="$TMP/homebrew-yaml" mkdir -p "$brew_libdir" - # pyenv/pyenv#1026 - stub uname false false - - stub uname '-s : echo Linux' - stub uname '-s : echo Darwin' + for i in {1..4}; do stub uname '-s : echo Darwin'; done + for i in {1..2}; do stub sw_vers '-productVersion : echo 1010'; done stub brew "--prefix libyaml : echo '$brew_libdir'" false false stub_make_install install_fixture definitions/needs-yaml assert_success + unstub sw_vers unstub uname unstub brew unstub make diff --git a/plugins/python-build/test/compiler.bats b/plugins/python-build/test/compiler.bats index 0d426e0c..df813056 100644 --- a/plugins/python-build/test/compiler.bats +++ b/plugins/python-build/test/compiler.bats @@ -63,13 +63,9 @@ DEF mkdir -p "$INSTALL_ROOT" cd "$INSTALL_ROOT" - # pyenv/pyenv#1026 - stub uname false '-s : echo Darwin' false '-s : echo Darwin' '-s : echo Darwin' - stub sw_vers '-productVersion : echo 10.10' + for i in {1..5}; do stub uname '-s : echo Darwin'; done + for i in {1..4}; do stub sw_vers '-productVersion : echo 10.10'; done - stub sw_vers '-productVersion : echo 10.10' - stub sw_vers '-productVersion : echo 10.10' - stub sw_vers '-productVersion : echo 10.10' stub cc 'false' stub brew 'false' stub make \ diff --git a/plugins/python-build/test/pyenv_ext.bats b/plugins/python-build/test/pyenv_ext.bats index e4453113..9afb0ac7 100644 --- a/plugins/python-build/test/pyenv_ext.bats +++ b/plugins/python-build/test/pyenv_ext.bats @@ -136,7 +136,7 @@ OUT @test "apply built-in python patches should be sorted by its name" { cached_tarball "Python-3.6.2" - stub brew false + for i in {1..2}; do stub brew '* : false'; done stub_make_install stub patch ' : for arg; do [[ "$arg" == "-"* ]] || sed -e "s/^/patch: /" "$arg"; done >> build.log' @@ -144,9 +144,7 @@ OUT echo "bar" | install_patch definitions/vanilla-python "Python-3.6.2/bar.patch" echo "baz" | install_patch definitions/vanilla-python "Python-3.6.2/baz.patch" - # yyuu/pyenv#257 - stub uname '-s : echo Linux' - stub uname '-s : echo Linux' + for i in {1..2}; do stub uname '-s : echo Linux'; done TMPDIR="$TMP" install_tmp_fixture definitions/vanilla-python < /dev/null assert_success @@ -173,9 +171,7 @@ OUT " : echo \"$MAKE \$@\" >> build.log" \ " : echo \"$MAKE \$@\" >> build.log && cat build.log >> '$INSTALL_ROOT/build.log'" - # yyuu/pyenv#257 - stub uname '-s : echo Linux' - stub uname '-s : echo Linux' + for i in {1..4}; do stub uname '-s : echo Darwin'; done PYTHON_MAKE_INSTALL_TARGET="altinstall" TMPDIR="$TMP" install_tmp_fixture definitions/vanilla-python < /dev/null assert_success @@ -259,10 +255,7 @@ OUT touch "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python3.4-config" chmod +x "${INSTALL_ROOT}/Library/Frameworks/Python.framework/Versions/Current/bin/python3.4-config" - # yyuu/pyenv#257 - stub uname '-s : echo Darwin' - - stub uname '-s : echo Darwin' + for i in {1..3}; do stub uname '-s : echo Darwin'; done PYTHON_CONFIGURE_OPTS="--enable-framework" TMPDIR="$TMP" run_inline_definition <> build.log" \ " : echo \"$MAKE \$@\" >> build.log && cat build.log >> '$INSTALL_ROOT/build.log'" @@ -311,6 +303,8 @@ make install OUT unstub make + unstub uname + unstub brew } @test "default MACOSX_DEPLOYMENT_TARGET" { diff --git a/plugins/python-build/test/version.bats b/plugins/python-build/test/version.bats index 370abc74..15c8635f 100644 --- a/plugins/python-build/test/version.bats +++ b/plugins/python-build/test/version.bats @@ -32,8 +32,7 @@ static_version="$(grep VERSION "$bats_bin" | head -1 | cut -d'"' -f 2)" @test "git remote doesn't match" { stub git \ - 'remote -v : echo origin https://github.com/Homebrew/homebrew.git' \ - "describe --tags HEAD : echo v1984-12-gSHA" + 'remote -v : echo origin https://github.com/Homebrew/homebrew.git' run python-build --version assert_success "python-build ${static_version}" }