diff --git a/tests/on-device/config-h-m.bats b/tests/on-device/config-h-m.bats index 2380a0e..c7a065a 100644 --- a/tests/on-device/config-h-m.bats +++ b/tests/on-device/config-h-m.bats @@ -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 } diff --git a/tests/on-device/lib.bash b/tests/on-device/lib.bash index ac06f8e..fa72be1 100644 --- a/tests/on-device/lib.bash +++ b/tests/on-device/lib.bash @@ -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 '')" 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"