Commit Graph
67 Commits
Author SHA1 Message Date
John DavisandNicola Soranzo 67c7e7d1ac Use a simple cast instead of relying on dependency injection
Co-authored-by: Nicola Soranzo <nicola.soranzo@gmail.com>
2022-11-30 13:33:42 -05:00
John Davis cbabba8f49 Fix typing error in unit test 2022-11-29 14:59:17 -05:00
Nicola Soranzo de5e9c0e71 Add some type annotations to `WebApplication and GalaxyWebTransaction` 2022-11-28 04:50:03 +00:00
Nicola Soranzo 2b362fbd1d Merge branch 'release_22.05' into dev 2022-11-17 22:50:45 +00:00
mvdbeek 7254dc9fef Also support byte-range in legacy send_file method 2022-11-16 18:33:46 +01:00
mvdbeek 7f0754eef7 Upgrade FastAPI to 0.87.0, drop old workarounds 2022-11-16 14:31:49 +01:00
Nicola Soranzo c35d8f2a06 Replace `unittest.TestCase` with pytest-based partial re-implementation
Also:
- Rename `FooBarTestCase` test classes as `TestFooBar`. These were collected
  by pytest only because they were `unittest.TestCase` derived, but normally
  pytest collects only test classes whose name starts with `Test`, see
  https://docs.pytest.org/en/7.1.x/reference/reference.html#confval-python_classes
2022-09-27 03:34:58 +01:00
Nicola Soranzo f3b04b8f26 Remove `unittest.main()` calls 2022-09-21 23:50:05 +01:00
Nicola Soranzo b5c7e2c86a Replace `self.assert* method calls with plain asserts in test/`
using https://github.com/pytest-dev/unittest2pytest with the following command:

```
unittest2pytest -f self_assert -w -n test/
```

(excluding ``self.assertRaises*`` method calls).
2022-09-21 23:50:05 +01:00
davelopez a7303e219e Fix API unit tests with ID encodings 2022-08-24 12:05:47 +02:00
davelopez 8355d5e12d Add more unit tests for ID fields 2022-08-24 12:00:26 +02:00
davelopez 1d59487365 Add unit tests for query_parameter_as_list 2022-08-19 08:59:02 +02:00
Marius van den BeekandNicola Soranzo 973d0779b6 Include timezone testing
Co-authored-by: Nicola Soranzo <nicola.soranzo@gmail.com>
2022-08-17 18:43:57 +02:00
mvdbeek b0d9cff6c4 Add unit test
That was meant to go into the first commit ...
2022-08-16 13:12:28 +02:00
davelopez af949c2fd3 Revert adding __hash__ to BaseDatabaseIdField 2022-08-04 11:23:31 +02:00
davelopez e5b11bb25b Add unit tests for DabaseIdFields hashing 2022-08-02 11:10:35 +02:00
mvdbeek 22f761aa10 Fix validation of nested element fetch data payloads
Fixes https://github.com/galaxyproject/galaxy/issues/14242
2022-07-01 13:52:06 +02:00
mvdbeek 84ea10767a Unit test for No response returned error 2022-06-27 18:11:49 +02:00
John Chilton c5bf63bc91 Add DEFERRED datasets to Galaxy
- Improves options and display around discarded datasets.
- Adds new APIs for importing model stores.
- Adds support to model store layer for importing/exporting workflow invocations and APIs and tests to support this.
- Add new DEFERRED dataset state - with APIs for materializing them or the option to defer them on the worker node if using tool_evaluation_strategy=remote on the job destination.
- UI and API options for uploading deferred datasets individually or into collections.
2022-05-23 19:48:47 -04:00
Nicola Soranzo 15ba0f8747 Fix warning in pytest collection
Fix:

```
test/unit/web_framework/framework/test_framework_base.py:4
  /home/runner/work/galaxy/galaxy/galaxy root/test/unit/web_framework/framework/test_framework_base.py:4: PytestCollectionWarning: cannot collect test class 'TestWebapp' because it has a __init__ constructor
    class TestWebapp(WebApplication):
```

