Commit Graph
132 Commits
Author SHA1 Message Date
Nicola Soranzo a2018a5e60 Enable flake8-comprehensions ruff rules
but allow `dict()` calls that make use of keyword arguments (e.g.,
`dict(a=1, b=2)`).
2024-03-09 19:11:20 +00:00
mvdbeek ba593057c2 Use `galaxy_driver_class` to create tool shed driver
Use ``autouse`` fixture to configure test driver
2022-11-01 18:45:07 +00:00
Nicola Soranzo 5ca0aea54a Drop nose
It's deprecated and unmaintained, and is broken under Python 3.10 .
2022-11-01 18:45:07 +00:00
Nicola Soranzo a382eacc58 Fix B023 warnings from flake8-bugbear 22.7.1
The new flake8-bugbear 22.7.1 warns if a function defined inside a loop uses
a variable redefined in the loop, due to the late-binding closure gotcha:
https://docs.python-guide.org/writing/gotchas/#late-binding-closures

When possible/sensible, I've moved the function definition before the loop
(adding the variable(s) as parameters) which is clearly also a speed-up.

Most other cases are false alarms, e.g. if the function is used and
discarded within the loop iteration that defines it. In such cases, I've
annotated the offending lines with a `# noqa: B023`.

The only file where I've applied the suggested workaround of immediately
binding arguments is in `lib/galaxy/visualization/plugins/config_parser.py`

Also:
- Small refactorings, in particular to `scripts/apply_tags.py`
2022-07-05 12:28:37 +01:00
Dannon Baker 623a5e165a Apply black formatting.
Apply isort.
2022-02-03 07:42:20 -05:00
Bjoern Gruening dfba28a443 fix mutable arguments in tests 2021-01-02 18:48:31 +00:00
Nicola Soranzo 9d74bba7fb Drop support for retired Python 3.5
Upgrade syntax using `pyupgrade --py36-plus` .

Manually drop several `six` imports.

Also:
- Remove broken pr_cache in scripts/bootstrap_history.py
- Fix broken prefix removal in lib/galaxy/tool_util/deps/mulled/mulled_build.py
2020-10-07 11:52:13 +01:00
John Chilton 2c2ed3f288 Decouple API and Selenium tests from galaxy-test-driver (and the whole app!)
I've been refactoring toward this for at least half a decade. Being able to pip install the API and Selenium tests without bringing in the whole app is important to make them usable outside the context of the app - for testing remote, running servers for instance.

If galaxy-test-driver is available the test cases will still spawn a Galaxy instance if needed, but this is not longer required for import or use.
2020-07-06 13:57:48 -04:00
John Chilton a747294bd9 Refactor toward test case independence from Galaxy. 2020-07-02 12:41:38 -04:00
John Chilton 45019c3fbd Move galaxy testing utilities into more sane package structure.
Split test/base into lib/galaxy_test/base and lib/galaxy_test/driver. Dividing things on whether they import galaxy-app code or not - with the goal of a galaxy-test-base package that doesn't depend on galaxy-app and a galaxy-test-driver package that does.

I've been refactoring around this division for a long time. Certain tests (namely the integration tests) always need to bootstrap Galaxy - but the API tests and the Selenium tests should be installable and runnable without Galaxy in the Python environment. So future galaxy-test-api and galaxy-test-selenium packages should have only an optional dependency on galaxy-test-driver.

Properly sturcturing these namespaces is a precursor for real packages on PyPI, clean separation of the tool shed testing code, and cleans up all the flake8 noqa hacks in test/.
2019-11-12 09:03:06 -05:00
Sergey Golitsynskiy 9713184b03 Move tools/verify/ into tool_util/verify/
Ref: https://github.com/galaxyproject/galaxy/issues/8073
2019-07-12 18:06:53 +01:00
Nicola Soranzo d5a406cef7 Fix errors reported by new flake8 3.7.3 2019-01-31 13:47:21 +00:00
mvdbeek 9e07d9cc06 Handle driver shutdown, show all test in pytest
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.
2018-08-16 18:44:05 +02:00
mvdbeek 7559b90a69 Setup a simple pytest tool test 2018-08-16 14:08:45 +02:00
mvdbeek 3f032f6c38 Rework and simplify data manager testing
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.
2018-08-13 17:19:25 +02:00
mvdbeek 7f0684e3d5 Fix test_toolbox for python 3 2018-07-04 15:41:47 +02:00
John Chilton f715ae5b65 Fix tool test job data collection broken in #5628. 2018-03-09 14:35:31 -05:00
John Chilton b1779e1a46 Refactor tool test outline construction to allow more reuse. 2018-03-06 20:07:51 -05:00
John Chilton c3af6c8fea Serialize tool test descriptions through the API.
Use this is in tool testing. Prevents needing to load / have tools in memory to run tool tests - should allow external tool testing.
2018-03-06 20:07:51 -05:00
John Chilton 508047f00e Refactor ToolTestBuilder to not require an in-memory Tool object.
This gets us a lot closer to being able to construct a ToolTestBuilder from simple dictionaries generated from the API for instance or from any tool really.
2018-03-06 20:07:51 -05:00
John Chilton 289937506b Refactor much more tool testing code into galaxy-lib. 2018-03-06 20:07:51 -05:00
John Chilton 5e6c1c9f51 New abstraction to obtain tool test data paths.
Can be shared between tests and TDTs. A step toward not requiring one to load the tool to test the tool (important for external testing of tools).
2018-03-06 20:07:51 -05:00
Nicola Soranzo 48aca7dce8 Update to flake8-import-order 0.16 2017-12-01 11:09:57 +00:00
Nicola Soranzo 2cd95c48f6 Fix import order everywhere
- Add flake8-import-order to flake8 Pipfile and remove py27-lint-imports
  and py27-lint-imports-include-list tox envs
