mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-24 08:01:38 +00:00
26222539e6
* make resolver * more updates * fix build * fix raw_dependencies job type * compat with http agent workers * refactor * rename * more refactor * cleanup * more tests * fix s3 * small fixes * more fixing * fix endpoint * nit: update comment * update ee ref * update ee ref * update ee ref * implement safer `list_available_python_versions` * add tracing to get of authed client * internal: Trigger claude when commenting with /aider (#5783) * add claude instructions files * call claude too when using aider * fix * add draft for linear claude integration * fix build * update ee ref * ignore versions <=3.9 * fix windows build * correct versions filter * fix windows build (this time for real) * inject error to debug CI * update CI * undo debug of CI * fix tests * remove outdated comment * update ee repo ref * Update ee-repo-ref.txt * Update backend/parsers/windmill-parser-py-imports/src/lib.rs Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com> * Update InstanceSetting.svelte --------- Co-authored-by: Ruben Fiszel <ruben@windmill.dev> Co-authored-by: centdix <40307056+centdix@users.noreply.github.com> Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
94 lines
2.1 KiB
Rust
94 lines
2.1 KiB
Rust
mod tests {
|
|
|
|
use sqlx::{Pool, Postgres};
|
|
use windmill_parser_py_imports::parse_python_imports;
|
|
|
|
#[sqlx::test(fixtures("base"))]
|
|
async fn test_parse_python_imports(db: Pool<Postgres>) -> anyhow::Result<()> {
|
|
//let code = "print(2 + 3, fd=sys.stderr)";
|
|
let code = "
|
|
|
|
import os
|
|
import wmill
|
|
from zanzibar.estonie import talin
|
|
import matplotlib.pyplot as plt
|
|
from . import tests
|
|
|
|
def main():
|
|
pass
|
|
|
|
";
|
|
let (r, ..) =
|
|
parse_python_imports(code, "test-workspace", "f/foo/bar", &db, &mut vec![]).await?;
|
|
// println!("{}", serde_json::to_string(&r)?);
|
|
assert_eq!(
|
|
r,
|
|
vec![
|
|
"matplotlib # (mapped from matplotlib.pyplot)",
|
|
"wmill",
|
|
"zanzibar # (mapped from zanzibar.estonie)"
|
|
]
|
|
);
|
|
|
|
Ok(())
|
|
}
|
|
|
|
#[sqlx::test(fixtures("base"))]
|
|
async fn test_parse_python_imports2(db: Pool<Postgres>) -> anyhow::Result<()> {
|
|
//let code = "print(2 + 3, fd=sys.stderr)";
|
|
let code = "
|
|
#requirements:
|
|
#burkina=0.4
|
|
#nigeria
|
|
#
|
|
#congo
|
|
|
|
import os
|
|
import wmill
|
|
from zanzibar.estonie import talin
|
|
|
|
def main():
|
|
pass
|
|
|
|
";
|
|
let (r, ..) =
|
|
parse_python_imports(code, "test-workspace", "f/foo/bar", &db, &mut vec![]).await?;
|
|
println!("{}", serde_json::to_string(&r)?);
|
|
assert_eq!(r, vec!["burkina=0.4", "nigeria"]);
|
|
|
|
Ok(())
|
|
}
|
|
|
|
#[sqlx::test(fixtures("base"))]
|
|
async fn test_parse_python_imports_local(db: Pool<Postgres>) -> anyhow::Result<()> {
|
|
//let code = "print(2 + 3, fd=sys.stderr)";
|
|
let code = "
|
|
from f.foo.bar import main1
|
|
from .baz import main2
|
|
from ..foo.bar import main3
|
|
import f.foo.bar as bar
|
|
from ..foobar.baz import main4
|
|
|
|
def main():
|
|
pass
|
|
|
|
";
|
|
|
|
let (r, ..) =
|
|
parse_python_imports(code, "test-workspace", "f/foo/bar", &db, &mut vec![]).await?;
|
|
println!("{}", serde_json::to_string(&r)?);
|
|
assert_eq!(
|
|
r,
|
|
[
|
|
"difffolder",
|
|
"innerdifffolder",
|
|
"numpy",
|
|
"pandas",
|
|
"pandas2",
|
|
]
|
|
);
|
|
|
|
Ok(())
|
|
}
|
|
}
|