Skip to content

Commit

Permalink
bumblebee-status: enable tests
Browse files Browse the repository at this point in the history
FIXME: This commit enables tests by by adding the `bumblebee-status`
derivation that has been submitted to `nixpkgs` (<NixOS/nixpkgs#254772>).
Hence this commit should be pruned at least when `bumblebee-status` is merged into `nixpkgs-unstable`.
  • Loading branch information
augustebaum committed Sep 18, 2023
1 parent 3c1e30f commit 98ba77a
Show file tree
Hide file tree
Showing 3 changed files with 449 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/modules/programs/bumblebee-status/bumblebee-status.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,17 @@

test.stubs.bumblebee-status = { };

# FIXME: This and the ./bumblebee-status directory should be removed when bumblebee-status is merged into nixpkgs
nixpkgs.overlays = [
(final: prev: {
bumblebee-status = pkgs.callPackage ./bumblebee-status { };
bumblebee-status-full = let
allPlugins = pkgs.callPackage ./bumblebee-status/plugins.nix { };
allPluginNames = map (p: p.name) allPlugins;
in pkgs.callPackage ./bumblebee-status { withPlugins = allPluginNames; };
})
];

nmt.script = ''
assertFileExists home-files/.config/bumblebee-status/config
assertFileContent home-files/.config/bumblebee-status/config ${
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{ pkgs, lib, python3, python3Packages, fetchFromGitHub, withPlugins ? null, ...
}:
python3Packages.buildPythonPackage rec {
pname = "bumblebee-status";
version = "2.1.6";

src = fetchFromGitHub {
owner = "tobi-wan-kenobi";
repo = pname;
rev = "v${version}";
hash = "sha256-Oo7n3NyUxBedQHG5P7TM9nuI2hwnVN1SJcK9OP3yiyE=";
};

propagatedBuildInputs = let
allPlugins = import ./plugins.nix { inherit pkgs python3Packages; };

isSelected = plugin: builtins.elem plugin.name withPlugins;

selectedPlugins = lib.filter isSelected allPlugins;

pluginPropagatedBuildInputs =
lib.attrsets.catAttrs "requires" selectedPlugins;
in lib.lists.unique pluginPropagatedBuildInputs;

checkInputs = with python3Packages; [
freezegun
netifaces
psutil
pytest
pytest-mock
];

checkPhase = ''
runHook preCheck
# Fixes `locale.Error: unsupported locale setting` in some tests.
export LOCALE_ARCHIVE="${pkgs.glibcLocales}/lib/locale/locale-archive";
# FIXME: We skip the `dunst` module tests, some of which fail with
# `RuntimeError: killall -s SIGUSR2 dunst not found`.
# This is not solved by adding `pkgs.killall` to `checkInputs`.
${python3.interpreter} -m pytest -k 'not test_dunst.py'
runHook postCheck
'';

postInstall = ''
# Remove binary cache files
find $out -name "__pycache__" -type d | xargs rm -rv
# Make themes available for bumblebee-status to detect them
cp -r ./themes $out/${python3.sitePackages}
'';

meta = with lib; {
description =
"bumblebee-status is a modular, theme-able status line generator for the i3 window manager.";
homepage = "https://bumblebee-status.readthedocs.io/";
license = licenses.mit;
platforms = platforms.linux;
maintainers = with maintainers; [ augustebaum ];
};
}
Loading

0 comments on commit 98ba77a

Please sign in to comment.