- Fix most E201 and E202 errors reported by flake8-import-order v0.15,
  but pin flake8-import-order to v0.14.3 until
  https://github.com/PyCQA/flake8-import-order/issues/123
  is fixed

This let us drop 2 jobs on Travis per each job.
2017-11-14 19:42:39 +00:00
John Chilton aba726a89f Move twilltestcase from `base to functional` module.
This way nothing in ``base`` has any dependencies on Twill anymore.
2017-09-01 12:30:18 -04:00
John Chilton 259e12d760 Continue separation of FunctionalTestCase from TwillTestCase.
Move non-twill stuff out into its own module including FunctionalTestCase.
2017-09-01 12:30:07 -04:00
Nicola Soranzo 21b44bf348 Fix all E201 and E202 style errors
using the following command:
```
autopep8 -i -r --exclude $(sed -e 's|^|./|' -e 's|/$||' .ci/flake8_blacklist.txt | paste -sd,) --select E201,E202 .
```
2017-08-17 11:35:39 +01:00
John Chilton b78287f150 Integration test for advanced job runner stuff.
Set of test cases that cover job resource handlers and resubmit job destinations.
2016-12-14 13:41:28 -05:00
Nicola Soranzo 1e32c0926c Fix import order and Python3 compatibility for most of test/ 2016-10-10 19:06:22 +01:00
John Chilton 4765f5876e Enhancements to tool test output verification.
Refactor test verification into galaxy-lib-compat module.

- Refactor a bunch class methods in ``test.base.twilltestcase`` into module functions in ``galaxy.tools.verify``.
- Move ``test.base.test_data`` to ``galaxy.tools.verify.test_data``.
- Move ``test.base.asserts`` to ``galaxy.tools.verify.asserts``.

Remove duplication in execution of these methods between composite and normal test outputs. This also entailed reworking the parsing of the composite test outputs to bring them inline with normal outputs. In addition to simplify removing duplication, this means many more tests can be made over composite outputs - such as md5 checks and test assertions. I've added a new framework test tool to verify this.
2016-05-25 09:37:49 -04:00
Nicola Soranzo 8a43b2b492 Python 3: use "as" instead of comma in except clause 2016-05-17 23:53:16 +01:00
John Chilton 13f05d2d79 Allow testing element counts in tool output collections. 2016-03-17 07:39:57 +00:00
Nicola Soranzo 487ece0f40 Fix all E731 "errors". 2016-01-14 01:19:01 +00:00
Dannon Baker 725261e35e Merge pull request #538 from jmchilton/dynamic_nested_collections
Allow tools to explicitly produce nested collections.
2015-08-07 12:52:00 -04:00
Dannon Baker 7c299faed3 Merge branch 'release_15.07' into dev 2015-08-01 08:10:03 -04:00
John Chilton 13ea86753a Allow tools to explicitly create nested collections with static structure.
https://bitbucket.org/galaxy/galaxy-central/pull-request/634/allow-tools-to-explicitly-produce-dataset added the ability for tool to create simple collections (lists and pairs). It also outlined three creation scenarios - fixed collections, pre-determinable collection structures (like output lists based on input lists), and fully dynamic output collections. This pull request allows tool to output nested collections for these first two.

Fully dynamic nested collections (using <discover_datasets> tags) is not implemented in this commit.

Additionally, the tool test syntax has been extended to allow testing nested collection elements and an example tool is included that demonstrates this functionality - test/functional/tools/collection_creates_list_of_pairs.xml.
2015-07-31 14:10:54 +01:00
John Chilton e8f3553404 Fix expect_failure="true" failure semantics to cover tool submission failure.
Previously it just covered runtime job failure - there should probably be a way for the tool developer to specify which sort of failure is expected.
2015-07-31 11:09:44 +01:00
Bjoern Gruening 1bbff415f2 lint fixes for test/functional/ 2015-07-12 21:32:49 +01:00
John Chilton 906e9a0809 Fix function names for dynamic tool test functions.
When finding methods to invoke it seems nose uses the raw function name instead of the class's attribute name (I guess this terminology makes sense), but when reporting results it uses the latter. Synchronizing these names therefore allows calling specific tool test methods from the command-line.

