darabos commited on
Commit
a403b5f
·
1 Parent(s): 238f891

Disable user scripts in test.

Browse files
lynxkite-app/tests/test_main.py CHANGED
@@ -2,9 +2,11 @@ import pathlib
2
  import uuid
3
  from fastapi.testclient import TestClient
4
  from lynxkite_app.main import app, detect_plugins
 
5
  import os
6
 
7
 
 
8
  client = TestClient(app)
9
 
10
 
 
2
  import uuid
3
  from fastapi.testclient import TestClient
4
  from lynxkite_app.main import app, detect_plugins
5
+ from lynxkite.core import ops
6
  import os
7
 
8
 
9
+ ops.user_script_root = None
10
  client = TestClient(app)
11
 
12
 
lynxkite-core/src/lynxkite/core/ops.py CHANGED
@@ -412,13 +412,18 @@ def load_catalogs(snapshot_name: str):
412
  CATALOGS = {k: dict(v) for k, v in snap.items()}
413
 
414
 
 
 
 
 
415
  def load_user_scripts(workspace: str):
416
  """Reloads the *.py in the workspace's directory and higher-level directories."""
417
  if "plugins loaded" in CATALOGS_SNAPSHOTS:
418
  load_catalogs("plugins loaded")
419
- cwd = pathlib.Path()
420
- path = cwd / workspace
421
- assert path.is_relative_to(cwd), f"Path '{path}' is invalid"
 
422
  for p in path.parents:
423
  req = p / "requirements.txt"
424
  if req.exists():
@@ -431,7 +436,7 @@ def load_user_scripts(workspace: str):
431
  run_user_script(f)
432
  except Exception:
433
  traceback.print_exc()
434
- if p == cwd:
435
  break
436
 
437
 
 
412
  CATALOGS = {k: dict(v) for k, v in snap.items()}
413
 
414
 
415
+ # Generally the same as the data directory, but it can be overridden.
416
+ user_script_root = pathlib.Path()
417
+
418
+
419
  def load_user_scripts(workspace: str):
420
  """Reloads the *.py in the workspace's directory and higher-level directories."""
421
  if "plugins loaded" in CATALOGS_SNAPSHOTS:
422
  load_catalogs("plugins loaded")
423
+ if not user_script_root:
424
+ return
425
+ path = user_script_root / workspace
426
+ assert path.is_relative_to(user_script_root), f"Path '{path}' is invalid"
427
  for p in path.parents:
428
  req = p / "requirements.txt"
429
  if req.exists():
 
436
  run_user_script(f)
437
  except Exception:
438
  traceback.print_exc()
439
+ if p == user_script_root:
440
  break
441
 
442