-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Traceback for malformed test metadata #1881
Comments
The root cause is if we call $ python3 -m pdb ~/.virtualenvs/tmt/bin/tmt run -avvv provision -h local
...<snip>...
(Pdb) b tmt/base.py:754
Breakpoint 1 at /home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/tmt/base.py:754
(Pdb) b tmt/utils.py:320
Breakpoint 2 at /home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/tmt/utils.py:320
...<snip>..........................
(Pdb) c
/var/tmp/tmt/run-001
Found 1 plan.
/plans/foo
summary: Basic smoke test
discover
how: fmf
order: 50
directory: /home/huanli/dev/1881/foo
warn: /tests/foo:test - False is not of type 'string'
> /home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/tmt/base.py(754)_normalize_test()
-> return ShellScript(value)
(Pdb) l
749 # TODO: mandatory schema validation would remove the need for Optional...
750 # `test` is mandatory, must exist, so how to initialize if it's missing :(
751 if value is None:
752 return ShellScript('')
753
754 B-> return ShellScript(value)
755
756 def _normalize_require(
757 self,
758 value: Optional[_RawRequire],
759 logger: tmt.log.Logger) -> List[Require]:
(Pdb) p type(value)
<class 'bool'>
(Pdb) c
> /home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/tmt/utils.py(320)__init__()
-> self._script = textwrap.dedent(script)
(Pdb) p script
False To fix it, we should make sure |
With the patches from PR #1869, traceback looks like: $ cat main.fmf
summary: Concise summary describing what the test does
test: false
framework: beakerlib
$ tmt run -avvv provision -h local
/var/tmp/tmt/run-044
Found 1 plan.
/plans/default
discover
how: fmf
order: 50
directory: /home/huanli/dev/1881/foo
warn: /tests/foo:test - False is not of type 'string'
finish
Prune '/plans/default' plan workdir '/var/tmp/tmt/run-044/plans/default'.
summary: 0 tasks completed
Traceback (most recent call last):
File "/home/huanli/.virtualenvs/tmt/bin/tmt", line 14, in <module>
tmt.cli.main()
File "/home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/click/core.py", line 1689, in invoke
return _process_result(rv)
File "/home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/click/core.py", line 1626, in _process_result
value = ctx.invoke(self._result_callback, value, **ctx.params)
File "/home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/tmt/cli.py", line 360, in finito
click_context.obj.run.go()
File "/home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/tmt/base.py", line 3003, in go
plan.go()
File "/home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/tmt/base.py", line 1934, in go
step.go()
File "/home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/tmt/steps/discover/__init__.py", line 286, in go
phase.go()
File "/home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/tmt/steps/discover/fmf.py", line 526, in go
self._tests = tree.tests(
File "/home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/tmt/base.py", line 2468, in tests
selected_tests = [
File "/home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/tmt/base.py", line 2469, in <listcomp>
Test(
File "/home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/tmt/base.py", line 1034, in __init__
super().__init__(
File "/home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/tmt/base.py", line 610, in __init__
super().__init__(node=node, logger=logger, parent=parent, name=node.name, **kwargs)
File "/home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/tmt/utils.py", line 4233, in __init__
super().__init__(node=node, logger=logger, **kwargs)
File "/home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/tmt/utils.py", line 4676, in __init__
self._load_keys(node.get(), node.name, logger)
File "/home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/tmt/utils.py", line 4649, in _load_keys
value = dataclass_normalize_field(self, key_address, keyname, value, logger)
File "/home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/tmt/utils.py", line 4268, in dataclass_normalize_field
value = normalize_callback(key_address, raw_value, logger)
File "/home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/tmt/base.py", line 915, in <lambda>
None if raw_value is None else ShellScript(raw_value))
File "/home/huanli/.virtualenvs/tmt/lib/python3.10/site-packages/tmt/utils.py", line 355, in __init__
self._script = textwrap.dedent(script)
File "/usr/lib64/python3.10/textwrap.py", line 438, in dedent
text = _whitespace_only_re.sub('', text)
TypeError: expected string or bytes-like object |
psss
changed the title
traceback for malformed test metadata
Traceback for malformed test metadata
Jun 20, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I messed up test metadata but tmt should not traceback.
The text was updated successfully, but these errors were encountered: