Leaving them in can trip up postgresql:
```
Traceback (most recent call last):
File "lib/galaxy/web/framework/decorators.py", line 283, in decorator
rval = func(self, trans, *args, **kwargs)
File "lib/galaxy/webapps/galaxy/api/history_contents.py", line 396, in create
return self.__create_dataset_collection(trans, history, payload, **kwd)
File "lib/galaxy/webapps/galaxy/api/history_contents.py", line 525, in __create_dataset_collection
**create_params
File "lib/galaxy/managers/collections.py", line 108, in create
copy_elements=copy_elements,
File "lib/galaxy/managers/collections.py", line 181, in create_dataset_collection
copy_elements=copy_elements)
File "lib/galaxy/managers/collections.py", line 217, in _element_identifiers_to_elements
copy_elements=copy_elements)
File "lib/galaxy/managers/collections.py", line 389, in __load_elements
copy_elements=copy_elements)
File "lib/galaxy/managers/collections.py", line 434, in __load_element
self.tag_manager.apply_item_tags(user=trans.user, item=element, tags_str=tag_str)
File "lib/galaxy/managers/tags.py", line 182, in apply_item_tags
self.apply_item_tag(user, item, name, value)
File "lib/galaxy/managers/tags.py", line 154, in apply_item_tag
tag = self._get_or_create_tag(lc_name)
File "lib/galaxy/managers/tags.py", line 233, in _get_or_create_tag
tag = self.get_tag_by_name(scrubbed_tag_str)
File "lib/galaxy/managers/tags.py", line 205, in get_tag_by_name
return self.sa_session.query(galaxy.model.Tag).filter_by(name=tag_name.lower()).first()
File "/bioinfo/guests/mvandenb/galaxy/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2789, in first
ret = list(self[0:1])
File "/bioinfo/guests/mvandenb/galaxy/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2581, in __getitem__
return list(res)
File "/bioinfo/guests/mvandenb/galaxy/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2889, in __iter__
return self._execute_and_instances(context)
File "/bioinfo/guests/mvandenb/galaxy/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2912, in _execute_and_instances
result = conn.execute(querycontext.statement, self._params)
File "/bioinfo/guests/mvandenb/galaxy/.venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 948, in execute
return meth(self, multiparams, params)
File "/bioinfo/guests/mvandenb/galaxy/.venv/local/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 269, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/bioinfo/guests/mvandenb/galaxy/.venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1060, in _execute_clauseelement
compiled_sql, distilled_params
File "/bioinfo/guests/mvandenb/galaxy/.venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1200, in _execute_context
context)
File "/bioinfo/guests/mvandenb/galaxy/.venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1416, in _handle_dbapi_exception
util.reraise(*exc_info)
File "/bioinfo/guests/mvandenb/galaxy/.venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1193, in _execute_context
context)
File "/bioinfo/guests/mvandenb/galaxy/.venv/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 507, in do_execute
cursor.execute(statement, parameters)
ValueError: A string literal cannot contain NUL (0x00) characters.
```
This fixes the following traceback:
```
( unicode_stream ) > Test-1 ... galaxy.tools DEBUG 2018-08-21 09:40:59,052 Validated and populated state for tool request (0.098 ms)
galaxy.tools.actions INFO 2018-08-21 09:40:59,076 Handled output named out_file1 for tool unicode_stream (1.337 ms)
galaxy.tools.actions INFO 2018-08-21 09:40:59,080 Added output datasets to history (4.399 ms)
galaxy.tools.actions INFO 2018-08-21 09:40:59,084 Verified access to datasets for Job[unflushed,tool_id=unicode_stream] (0.058 ms)
galaxy.tools.actions INFO 2018-08-21 09:40:59,086 Setup for job Job[unflushed,tool_id=unicode_stream] complete, ready to flush (5.220 ms)
galaxy.tools.actions INFO 2018-08-21 09:40:59,127 Flushed transaction for job Job[id=354,tool_id=unicode_stream] (40.627 ms)
galaxy.tools.execute DEBUG 2018-08-21 09:40:59,127 Tool [unicode_stream] created job [354] (56.506 ms)
galaxy.tools.execute DEBUG 2018-08-21 09:40:59,132 Executed 1 job(s) for tool unicode_stream request: (79.434 ms)
galaxy.jobs.mapper DEBUG 2018-08-21 09:40:59,556 (354) Mapped job to destination id: local
galaxy.jobs.handler DEBUG 2018-08-21 09:40:59,561 (354) Dispatching to local runner
galaxy.jobs DEBUG 2018-08-21 09:40:59,571 (354) Working directory for job is: /tmp/tmp3drfmr6x/tmp_ywd33ar/tmpbzo4a1d9/database/job_working_directory_azry9a1y/000/354
galaxy.jobs DEBUG 2018-08-21 09:40:59,574 (354) Persisting job destination (destination id: local)
galaxy.jobs.runners DEBUG 2018-08-21 09:40:59,589 Job [354] queued (27.361 ms)
galaxy.jobs.handler INFO 2018-08-21 09:40:59,604 (354) Job dispatched
galaxy.jobs.runners ERROR 2018-08-21 09:40:59,715 (354) Failure preparing job
Traceback (most recent call last):
File "/galaxy/lib/galaxy/jobs/runners/__init__.py", line 187, in prepare_job
job_wrapper.prepare()
File "/galaxy/lib/galaxy/jobs/__init__.py", line 874, in prepare
self.command_line, self.extra_filenames, self.environment_variables = tool_evaluator.build()
File "/galaxy/lib/galaxy/tools/evaluation.py", line 435, in build
raise e
File "/galaxy/lib/galaxy/tools/evaluation.py", line 431, in build
self.__build_config_files()
File "/galaxy/lib/galaxy/tools/evaluation.py", line 504, in __build_config_files
self.__write_workdir_file(config_filename, config_text, param_dict, is_template=is_template)
File "/galaxy/lib/galaxy/tools/evaluation.py", line 578, in __write_workdir_file
f.write(value)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-5: ordinal not in range(128)
galaxy.tools.error_reports DEBUG 2018-08-21 09:40:59,869 Bug report plugin <galaxy.tools.error_reports.plugins.sentry.SentryPlugin object at 0x7f92efb81668> generated response None
FAIL
```
which is due to the fact that the default encoding in the Docker image
is `ANSI_X3.4-1968`.
Also update `unicode_stream` test tool to IUC best practices.
That should make the test less flakey. While in theory we should be able
to replace scheduled workflow jobs with cached jobs, this is not what
we're testing here, and I assume it doesn't work for now.
This is pretty hackish as fixtures can't be used during test discovery.
To properly shut down the driver I've added a conftest.py file that will
be called when quitting pytest. We might be able to handle this a
little better if we wrote a full plugin, but for now this works.
Also now reports all test indexes, so you can select e.g test 2 of a
tool.
We're now just copying the current python path. Also the handler names
have actually changed, I think this hasn't been updated after a late
change (it is now as it should be, based on the documentation).
We don't rely on TwillTestCase anymore, that is now exclusively used by
ShedTwillTestCase. Then I've just re-used the infrastructure of
ToolsTestCase for discovering tests, while making sure that we do use an
admin API key during testing.