tests: add cleanup logic for changed nix-channels

This commit is contained in:
Tobias Happ 2021-12-12 17:19:11 +01:00
parent 5b1305ffa8
commit ccbb8db229
2 changed files with 14 additions and 1 deletions

View file

@ -2,7 +2,15 @@
load lib
setup() {
_setup
cp ~/.nix-channels ~/.nix-channels.bak
}
teardown() {
nix-channel --remove home-manager
mv ~/.nix-channels.bak ~/.nix-channels
rm -f ~/.config/example
}

View file

@ -1,6 +1,7 @@
# Copyright (c) 2019-2021, see AUTHORS. Licensed under MIT License, see LICENSE.
setup() {
# call _setup when defining a setup function in your test
_setup() {
if [[ -z "$ON_DEVICE_TESTS_SETUP" ]]; then
CHANNEL_DIR="$(nix-instantiate --eval --expr '<nix-on-droid>')"
ON_DEVICE_TESTS_DIR="$CHANNEL_DIR/tests/on-device"
@ -33,6 +34,10 @@ setup() {
switch_to_default_config
}
setup() {
_setup
}
assert_command() {
for cmd_name; do
command -v "$cmd_name"