403Webshell
Server IP : 103.175.220.74  /  Your IP : 216.73.216.151
Web Server : nginx/1.18.0
System : Linux p-floo-wj1-db 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User : deploy ( 1003)
PHP Version : 7.4.3-4ubuntu2.29
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/deploy/.pyenv/plugins/pyenv-virtualenv/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/deploy/.pyenv/plugins/pyenv-virtualenv/test/python.bats
#!/usr/bin/env bats

load test_helper

setup() {
  export PYENV_ROOT="${TMP}/pyenv"
  export PYENV_VERSION="2.7.8"
  setup_version "2.7.8"
  create_executable "2.7.8" "virtualenv"
  stub pyenv-prefix "echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'"
  stub pyenv-prefix "echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'"
  stub pyenv-prefix "echo '${PYENV_ROOT}/versions/${PYENV_VERSION}'"
  stub pyenv-hooks "virtualenv : echo"
  stub pyenv-rehash " : true"
  stub pyenv-version-name "echo \${PYENV_VERSION}"
  stub curl true
  stub python-build "echo python2.7"
}

teardown() {
  unstub curl
  unstub pyenv-version-name
  unstub pyenv-prefix
  unstub pyenv-hooks
  unstub pyenv-rehash
  unstub python-build
  teardown_version "2.7.8"
  rm -fr "$TMP"/*
}

@test "resolve python executable from enabled version" {
  remove_executable "2.7.7" "python2.7"
  create_executable "2.7.8" "python2.7"
  remove_executable "2.7.9" "python2.7"

  stub pyenv-exec "python -m venv --help : false"
  stub pyenv-exec "virtualenv --verbose * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
  stub pyenv-exec "python -s -m ensurepip : true"
  stub pyenv-which "python2.7 : echo ${PYENV_ROOT}/versions/2.7.8/bin/python2.7"

  run pyenv-virtualenv --verbose --python=python2.7 venv

  unstub pyenv-exec
  assert_output <<OUT
PYENV_VERSION=2.7.8 virtualenv --verbose --python=${PYENV_ROOT}/versions/2.7.8/bin/python2.7 ${PYENV_ROOT}/versions/2.7.8/envs/venv
OUT
  assert_success

  unstub pyenv-which

  remove_executable "2.7.7" "python2.7"
  remove_executable "2.7.8" "python2.7"
  remove_executable "2.7.9" "python2.7"
}

@test "resolve python executable from other versions" {
  remove_executable "2.7.7" "python2.7"
  remove_executable "2.7.8" "python2.7"
  create_executable "2.7.9" "python2.7"

  stub pyenv-exec "python -m venv --help : false"
  stub pyenv-exec "virtualenv --verbose * : echo PYENV_VERSION=\${PYENV_VERSION} \"\$@\""
  stub pyenv-exec "python -s -m ensurepip : true"
  stub pyenv-which "python2.7 : false"
  stub pyenv-whence "python2.7 : echo 2.7.7; echo 2.7.8; echo 2.7.9"
  stub pyenv-which "python2.7 : echo ${PYENV_ROOT}/versions/2.7.9/bin/python2.7"

  run pyenv-virtualenv --verbose --python=python2.7 venv

  assert_output <<OUT
PYENV_VERSION=2.7.8 virtualenv --verbose --python=${PYENV_ROOT}/versions/2.7.9/bin/python2.7 ${PYENV_ROOT}/versions/2.7.8/envs/venv
OUT
  assert_success

  unstub pyenv-which
  unstub pyenv-whence
  unstub pyenv-exec

  remove_executable "2.7.7" "python2.7"
  remove_executable "2.7.8" "python2.7"
  remove_executable "2.7.9" "python2.7"
}

@test "cannot resolve python executable" {
  remove_executable "2.7.7" "python2.7"
  remove_executable "2.7.8" "python2.7"
  remove_executable "2.7.9" "python2.7"

  stub pyenv-which "python2.7 : false"
  stub pyenv-whence "python2.7 : false"
  stub pyenv-which "python2.7 : false"

  run pyenv-virtualenv --verbose --python=python2.7 venv

  assert_output <<OUT
pyenv-virtualenv: \`python2.7' is not installed in pyenv.
Run \`pyenv install python2.7' to install it.
OUT
  assert_failure

  unstub pyenv-which
  unstub pyenv-whence

  remove_executable "2.7.7" "python2.7"
  remove_executable "2.7.8" "python2.7"
  remove_executable "2.7.9" "python2.7"
}

@test "invalid python name" {
  run pyenv-virtualenv --verbose --python=99.99.99 venv

  assert_output <<OUT
pyenv-virtualenv: \`99.99.99' is not installed in pyenv.
It does not look like a valid Python version. See \`pyenv install --list' for available versions.
OUT
  assert_failure
}

Youez - 2016 - github.com/yon3zu
LinuXploit