mirror of
https://github.com/vale981/poetry2nix
synced 2025-03-05 09:11:39 -05:00
Add test case for editable mkPoetryEnv
This commit is contained in:
parent
df7afa36e3
commit
eb940dc9a3
5 changed files with 45 additions and 0 deletions
|
@ -36,6 +36,7 @@ builtins.removeAttrs
|
|||
canonical-module-names = callTest ./canonical-module-names { };
|
||||
wandb = callTest ./wandb { };
|
||||
dependency-environment = callTest ./dependency-environment { };
|
||||
editable = callTest ./editable { };
|
||||
|
||||
# Test building poetry
|
||||
inherit poetry;
|
||||
|
|
24
tests/editable/default.nix
Normal file
24
tests/editable/default.nix
Normal file
|
@ -0,0 +1,24 @@
|
|||
{ lib, poetry2nix, python3, runCommand }:
|
||||
let
|
||||
env = poetry2nix.mkPoetryEnv {
|
||||
python = python3;
|
||||
pyproject = ./pyproject.toml;
|
||||
poetrylock = ./poetry.lock;
|
||||
|
||||
editablePackageSources = {
|
||||
# Usually this would be trivial = ./src
|
||||
# But we use this here to be able to test it
|
||||
# in a derivation build
|
||||
trivial = "/build/src";
|
||||
};
|
||||
};
|
||||
in
|
||||
runCommand "env-test" { } ''
|
||||
cp -r --no-preserve=mode ${./src} src
|
||||
echo 'print("Changed")' > src/trivial/__main__.py
|
||||
if [[ $(${env}/bin/python -m trivial) != "Changed" ]]; then
|
||||
echo "Package wasn't editable!"
|
||||
exit 1
|
||||
fi
|
||||
touch $out
|
||||
'' // { inherit env; }
|
7
tests/editable/poetry.lock
generated
Normal file
7
tests/editable/poetry.lock
generated
Normal file
|
@ -0,0 +1,7 @@
|
|||
package = []
|
||||
|
||||
[metadata]
|
||||
content-hash = "115cf985d932e9bf5f540555bbdd75decbb62cac81e399375fc19f6277f8c1d8"
|
||||
python-versions = "*"
|
||||
|
||||
[metadata.files]
|
12
tests/editable/pyproject.toml
Normal file
12
tests/editable/pyproject.toml
Normal file
|
@ -0,0 +1,12 @@
|
|||
[tool.poetry]
|
||||
name = "trivial"
|
||||
version = "0.1.0"
|
||||
description = "poetry2nix test"
|
||||
authors = ["Your Name <you@example.com>"]
|
||||
packages = [
|
||||
{ include = "trivial", from = "src" },
|
||||
]
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry>=0.12"]
|
||||
build-backend = "poetry.masonry.api"
|
1
tests/editable/src/trivial/__main__.py
Normal file
1
tests/editable/src/trivial/__main__.py
Normal file
|
@ -0,0 +1 @@
|
|||
print("Original")
|
Loading…
Add table
Reference in a new issue