未验证 提交 42ddac8c 编写于 作者: C Cleber Rosa

Merge remote-tracking branch 'apahim/fix_golang_loader'

Signed-off-by: NCleber Rosa <crosa@redhat.com>
......@@ -93,6 +93,9 @@ class GolangLoader(loader.TestLoader):
super(GolangLoader, self).__init__(args, extra_params)
def discover(self, url, which_tests=loader.DEFAULT):
if _GO_BIN is None:
return self._no_tests(which_tests, url, 'Go binary not found.')
if url is None:
return []
......@@ -119,7 +122,9 @@ class GolangLoader(loader.TestLoader):
avocado_suite.append((GolangTest, {'name': test_name,
'subtest': subtest}))
return avocado_suite or self._no_tests(which_tests, url)
return avocado_suite or self._no_tests(which_tests, url,
'No test matching this '
'reference.')
# When a directory is provided
if os.path.isdir(url):
......@@ -131,7 +136,9 @@ class GolangLoader(loader.TestLoader):
avocado_suite.append((GolangTest, {'name': test_name,
'subtest': subtest}))
return avocado_suite or self._no_tests(which_tests, url)
return avocado_suite or self._no_tests(which_tests, url,
'No test matching this '
'reference.')
# When a package is provided
go_root = os.environ.get('GOROOT')
......@@ -168,12 +175,13 @@ class GolangLoader(loader.TestLoader):
{'name': test_name,
'subtest': subtest}))
return avocado_suite or self._no_tests(which_tests, url)
return avocado_suite or self._no_tests(which_tests, url,
'No test matching this '
'reference.')
@staticmethod
def _no_tests(which_tests, url):
def _no_tests(which_tests, url, msg):
if which_tests == loader.ALL:
msg = ('No test matching this reference.')
return [(NotGolangTest, {"name": "%s: %s" % (url, msg)})]
return []
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册