Merge pull request #130 from dotpyfe/feature/bats-testing

Minimal BATS / Travis-CI addition
pull/96/head^2
aristocratos 2020-06-01 20:05:10 +02:00 committed by GitHub
commit 987c798019
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 47 additions and 0 deletions

9
.gitmodules vendored Normal file
View File

@ -0,0 +1,9 @@
[submodule "test/libs/bats"]
path = test/libs/bats
url = https://github.com/sstephenson/bats
[submodule "test/libs/bats-assert"]
path = test/libs/bats-assert
url = https://github.com/ztombol/bats-assert
[submodule "test/libs/bats-support"]
path = test/libs/bats-support
url = https://github.com/ztombol/bats-support

9
.travis.yml Normal file
View File

@ -0,0 +1,9 @@
# travis does not offer python container for OSX or Windows, not sure if we can get automated testing?
os: linux
language: python
python:
- "3.6"
dist: bionic
install:
- pip install -r requirements.txt
script: ./test.sh

View File

@ -4822,6 +4822,10 @@ else
exec 2>/dev/null
fi
#* if we have been sourced by another shell, quit. Allows sourcing only function definition.
[[ "${#BASH_SOURCE[@]}" -gt 1 ]] && { return 0; }
#* Call init function
init_

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
psutil==5.7.0

3
test.sh Executable file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
./test/libs/bats/bin/bats test/*.bats

17
test/basic_test.bats Normal file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env bats
load 'libs/bats-support/load'
load 'libs/bats-assert/load'
load test_helper
@test "Sourcing works, by checking if \$system is set" {
run echo $system
refute_output ""
}
@test "#get_themes populates themes" {
get_themes
assert_success
assert [ ${#themes[@]} -gt 0 ]
}

1
test/libs/bats Submodule

@ -0,0 +1 @@
Subproject commit 03608115df2071fff4eaaff1605768c275e5f81f

1
test/libs/bats-assert Submodule

@ -0,0 +1 @@
Subproject commit 9f88b4207da750093baabc4e3f41bf68f0dd3630

@ -0,0 +1 @@
Subproject commit 004e707638eedd62e0481e8cdc9223ad471f12ee

1
test/test_helper.bash Normal file
View File

@ -0,0 +1 @@
source bashtop