Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
Anup Das cf6f3c3200
fix(rehash): prevent terminal hang caused by stale or sandbox-blocked lock file (#3469)
il y a 1 mois
..
libexec Revert "Merge pull request #1153 from cmcginty/remove-sbang" il y a 7 ans
--version.bats pyenv launcher: introduce and export _PYENV_INSTALL_PREFIX (#3334) il y a 6 mois
Dockerfile add bats test under docker il y a 9 mois
README.md add test README il y a 9 mois
commands.bats Import tests from rbenv with `sed -e s/rbenv/pyenv/g` il y a 12 ans
completions.bats Merge remote-tracking branch 'rbenv/master' into rbenv-20151121 il y a 10 ans
exec.bats Prevent infinite loop if a shim is linked and called from a nonstandard location with "system" active il y a 6 mois
global.bats Merge remote-tracking branch 'rbenv/master' into rbenv-1.0 il y a 10 ans
help.bats Import tests from rbenv with `sed -e s/rbenv/pyenv/g` il y a 12 ans
hooks.bats Merge remote-tracking branch 'rbenv/master' into rbenv-1.0 il y a 10 ans
init.bats init: add --install for shell setup (#3454) il y a 1 mois
latest.bats tests: refactor: migrate to newly-added create_stub() il y a 6 mois
local.bats use BATS_FILE_TMPDIR in test/plugin test il y a 9 mois
pip-rehash.bats tests: refactor: rename and consolidate create_executable() functions il y a 6 mois
prefix.bats use BATS_FILE_TMPDIR in test/plugin test il y a 9 mois
pyenv.bats use BATS_FILE_TMPDIR in test/plugin test il y a 9 mois
pyenv_ext.bats Revert "add tests for `PYENV_FILE_ARG`" il y a 5 ans
rehash.bats fix(rehash): prevent terminal hang caused by stale or sandbox-blocked lock file (#3469) il y a 1 mois
run add possibility to filter tests with make il y a 9 mois
shell.bats Add PowerShell support (#2749) il y a 6 mois
shims-linked-from-elsewhere.bats Prevent infinite loop if a shim is linked and called from a nonstandard location with "system" active il y a 6 mois
shims.bats Import tests from rbenv with `sed -e s/rbenv/pyenv/g` il y a 12 ans
test_helper.bash rehash: streamline executables discovery; fix regression (#3418) il y a 4 mois
version-file-read.bats use BATS_FILE_TMPDIR in test/plugin test il y a 9 mois
version-file-write.bats use BATS_FILE_TMPDIR in test/plugin test il y a 9 mois
version-file.bats use BATS_FILE_TMPDIR in test/plugin test il y a 9 mois
version-name.bats use BATS_FILE_TMPDIR in test/plugin test il y a 9 mois
version-origin.bats use BATS_FILE_TMPDIR in test/plugin test il y a 9 mois
version.bats use BATS_FILE_TMPDIR in test/plugin test il y a 9 mois
versions.bats rehash: streamline executables discovery; fix regression (#3418) il y a 4 mois
whence.bats tests: refactor: rename and consolidate create_executable() functions il y a 6 mois
which.bats which: update `pyenv help global` tip (#3424) il y a 3 mois

README.md

TEST


Running test suite

Test suite could be launch with make by providing the right target depending what you want to achieve.

Under the hood, pyenv test suites use bats as a test framework and are run on the host or docker depending of the target provided to make.

Targets

  • test
    • Run the whole test suite on the local host
  • test-docker
    • Run the whole test suite on docker
      • Some volumes are used in read-only mode
  • test-unit
    • Run the unit test
  • test-plugin
    • Run the plugin test
  • test-unit-docker-[BASH_VERSION]
    • Run the unit test under official bash docker container (alpine/busybox) with the specified bash version if present is in the Makefile
    • Some volumes are used in read-only mode
  • test-unit-docker-gnu-[BASH_VERSION]
    • Run the unit test under official bash docker container (alpine/busybox), completed by GNU Tools, with the specified bash version if present is in the Makefile
    • Some volumes are used in read-only mode
  • test-plugin-docker-[BASH_VERSION]
    • Run the plugin test under official bash docker container (alpine/busybox), completed by GNU Tools, with the specified bash version if present is in the Makefile
    • Some volumes are used in read-only mode
  • test-plugin-docker-gnu-[BASH_VERSION]
    • Run the plugin test under official bash docker container (alpine/busybox), completed by GNU Tools, with the specified bash version if present is in the Makefile
    • Some volumes are used in read-only mode

Targeting specific test / test file

By setting some environment variables, it is possible to filtering which test and/or test file who will be tested with bats

  • BATS_FILE_FILTER

    • Run test only with the specified file
  • BATS_TEST_FILTER

    • Run test only who corresponding to the filter provided

Examples

    $ BATS_TEST_FILTER=".*installed.*" BATS_FILE_FILTER="build.bats" make test-plugin-docker-gnu-3.2.57
    build.bats
     ✓ yaml is installed for python
     ✓ homebrew is used in Linux if Pyenv is installed with Homebrew
     ✓ homebrew is not used in Linux if Pyenv is not installed with Homebrew
    
    3 tests, 0 failures
    
    $ BATS_TEST_FILTER=".*installed.*" BATS_FILE_FILTER="build.bats" make test-plugin
    build.bats
     ✓ yaml is installed for python
     ✓ homebrew is used in Linux if Pyenv is installed with Homebrew
     ✓ homebrew is not used in Linux if Pyenv is not installed with Homebrew
    
    3 tests, 0 failures

Writing test

To be reproducible, each test use/should use its own TMPDIR .
It's achieved by using the environment variable BATS_TEST_TMPDIR provided by bats that is automatically deleted at the end of each test. More info here

Another variable who could be used to source some file who need to be tested is BATS_TEST_DIRNAME who point to the directory in which the bats test file is located.