File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,7 +143,16 @@ async def normalize_lang_pref(pref: str | None) -> str:
143143
144144def _resolve_system_language_sync () -> str :
145145 try :
146- loc = locale .getdefaultlocale ()[0 ] or ""
146+ # Python 3.15+: avoid deprecated locale.getdefaultlocale().
147+ loc = (locale .getlocale ()[0 ] or "" ).strip ()
148+ if not loc :
149+ # Fallback env-based locale resolution for non-initialized locale contexts.
150+ loc = (
151+ os .environ .get ("LC_ALL" )
152+ or os .environ .get ("LC_MESSAGES" )
153+ or os .environ .get ("LANG" )
154+ or ""
155+ ).strip ()
147156 return "fr" if loc .lower ().startswith (("fr" , "fr_" )) else "en"
148157 except Exception :
149158 return "en"
Original file line number Diff line number Diff line change 2929
3030@pytest .fixture ()
3131def test_workspace (tmp_path : Path ) -> Path :
32- """Return a temporary copy of tests/workspace_for_test for file operations."""
32+ """Return a temporary workspace for file-operation tests.
33+
34+ The fixture prefers copying `tests/workspace_for_test` when available.
35+ If that template folder is missing, it creates a minimal workspace in
36+ `tmp_path` so tests remain hermetic and portable.
37+ """
3338 src = Path (__file__ ).parent / "workspace_for_test"
3439 dest = tmp_path / "workspace"
35- shutil .copytree (src , dest )
40+ if src .exists ():
41+ shutil .copytree (src , dest )
42+ return dest
43+
44+ dest .mkdir (parents = True , exist_ok = True )
45+ (dest / "main.py" ).write_text ("print('hello from test workspace')\n " , encoding = "utf-8" )
46+ (dest / "requirements.txt" ).write_text ("requests\n " , encoding = "utf-8" )
47+ (dest / ".ark" ).mkdir (parents = True , exist_ok = True )
3648 return dest
You can’t perform that action at this time.
0 commit comments