mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-02 13:00:23 +00:00
python312Packages.kaleido: Add passthru.tests
(cherry picked from commit 46c1ce890a)
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
stdenv,
|
||||
python,
|
||||
buildPythonPackage,
|
||||
callPackage,
|
||||
fetchurl,
|
||||
autoPatchelfHook,
|
||||
bash,
|
||||
@@ -96,6 +97,8 @@ buildPythonPackage rec {
|
||||
#ln -s ${lato}/share/fonts/lato/* $out/${python.sitePackages}/kaleido/executable/xdg/fonts/truetype/lato/
|
||||
'';
|
||||
|
||||
passthru.tests.kaleido = callPackage ./tests.nix { };
|
||||
|
||||
meta = {
|
||||
description = "Fast static image export for web-based visualization libraries with zero dependencies";
|
||||
homepage = "https://github.com/plotly/Kaleido";
|
||||
|
||||
15
pkgs/development/python-modules/kaleido/tests.nix
Normal file
15
pkgs/development/python-modules/kaleido/tests.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
runCommand,
|
||||
python,
|
||||
plotly,
|
||||
pandas,
|
||||
kaleido,
|
||||
}:
|
||||
|
||||
runCommand "${kaleido.pname}-tests" {
|
||||
nativeBuildInputs = [
|
||||
python
|
||||
plotly
|
||||
pandas
|
||||
];
|
||||
} "python3 ${./tests.py}"
|
||||
11
pkgs/development/python-modules/kaleido/tests.py
Normal file
11
pkgs/development/python-modules/kaleido/tests.py
Normal file
@@ -0,0 +1,11 @@
|
||||
import plotly.express as px
|
||||
import os
|
||||
import os.path
|
||||
|
||||
out = os.environ["out"]
|
||||
if not os.path.exists(out):
|
||||
os.makedirs(out)
|
||||
|
||||
outfile = os.path.join(out, "figure.png")
|
||||
fig = px.scatter(px.data.iris(), x="sepal_length", y="sepal_width", color="species")
|
||||
fig.write_image(outfile, engine="kaleido")
|
||||
Reference in New Issue
Block a user