CI / test (push) Canceled after 0s
## Summary epic r04 - begin refactor ## Change Type - [x] Cowork feature - [ ] Bug fix - [ ] Core AI contribution - [ ] Test / hardening - [ ] Performance - [ ] Documentation ## Related Work Cowork Task: Core Repo: http://34.143.229.138/gitea-admin/fsg-ai-core-assets Core AI Issue: Core Task: Related PR: ## Scope What is intentionally included? What is intentionally NOT included? ## Validation - [ ] Unit tests - [ ] Integration tests - [ ] Manual verification - [ ] Regression check Commands / evidence: ## Security Impact Permission / credential / network / customer data impact: ## Compatibility - [ ] No breaking change - [ ] Breaking change documented ## Reviewer Notes Anything Cowork reviewers should pay attention to. --------- Co-authored-by: Anh Tran Nguyen Minh <anhtnm1@fpt.com> Co-authored-by: Huong Le Thi Thien <huongltt35@fpt.com> Co-authored-by: Nam Pham Dinh Thanh <nampdt@fpt.com> Co-authored-by: Vu Dam Tuan <vudt15@fpt.com> Co-authored-by: Hiep Ha Van <hiephv3@fpt.com> Co-authored-by: Lam Hoang Van <lamhv7@fpt.com> Reviewed-on: #7 Co-authored-by: Duy Le Huu <duylh19@fpt.com>
33 lines
1.4 KiB
Python
33 lines
1.4 KiB
Python
"""Root pytest conftest — loaded before ``tests/conftest.py``.
|
|
|
|
This checkout lives on disk as ``Refactor`` (not ``cowork_local``), while
|
|
``tests/`` imports everything as ``from cowork_local... import ...`` and
|
|
``tests/conftest.py`` makes that resolve by putting this repo's *parent*
|
|
directory on ``sys.path`` (expecting the repo root itself to be named
|
|
``cowork_local``). A sibling folder literally named ``cowork_local`` (an
|
|
unrelated, older checkout) already exists next to this one, so without this
|
|
file Python would silently import THAT folder instead of this repository
|
|
whenever a test does ``import cowork_local``.
|
|
|
|
Registering the alias here — before ``tests/conftest.py`` touches
|
|
``sys.path`` — caches this repository in ``sys.modules['cowork_local']``
|
|
first, so the later ``sys.path`` mutation has nothing left to do (imports
|
|
are cached by name; the first successful import of a given name wins for
|
|
the rest of the process).
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import importlib.util
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
_ROOT = Path(__file__).resolve().parent
|
|
|
|
if "cowork_local" not in sys.modules:
|
|
spec = importlib.util.spec_from_file_location(
|
|
"cowork_local", _ROOT / "__init__.py", submodule_search_locations=[str(_ROOT)],
|
|
)
|
|
module = importlib.util.module_from_spec(spec)
|
|
sys.modules["cowork_local"] = module
|
|
spec.loader.exec_module(module)
|