kopia lustrzana https://github.com/jupyterhub/repo2docker
improve failure message
rodzic
f86fa39fc3
commit
e10c3eafb7
|
@ -9,6 +9,7 @@ success.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import pipes
|
||||||
import shlex
|
import shlex
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -36,13 +37,22 @@ def make_test_func(args):
|
||||||
class Repo2DockerTest(pytest.Function):
|
class Repo2DockerTest(pytest.Function):
|
||||||
"""A pytest.Item for running repo2docker"""
|
"""A pytest.Item for running repo2docker"""
|
||||||
def __init__(self, name, parent, args):
|
def __init__(self, name, parent, args):
|
||||||
|
self.args = args
|
||||||
|
self.save_cwd = os.getcwd()
|
||||||
f = parent.obj = make_test_func(args)
|
f = parent.obj = make_test_func(args)
|
||||||
super().__init__(name, parent, callobj=f)
|
super().__init__(name, parent, callobj=f)
|
||||||
self.save_cwd = os.getcwd()
|
|
||||||
|
|
||||||
def reportinfo(self):
|
def reportinfo(self):
|
||||||
return self.parent.fspath, None, ""
|
return self.parent.fspath, None, ""
|
||||||
|
|
||||||
|
def repr_failure(self, excinfo):
|
||||||
|
err = excinfo.value
|
||||||
|
if isinstance(err, SystemExit):
|
||||||
|
cmd = "jupyter-repo2docker %s" % ' '.join(map(pipes.quote, self.args))
|
||||||
|
return "%s | exited with status=%s" % (cmd, err.code)
|
||||||
|
else:
|
||||||
|
return super().repr_failure(excinfo)
|
||||||
|
|
||||||
def teardown(self):
|
def teardown(self):
|
||||||
super().teardown()
|
super().teardown()
|
||||||
os.chdir(self.save_cwd)
|
os.chdir(self.save_cwd)
|
||||||
|
|
Ładowanie…
Reference in New Issue