This change is required to implement galaxyproject/planemo#145.
2015-05-15 15:47:35 -04:00
John Chilton 44f7317fa5 Allow tools to output collections with static or determinable structure.
By "static" I mean tools such as a FASTQ de-interlacer that would produce a "paired" collection with two datasets everytime. By "determinable" I mean tools that perform N->N operations within the same job - such as a tool that needs to normalize a bunch of datasets all at once and not in separate jobs. (For N->N collection operations that should or can be done in N separate jobs tool authors should just write tools that operate over a dataset and produce a dataset and let the end-user 'map over' that operation.)

There are still large classes of operations where the structure of the output collection cannot be pre-determined - such as splitting files (e.g. bam files by read group) - that are not implemented in this commit.

Model:

The models have been updated to do a more thorough job of tracking collection outputs. Jobs just producing HistoryDatasetCollectionAssociations works fine for simple jobs producing collections - but you don't want to map a list over a tool that produces a pair and produce a bunch of pairs HDCAs and a list:pair HDCA- you just want a bunch of pieces and the one list:pair at that the top.

Workflow:

Workflows containing such operations can be executed - but the workflow editor has not been updated to handle this complexity (and it will require a significant overhaul) so such tools are not available in the workflow editor.

Tool Testing:

This commit also introduces a new tool XML syntax for describing tests on output collections. See files test/functional/tools/collection_creates_list.xml and test/functional/tools/collection_creates_pair.xml for examples.

Tests:

Includes two tools to test this - one that uses explicit pair output names and one that iterates over the structure of input list to produce an output list.

Includes several new tools API tests that test the tools described above via the API and implicit mapping over such tools. Includes two new workflow API tests - one that verifies a simple workflow with output collections works and one that verifies mapping over workflow steps in collections works.
2015-01-15 09:30:00 -05:00
John Chilton 8e060c77bc Implement expect_failure and expect_exit_code on test tag of tools. 2014-12-17 14:22:08 -05:00
John Chilton 77ee2ace67 Allow tool tests to assert properties about command, standard output, and standard error.
See test/functional/tools/job_properties.xml for example. Provides full access to assertion based XML tags - tabular and XML based assertions probably not so interesting so these include - has_text, has_line, not_has_text, has_text_matching, has_line_matching.
2014-12-17 12:34:39 -05:00
John Chilton 887bc44a41 Implement structured tool test data.
Rather than relying solely on exceptions back to nose/test framework - add option (--structured_data_report_file) to run_tests.sh that causes a bunch of detailed data to be dumped to the specified file in a very structured way. Includes full to_dict of the job from the API which in turn includes job metrics, command-line, job's standard error and outputs (instead of the test frameworks), as well as the tool inputs, and exceptions broken out for tool execution versus output checking.

Its all indexed in the file by the test id (without the actual test toolbox depending on knowing the test id) - so one could pair this information with the XUnit output to produce much more detailed breakdowns of the tests.
2014-12-08 00:21:47 -05:00
John Chilton 8479f6b6cc Include diffs for all errors when testing - don't stop at first.
Gives more details to aid testing (especially for tools with lots of outputs) and lets developer collect all correct test data files at once (when GALAXY_TEST_SAVE is set or using `planemo test` with --job_output_files argument) instead of needing to rerun the tool repeatedly.
2014-12-05 23:35:44 -05:00
John Chilton 5682b8bc3d Mark test_toolbox:build_tests as "not a test".
This will prevent run_tests.sh from picking up the extra test when running full test tool box - the way planemo does (i.e. this fixes the problem where planemo always runs one extra passing test).
2014-12-05 23:30:52 -05:00
Dave Bouvier bb3c895e51 Add optional display of stdout/stderr to the jobs API return value, defaulting to not displayed. Rework the test API interactor to wait for jobs instead of histories and get the stdout and stderr from the API. 2014-10-23 10:34:17 -04:00
John Chilton c1ee4c9b31 Add functional test tool demonstrating output filters.
Add new 'expect_num_outputs' attribute to 'test' element in tool XML to verify the produced number - needed to test output filtering.
2014-09-03 08:43:25 -04:00
John Chilton 2782a29fdc Allow tools to test runtime discovered datasets. 2014-03-29 17:11:17 -05:00
Dave Bouvier d1114a1b0f Fix deletion of test methods after tests have been run. 2014-01-16 11:30:25 -05:00
Daniel Blankenberg 1327cc5445 Rename functions to prevent encapsulation / name mangling in test_toolbox.py and test_data_managers.py 2013-12-11 09:00:01 -05:00