Also:
- Use f-string.
- Simplify code using assert.
2022-05-12 16:38:15 +01:00
mvdbeek 55e22ca8a9 Use separate model for fetch data form payload 2022-04-25 18:28:01 +02:00
mvdbeek 02ac5b3c9e Add FastAPI route for tools/fetch 2022-04-23 12:01:32 +02:00
mvdbeek 1d5a52ec05 Schema for fetch_data 2022-04-22 17:08:41 +02:00
mvdbeek 3bc7d7c867 Drop legacy mapping unit tests for FastAPI routes 2022-03-21 13:14:43 +01:00
John Chilton 427847bcc4 Fix up some import "issues". 2022-03-16 14:22:50 -04:00
John Chilton 4dae7c6f21 Disable implicit re-imports across the projects.
Exclude galaxy.util for now, but the exclusion is tracked in setup.cfg. Elimiantes a bunch of flake exception markers.
2022-03-15 19:58:42 -04:00
Nicola Soranzo a62e86fc2e Merge branch 'release_22.01' into dev 2022-03-04 17:02:22 +00:00
mvdbeek 873d43eac2 Move tool shed and reports config schema to config package
And restore unit tests to proper place.
2022-03-03 16:57:39 +01:00
Nicola Soranzo 7f04b5d698 Merge branch 'release_22.01' into dev 2022-03-02 20:08:55 +00:00
mvdbeek a3094f7dbe Drop _override_tempdir patch
and just set override_tempdir to False.
2022-03-01 16:50:06 +01:00
mvdbeek 9ec7e878bc Debug unit tests 2022-03-01 15:39:48 +01:00
mvdbeek 699e7c3156 Drop _override_tempdir patch
and just set override_tempdir to False.
2022-03-01 15:39:47 +01:00
mvdbeek 56b4ee844a Fix mocking of GalaxyAppConfiguration 2022-03-01 15:39:47 +01:00
mvdbeek 98eb857040 Move unit tests that requre TS schema 2022-03-01 15:39:46 +01:00
Nicola Soranzo f8bd5d4bea Merge branch 'release_22.01' into dev 2022-02-21 17:00:55 +00:00
mvdbeek 61dab21990 Use a2wsgi to serve WSGI app
instead of the deprecated starlette WSGIMiddleware that was vendored by
fastAPI. I'm also hoping this fixes the weird exceptions a la:
```
uvicorn.error ERROR 2022-02-14 11:59:42,141 [pN:main,p:4823,tN:Thread-216] Exception in ASGI application
Traceback (most recent call last):
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/uvicorn/protocols/http/h11_impl.py", line 364, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/fastapi/applications.py", line 212, in __call__
    await super().__call__(scope, receive, send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/routing.py", line 656, in __call__
    await route.handle(scope, receive, send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/routing.py", line 408, in handle
    await self.app(scope, receive, send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/fastapi/applications.py", line 212, in __call__
    await super().__call__(scope, receive, send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette_context/middleware/raw_middleware.py", line 96, in __call__
    await self.app(scope, receive, send_wrapper)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/middleware/base.py", line 65, in __call__
    task_group.cancel_scope.cancel()
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 574, in __aexit__
    raise exceptions[0]
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 611, in _run_wrapped_task
    await coro
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/middleware/base.py", line 34, in coro
    await self.app(scope, request.receive, send_stream.send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/routing.py", line 656, in __call__
    await route.handle(scope, receive, send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/routing.py", line 408, in handle
    await self.app(scope, receive, send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/middleware/wsgi.py", line 64, in __call__
    await responder(receive, send)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/middleware/wsgi.py", line 91, in __call__
    await anyio.to_thread.run_sync(self.wsgi, environ, self.start_response)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 572, in __aexit__
    raise ExceptionGroup(exceptions)
anyio._backends._asyncio.ExceptionGroup: 2 exceptions were raised in the task group:
----------------------------
Traceback (most recent call last):
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 611, in _run_wrapped_task
    await coro
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/middleware/wsgi.py", line 98, in sender
    await send(message)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/exceptions.py", line 68, in sender
    await send(message)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/streams/memory.py", line 193, in send
    self.send_nowait(item)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/streams/memory.py", line 177, in send_nowait
    raise BrokenResourceError
anyio.BrokenResourceError
----------------------------
Traceback (most recent call last):
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/middleware/wsgi.py", line 91, in __call__
    await anyio.to_thread.run_sync(self.wsgi, environ, self.start_response)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/to_thread.py", line 29, in run_sync
    limiter=limiter)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 818, in run_sync_in_worker_thread
    return await future
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 754, in run
    result = context.run(func, *args)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/starlette/middleware/wsgi.py", line 132, in wsgi
    self.stream_send.send, {"type": "http.response.body", "body": b""}
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/from_thread.py", line 35, in run
    return asynclib.run_async_from_thread(func, *args)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/_backends/_asyncio.py", line 847, in run_async_from_thread
    return f.result()
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/concurrent/futures/_base.py", line 435, in result
    return self.__get_result()
  File "/opt/hostedtoolcache/Python/3.7.12/x64/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/streams/memory.py", line 193, in send
    self.send_nowait(item)
  File "/home/runner/work/galaxy/galaxy/galaxy root/.venv/lib/python3.7/site-packages/anyio/streams/memory.py", line 177, in send_nowait
    raise BrokenResourceError
anyio.BrokenResourceError
```
2022-02-17 09:36:26 +01:00
Dannon Baker 623a5e165a Apply black formatting.
Apply isort.
2022-02-03 07:42:20 -05:00
mvdbeek 94a512b558 Drop python3.6 compat import 2022-02-03 07:38:50 -05:00
mvdbeek 962a945765 Add InvocationIndexPayload model 2022-01-28 19:31:41 +01:00
Nicola Soranzo bcc505cbbd Drop remaining uses of template_path config 2022-01-19 18:20:20 +00:00
mvdbeek f1e62b1e0d Fix template resolition for tool shed 2022-01-19 18:20:17 +00:00
mvdbeek 3cc94712a7 Fix header content-length, add test for send_file
The uvicorn stack is a little less permissive and fails because
of the wrong content length.
2022-01-05 19:36:57 +01:00
Nicola Soranzo 0bdc93a7cc Drop support for Python 3.6, add Python 3.10 2021-12-08 08:14:10 +00:00
Marius van den Beek 22991365a6 Merge pull request #12929 from davelopez/add_response_wrapper
FastAPI: Add response wrapper for `SessionRequestContext`
2021-11-25 15:55:07 +01:00
davelopez a31d1a305f Fix unit test
To explicitly state the behavior of using `trans.response.set_content_type` when returning the default implicit response
2021-11-24 10:04:28 +01:00
Michael R. Crusoe 7819fdc7a6 tighten type ignores 2021-11-23 13:12:07 +01:00
davelopez e6bdf380d4 Try workaround to set response header 2021-11-17 18:50:55 +01:00
davelopez 82e64d613f Add get_trans mock and simplify tests 2021-11-17 16:47:09 +01:00
davelopez b6058accc1 Add unit tests for response wrapper 2021-11-17 12:29:50 +01:00
Sergey Golitsynskiy a474b696e3 Adjust total count set in headers 2021-11-14 17:30:03 -05:00