test: integration test for whl url - nlp task with specific model

This commit is contained in:
pegasust 2023-08-29 21:22:59 -07:00 committed by Phillip Cloud
parent 59acbb08ec
commit 583d2bfe34
No known key found for this signature in database
GPG key ID: D908212070FD785E
5 changed files with 1585 additions and 0 deletions

View file

@ -66,6 +66,7 @@ in
mysqlclient = callTest ./mysqlclient { }; mysqlclient = callTest ./mysqlclient { };
jq = callTest ./jq { }; jq = callTest ./jq { };
ubersmith = callTest ./ubersmith { }; ubersmith = callTest ./ubersmith { };
use-url-wheel = callTest ./use-url-wheel { };
returns = callTest ./returns { }; returns = callTest ./returns { };
option = callTest ./option { }; option = callTest ./option { };
fastapi-utils = callTest ./fastapi-utils { }; fastapi-utils = callTest ./fastapi-utils { };

View 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

File diff suppressed because it is too large Load diff

View 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"

View file

@ -0,0 +1,6 @@
import de_dep_news_trf
def main():
nlp = de_dep_news_trf.load()
print(nlp("Dies ist ein Testsatz."))