galaxy icon indicating copy to clipboard operation
galaxy copied to clipboard

Add test for optional select with default and fix xsd docs

Open bernt-matthias opened this issue 2 years ago • 1 comments

Add test for optional select with default testing if it can be unselected in a test

was just wondering if this works and was happy to see that is does. ~Maybe we should document that omitting value in TestParam has this effect?~ And fix documentation.

How to test the changes?

(Select all options that apply)

  • [x] I've included appropriate automated tests.
  • [ ] This is a refactoring of components with existing test coverage.
  • [ ] Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • [x] I agree to license these contributions under Galaxy's current license.
  • [x] I agree to allow the Galaxy committers to license these and all my past contributions to the core galaxy codebase under the MIT license. If this condition is an issue, uncheck and just let us know why with an e-mail to [email protected].

bernt-matthias avatar Mar 17 '22 07:03 bernt-matthias

With the new test I run into

Traceback (most recent call last):
  File "/home/runner/work/galaxy/galaxy/galaxy root/lib/galaxy/web/framework/decorators.py", line 336, in decorator
    rval = func(self, trans, *args, **kwargs)
  File "/home/runner/work/galaxy/galaxy/galaxy root/lib/galaxy/webapps/galaxy/api/tools.py", line 590, in create
    return self._create(trans, payload, **kwd)
  File "/home/runner/work/galaxy/galaxy/galaxy root/lib/galaxy/webapps/galaxy/api/tools.py", line 666, in _create
    trans, incoming, history=target_history, use_cached_job=use_cached_job, input_format=input_format
  File "/home/runner/work/galaxy/galaxy/galaxy root/lib/galaxy/tools/__init__.py", line 1787, in handle_input
    trans=trans, incoming=incoming, request_context=request_context, input_format=input_format
  File "/home/runner/work/galaxy/galaxy/galaxy root/lib/galaxy/tools/__init__.py", line 1764, in expand_incoming
    input_format=input_format,
  File "/home/runner/work/galaxy/galaxy/galaxy root/lib/galaxy/tools/parameters/__init__.py", line 412, in populate_state
    simple_errors=simple_errors,
  File "/home/runner/work/galaxy/galaxy/galaxy root/lib/galaxy/tools/parameters/__init__.py", line 616, in _populate_state_legacy
    if check
  File "/home/runner/work/galaxy/galaxy/galaxy root/lib/galaxy/tools/parameters/__init__.py", line 240, in check_param
    value = param.from_json(value, trans, param_values)
  File "/home/runner/work/galaxy/galaxy/galaxy root/lib/galaxy/tools/parameters/basic.py", line 1012, in from_json
    if value in legal_values:
TypeError: unhashable type: 'dict'

Added a "bit" of logging code which revealed that an upload with empty name overwrites the content of the select with value="". Here an excerpt of the logs:

run_tool self.uploads {... '': {'src': 'hda', 'id': 'dd93bb8edc42a50e'}, ...}
...
expand_incoming expanded_incomings [{'select_opt_wdefault': {'src': 'hda', 'id': 'dd93bb8edc42a50e'}}]

Remembered that we also had this here https://github.com/galaxyproject/galaxy/pull/9885 and @mvdbeek suggested this as fix https://github.com/galaxyproject/galaxy/pull/9885/commits/94588bef4a48b608f6599891ab729db4ed8f57b9 . So I cherry picked this over to here.

bernt-matthias avatar Mar 25 '22 08:03 bernt-matthias