Skip to content

Commit

Permalink
fix-test
Browse files Browse the repository at this point in the history
  • Loading branch information
asvetlov committed May 20, 2020
1 parent 99220c5 commit b2cfa14
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 26 deletions.
2 changes: 1 addition & 1 deletion neuromation/cli/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@

from neuromation.api import (
AuthorizationError,
IllegalArgumentError,
Client,
Container,
HTTPPort,
IllegalArgumentError,
JobDescription,
JobRestartPolicy,
JobStatus,
Expand Down
46 changes: 21 additions & 25 deletions tests/e2e/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,17 +405,7 @@ async def _check_job_output() -> AsyncIterator[bytes]:
f"Output of job {job_id} does not satisfy to expected regexp: {expected}"
)

def run_cli(
self,
arguments: List[str],
*,
verbosity: int = 0,
network_timeout: float = NETWORK_TIMEOUT,
) -> SysCap:
__tracebackhide__ = True

log.info("Run 'neuro %s'", " ".join(arguments))

def _default_args(self, verbosity: int, network_timeout: float) -> List[str]:
args = [
"neuro",
"--show-traceback",
Expand All @@ -433,9 +423,22 @@ def run_cli(
if self._nmrc_path:
args.append(f"--neuromation-config={self._nmrc_path}")

return args

def run_cli(
self,
arguments: List[str],
*,
verbosity: int = 0,
network_timeout: float = NETWORK_TIMEOUT,
) -> SysCap:
__tracebackhide__ = True

log.info("Run 'neuro %s'", " ".join(arguments))

# 5 min timeout is overkill
proc = subprocess.run(
args + arguments,
self._default_args(verbosity, network_timeout) + arguments,
timeout=300,
encoding="utf8",
stdout=subprocess.PIPE,
Expand Down Expand Up @@ -464,24 +467,17 @@ def run_cli(
return SysCap(out, err)

def autocomplete(
self, arguments: List[str], *, network_timeout: float = NETWORK_TIMEOUT,
self,
arguments: List[str],
*,
verbosity: int = 0,
network_timeout: float = NETWORK_TIMEOUT,
) -> str:
__tracebackhide__ = True

log.info("Run 'neuro %s'", " ".join(arguments))

args = [
"neuro",
"--show-traceback",
"--disable-pypi-version-check",
"--color=no",
f"--network-timeout={network_timeout}",
"--skip-stats",
]

if self._nmrc_path:
args.append(f"--neuromation-config={self._nmrc_path}")

args = self._default_args(verbosity, network_timeout)
env = dict(os.environ)
env["_NEURO_COMPLETE"] = "complete_zsh"
env["COMP_WORDS"] = " ".join(shlex.quote(arg) for arg in args + arguments)
Expand Down

0 comments on commit b2cfa14

Please sign in to comment.