diff --git a/.github/workflows/pr-checks.yaml b/.github/workflows/pr-checks.yaml
index 5953b94..9b68582 100644
--- a/.github/workflows/pr-checks.yaml
+++ b/.github/workflows/pr-checks.yaml
@@ -22,7 +22,7 @@ jobs:
pip install black
- name: Run black
run: |
- black -l 79 . --check
+ black . --check
# This job is copied over from `deploy.yaml`
run-tests:
runs-on: ubuntu-18.04
diff --git a/cellxgene_gateway/items/s3/s3item_source.py b/cellxgene_gateway/items/s3/s3item_source.py
index 39abe03..5cf7826 100644
--- a/cellxgene_gateway/items/s3/s3item_source.py
+++ b/cellxgene_gateway/items/s3/s3item_source.py
@@ -29,8 +29,10 @@ class S3ItemSource(ItemSource):
):
self._name = name
self.s3 = s3fs.S3FileSystem()
- if bucket.startswith('s3://'):
- raise Exception(f"Bucket name should not include s3:// prefix, got {bucket}")
+ if bucket.startswith("s3://"):
+ raise Exception(
+ f"Bucket name should not include s3:// prefix, got {bucket}"
+ )
self.bucket = bucket
self.h5ad_suffix = h5ad_suffix
self.annotation_dir_suffix = annotation_dir_suffix
@@ -69,7 +71,7 @@ class S3ItemSource(ItemSource):
raise Exception(f"S3 url '{url}' does not exist.")
s3key_map = dict(
- (filepath[len(self.bucket) :].lstrip('/'), "s3://" + filepath)
+ (filepath[len(self.bucket) :].lstrip("/"), "s3://" + filepath)
for filepath in sorted(self.s3.ls(url))
)
diff --git a/tests/items/file/test_fileitem_source.py b/tests/items/file/test_fileitem_source.py
index 9350690..eca34ab 100644
--- a/tests/items/file/test_fileitem_source.py
+++ b/tests/items/file/test_fileitem_source.py
@@ -5,7 +5,9 @@ from cellxgene_gateway.items.file.fileitem_source import FileItemSource
class TestFileItemSource(unittest.TestCase):
- def test_make_fileitem_from_path_GIVEN_annotation_file_THEN_name_lacks_csv(self):
+ def test_make_fileitem_from_path_GIVEN_annotation_file_THEN_name_lacks_csv(
+ self,
+ ):
source = FileItemSource(tempfile.gettempdir(), "local")
item = source.make_fileitem_from_path(
"customanno.csv", "someh5ad_annotations", True
diff --git a/tests/test_cache_entry.py b/tests/test_cache_entry.py
index 6ad04bd..697e8d1 100644
--- a/tests/test_cache_entry.py
+++ b/tests/test_cache_entry.py
@@ -2,6 +2,7 @@ import unittest
from flask import Flask
+from cellxgene_gateway import flask_util
from cellxgene_gateway.cache_entry import CacheEntry, CacheEntryStatus
from cellxgene_gateway.cache_key import CacheKey
from cellxgene_gateway.gateway import app
@@ -27,13 +28,31 @@ class TestRenderEntry(unittest.TestCase):
self.assertEqual(entry.status, CacheEntryStatus.loading)
def test_GIVEN_absolute_static_url_THEN_include_path(self):
+ flask_util.include_source_in_url = False
+ actual = CacheEntry.for_key(key, 8000).rewrite_text_content(
+ "src:url(/static/assets/"
+ )
+ expected = "src:url(/view/czi/pbmc3k.h5ad/static/assets/"
+ self.assertEqual(actual, expected)
+
+ def test_GIVEN_absolute_src_THEN_include_path(self):
+ flask_util.include_source_in_url = False
+ actual = CacheEntry.for_key(key, 8000).rewrite_text_content(
+ ''
+ )
+ expected = ''
+ self.assertEqual(actual, expected)
+
+ def test_GIVEN_absolute_static_url_include_source_THEN_include_path(self):
+ flask_util.include_source_in_url = True
actual = CacheEntry.for_key(key, 8000).rewrite_text_content(
"src:url(/static/assets/"
)
expected = "src:url(/source/local/view/czi/pbmc3k.h5ad/static/assets/"
self.assertEqual(actual, expected)
- def test_GIVEN_absolute_src_THEN_include_path(self):
+ def test_GIVEN_absolute_src_include_source_THEN_include_path(self):
+ flask_util.include_source_in_url = True
actual = CacheEntry.for_key(key, 8000).rewrite_text_content(
''
)