mirror of
https://github.com/Novartis/cellxgene-gateway.git
synced 2026-09-16 05:17:55 +08:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2cefc6d741 | ||
|
|
1586c9a3e8 | ||
|
|
f16bd5e2b9 |
9
.github/workflows/pr-checks.yaml
vendored
9
.github/workflows/pr-checks.yaml
vendored
@@ -51,10 +51,17 @@ jobs:
|
||||
run: |
|
||||
eval "$(conda shell.bash hook)"
|
||||
conda activate cellxgene-gateway
|
||||
coverage report --fail-under 41
|
||||
coverage report --fail-under 47
|
||||
coverage xml -i
|
||||
|
||||
- name: "Upload coverage to Codecov"
|
||||
uses: codecov/codecov-action@v1
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: ./coverage.xml
|
||||
flags: unittests
|
||||
env_vars: OS,PYTHON
|
||||
name: codecov-umbrella
|
||||
fail_ci_if_error: true
|
||||
path_to_write_report: ./codecov_report.txt
|
||||
verbose: true
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
Cellxgene Gateway allows you to use the Cellxgene Server provided by the Chan Zuckerberg Institute (https://github.com/chanzuckerberg/cellxgene) with multiple datasets. It displays an index of available h5ad (anndata) files. When a user clicks on a file name, it launches a Cellxgene Server instance that loads that particular data file and once it is available proxies requests to that server.
|
||||
|
||||
[](https://codecov.io/gh/Novartis/cellxgene-gateway)
|
||||
|
||||
# Running locally
|
||||
|
||||
## Prequisites
|
||||
|
||||
42
tests/test_subprocess_backend.py
Normal file
42
tests/test_subprocess_backend.py
Normal file
@@ -0,0 +1,42 @@
|
||||
import unittest
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
from cellxgene_gateway.backend_cache import BackendCache
|
||||
from cellxgene_gateway.cache_entry import CacheEntry
|
||||
from cellxgene_gateway.cache_key import CacheKey
|
||||
from cellxgene_gateway.items.file.fileitem import FileItem
|
||||
from cellxgene_gateway.items.file.fileitem_source import FileItemSource
|
||||
from cellxgene_gateway.items.item import ItemType
|
||||
from cellxgene_gateway.process_exception import ProcessException
|
||||
|
||||
|
||||
class TestSubprocessBackend(unittest.TestCase):
|
||||
@patch("subprocess.Popen")
|
||||
def test_launch_GIVEN_no_stdout_THEN_throw_ProcessException(self, popen):
|
||||
subprocess = MagicMock()
|
||||
subprocess.stdout.readline().decode.return_value = ""
|
||||
subprocess.stderr.read().decode.return_value = "An unexpected error"
|
||||
popen.return_value = subprocess
|
||||
|
||||
key = CacheKey(
|
||||
FileItem("/czi/", name="pbmc3k.h5ad", type=ItemType.h5ad),
|
||||
FileItemSource("/tmp", "local"),
|
||||
)
|
||||
entry = CacheEntry.for_key(key, 8000)
|
||||
from cellxgene_gateway.subprocess_backend import SubprocessBackend
|
||||
|
||||
backend = SubprocessBackend()
|
||||
cellxgene_loc = "/some/cellxgene"
|
||||
scripts = ["http://example.com/script.js", "http://example.com/script2.js"]
|
||||
|
||||
with self.assertRaises(ProcessException) as context:
|
||||
backend.launch(cellxgene_loc, scripts, entry)
|
||||
popen.assert_called_once_with(
|
||||
[
|
||||
"yes | /some/cellxgene launch /tmp/czi/pbmc3k.h5ad --port 8000 --host 127.0.0.1 --disable-annotations --scripts http://example.com/script.js --scripts http://example.com/script2.js"
|
||||
],
|
||||
shell=True,
|
||||
stderr=-1,
|
||||
stdout=-1,
|
||||
)
|
||||
self.assertEqual("An unexpected error", context.exception.stderr)
|
||||
Reference in New Issue
Block a user