mirror of
https://github.com/NicolasBohn/NexQuant.git
synced 2026-07-27 23:47:46 +00:00
@@ -445,9 +445,10 @@ class LocalEnv(Env[ASpecificLocalConf]):
|
||||
Console().print(output.strip(), markup=False)
|
||||
combined_output += output
|
||||
elif fd == stderr_fd:
|
||||
error = process.stderr.readline()
|
||||
if error:
|
||||
Console().print(error.strip(), markup=False)
|
||||
chunk = os.read(stderr_fd, 4096)
|
||||
if chunk:
|
||||
error = chunk.decode(errors="replace")
|
||||
Console().print(error, end="", markup=False)
|
||||
combined_output += error
|
||||
|
||||
# Capture any final output
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
||||
@@ -69,6 +70,17 @@ class EnvUtils(unittest.TestCase):
|
||||
res, code = le.run_ret_code(local_path=str(code_path))
|
||||
print(res, code)
|
||||
|
||||
def test_conda_error(self):
|
||||
conda_conf = CondaConf(conda_env_name="MLE")
|
||||
le = LocalEnv(conf=conda_conf)
|
||||
le.prepare()
|
||||
file_name = f"{time.time()}.py"
|
||||
with open(self.test_workspace / file_name, "w") as f:
|
||||
f.write('import json \njson.loads(b\'{"name": "\xa1"}\')')
|
||||
res, code = le.run_ret_code(local_path=str(self.test_workspace), entry=f"python {file_name}")
|
||||
assert code == 1
|
||||
assert "bytes can only contain ASCII literal characters" in res
|
||||
|
||||
def test_docker(self):
|
||||
"""We will mount `env_tpl` into the docker image.
|
||||
And run the docker image with `qrun conf.yaml`
|
||||
|
||||
Reference in New Issue
Block a user