mirror of
https://github.com/vale981/poetry2nix
synced 2025-03-06 09:41:39 -05:00
test: integration test for whl url - nlp task with specific model
This commit is contained in:
parent
59acbb08ec
commit
583d2bfe34
5 changed files with 1585 additions and 0 deletions
|
@ -66,6 +66,7 @@ in
|
|||
mysqlclient = callTest ./mysqlclient { };
|
||||
jq = callTest ./jq { };
|
||||
ubersmith = callTest ./ubersmith { };
|
||||
use-url-wheel = callTest ./use-url-wheel { };
|
||||
returns = callTest ./returns { };
|
||||
option = callTest ./option { };
|
||||
fastapi-utils = callTest ./fastapi-utils { };
|
||||
|
|
26
tests/use-url-wheel/default.nix
Normal file
26
tests/use-url-wheel/default.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
lib,
|
||||
poetry2nix,
|
||||
python3,
|
||||
runCommand,
|
||||
}: let
|
||||
args = {
|
||||
python = python3;
|
||||
projectDir = ./.;
|
||||
preferWheels = true;
|
||||
};
|
||||
py = poetry2nix.mkPoetryPackages args;
|
||||
app = poetry2nix.mkPoetryApplication args;
|
||||
url_nix_store = py.python.pkgs.de-dep-news-trf.src;
|
||||
url_is_wheel = url_nix_store.isWheel or false;
|
||||
output =
|
||||
runCommand "app_eval"
|
||||
{} ''
|
||||
"${app}/bin/test" >$out
|
||||
'';
|
||||
in
|
||||
# HACK: This doesn't get recognized as isWheel, it's a string pointing to nix-store
|
||||
assert !url_is_wheel;
|
||||
assert lib.strings.hasSuffix "whl" url_nix_store;
|
||||
assert (builtins.readFile output) == "Dies ist ein Testsatz.\n";
|
||||
app
|
1527
tests/use-url-wheel/poetry.lock
generated
Normal file
1527
tests/use-url-wheel/poetry.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
25
tests/use-url-wheel/pyproject.toml
Normal file
25
tests/use-url-wheel/pyproject.toml
Normal file
|
@ -0,0 +1,25 @@
|
|||
[tool.poetry]
|
||||
name = "use-url-wheel"
|
||||
version = "0.1.0"
|
||||
description = "asserts that .whl via .url works"
|
||||
authors = [
|
||||
"pegasust <pegasucksgg@gmail.com>",
|
||||
"joopitz <jonas.opitz@live.de>"
|
||||
]
|
||||
license = "MIT"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.10"
|
||||
de-dep-news-trf = {url = "https://github.com/explosion/spacy-models/releases/download/de_dep_news_trf-3.6.1/de_dep_news_trf-3.6.1-py3-none-any.whl"}
|
||||
torch = "1.13.1"
|
||||
|
||||
[tool.poetry.scripts]
|
||||
test = "whl_test.main:main"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
|
||||
[[tool.poetry.packages]]
|
||||
include = "whl_test"
|
||||
|
6
tests/use-url-wheel/whl_test/main.py
Normal file
6
tests/use-url-wheel/whl_test/main.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
import de_dep_news_trf
|
||||
|
||||
|
||||
def main():
|
||||
nlp = de_dep_news_trf.load()
|
||||
print(nlp("Dies ist ein Testsatz."))
|
Loading…
Add table
Reference in a new issue