1
0
Fork 0
mirror of synced 2024-06-23 09:21:09 -04:00
dotbot/test
Eric Engstrom 6c044208fa
feat: Add prefix: 'string' option to linking when glob: true.
Allows one to store files in a directory or git-repo without the leading 
`.`, as in:

```
dotconf:
├── README.md
├── bin
│   ├── dotbot
│   ├── look
│   ├── pbfile
│   └── ...
├── dot
│   ├── bashrc
│   ├── gitconfig
│   ├── gitignore
│   ├── gorc
│   ├── login
│   ├── ...
│   ├── zshrc
│   └── zshenv
```

Can take a many-line dotbot.yml listing **each** file in `dotconf/dot`,
reducing it to five lines:

```
- link:
    ~/:
      path: dotconf/dot/*
      glob: true
      prefix: '.'
```

FIXES: #259
2021-05-27 12:07:17 -05:00
..
tests feat: Add prefix: 'string' option to linking when glob: true. 2021-05-27 12:07:17 -05:00
.editorconfig Add tests for more Python versions 2017-03-06 15:20:27 -05:00
.gitignore Support both [] and ? glob patterns 2021-04-15 23:28:19 -05:00
driver-lib.bash Add --debug flag to test driver 2021-02-25 08:14:34 -05:00
README.md Add --debug flag to test driver 2021-02-25 08:14:34 -05:00
test Add --debug flag to test driver 2021-02-25 08:14:34 -05:00
test-lib.bash Add --debug flag to test driver 2021-02-25 08:14:34 -05:00
Vagrantfile Fix interaction between --only and defaults 2020-11-22 16:58:00 -05:00

Testing

Dotbot testing code uses Vagrant to run all tests inside a virtual machine to have tests be completely isolated from the host machine.

Installing the Test environnement

Debian-based distributions

  • Install the test requirements
sudo apt install vagrant virtualbox
  • Install Dotbot dependencies
git submodule update --init --recursive

macOS

git submodule update --init --recursive

Running the Tests

Before running the tests, you must SSH into the VM. Start it with vagrant up and SSH in with vagrant ssh. All following commands must be run inside the VM.

First, you must install a version of Python to test against, using pyenv install -s {version}. You can choose any version you like, e.g. 3.8.1. It isn't particularly important to test against all supported versions of Python in the VM, because they will be tested by CI. Once you've installed a specific version of Python, activate it with pyenv global {version}.

The VM mounts the Dotbot directory in /dotbot as read-only (you can make edits on your host machine). You can run the test suite by cd /dotbot/test and then running ./test. Selected tests can be run by passing paths to the tests as arguments, e.g. ./test tests/create.bash tests/defaults.bash.

To debug tests, you can run the test driver with the --debug (or -d short form) flag, e.g. ./test --debug tests/link-if.bash. This will enable printing stdout/stderr.

When finished with testing, it is good to shut down the virtual machine by running vagrant halt.