Skip to content
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

add a hint list to help user understand the wetest error #85

Open
vnadot opened this issue Mar 5, 2024 · 1 comment
Open

add a hint list to help user understand the wetest error #85

vnadot opened this issue Mar 5, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@vnadot
Copy link
Contributor

vnadot commented Mar 5, 2024

WeTest errors are not very user-friendly. For example (they are many examples):

for this test:

    - name:       "enable PV put (DISP EPICS field)"
      setter:     "SL-SCL-CM1:RF-RFFI-1:GenDriverScanSet.DISP"
      set_value:  "0"

I got this error message

ERROR: test-0-0-1 (wetest.testing.generator.SelectableTestCase)
enable PV put: enable PV put (DISP EPICS field)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/nix/store/pnkbr2dx35h9rz9zn3fgvcgvfr73smvs-python3.9-wetest-2.0.0rc1/lib/python3.9/site-packages/wetest/testing/generator.py", line 438, in test
    setter.put(set_value)
  File "/iee/extensions/lib/python/pyepics-3.2.4-py2.7.egg/epics/pv.py", line 336, in put
    return ca.put(self.chid, value,
  File "/iee/extensions/lib/python/pyepics-3.2.4-py2.7.egg/epics/ca.py", line 403, in wrapper
    return fcn(*args, **kwds)
  File "/iee/extensions/lib/python/pyepics-3.2.4-py2.7.egg/epics/ca.py", line 1329, in put
    PySEVCHK('put', ret)
  File "/iee/extensions/lib/python/pyepics-3.2.4-py2.7.egg/epics/ca.py", line 432, in PySEVCHK
    raise CASeverityException(func_name, message(status))
epics.ca.CASeverityException:  put returned 'Invalid element count requested'

The reason is because of a type error (see #84). Setting set_value: 0 in my case fix the issue.

I propose to add some hints after an error message. In this specific case it could be: type mismatch: try to set a string in int type

@vnadot
Copy link
Contributor Author

vnadot commented Mar 6, 2024

Another example of not user-friendly message: I run a suite and I don't know which file does not meet the version requirements.

$ ./${WETEST_PATH}/${WETEST_NAME} test/misc/WeTest/epicsComGen/rffi_WeTest_register_map_test_epicsComGen.yaml  --no-gui  -m P=SL-SCL-CM1:RF-RFFI-1: --propagate-macros
Traceback (most recent call last):
  File "/nix/store/pnkbr2dx35h9rz9zn3fgvcgvfr73smvs-python3.9-wetest-2.0.0rc1/bin/..wetest-wrapped-wrapped", line 9, in <module>
    sys.exit(main())
  File "/nix/store/pnkbr2dx35h9rz9zn3fgvcgvfr73smvs-python3.9-wetest-2.0.0rc1/lib/python3.9/site-packages/wetest/command_line.py", line 426, in main
    suite, configs = generate_tests(
  File "/nix/store/pnkbr2dx35h9rz9zn3fgvcgvfr73smvs-python3.9-wetest-2.0.0rc1/lib/python3.9/site-packages/wetest/command_line.py", line 171, in generate_tests
    tests_data = ScenarioReader(
  File "/nix/store/pnkbr2dx35h9rz9zn3fgvcgvfr73smvs-python3.9-wetest-2.0.0rc1/lib/python3.9/site-packages/wetest/testing/reader.py", line 343, in __init__
    self.deserialized = self._deserialize()
  File "/nix/store/pnkbr2dx35h9rz9zn3fgvcgvfr73smvs-python3.9-wetest-2.0.0rc1/lib/python3.9/site-packages/wetest/testing/reader.py", line 437, in _deserialize
    new_sc = ScenarioReader(
  File "/nix/store/pnkbr2dx35h9rz9zn3fgvcgvfr73smvs-python3.9-wetest-2.0.0rc1/lib/python3.9/site-packages/wetest/testing/reader.py", line 350, in __init__
    self.version_is_supported = ScenarioReader.supports_version(
  File "/nix/store/pnkbr2dx35h9rz9zn3fgvcgvfr73smvs-python3.9-wetest-2.0.0rc1/lib/python3.9/site-packages/wetest/testing/reader.py", line 723, in supports_version
    raise UnsupportedFileFormatError(file_version)
wetest.testing.reader.UnsupportedFileFormatError: Scenario version '1.2.0' not supported. Current WeTest version: '2.0.0'.
Look at the WeTest repository for the CHANGELOG:
https://github.com/epics-extensions/WeTest

I would like a message like this:

wetest.testing.reader.UnsupportedFileFormatError: Scenario version '1.2.0' (file toto.yaml) not supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants