Compare commits

...
4 Commits
Author SHA1 Message Date
Alok Saldanha 82e43ff943 preparing for 0.3.4 release 2021-07-18 09:15:27 -04:00
Alok Saldanha f8a77423eb Merge pull request #51 from Novartis/nested_subdirs
Enable listing nested subdirs
2021-07-18 09:14:16 -04:00
Alok Saldanha 0375a717c9 #50 fixed bug in listing subdirs 2021-07-18 09:04:36 -04:00
Alok Saldanha 4bf57832a0 #50 added failing test for listing subdirs 2021-07-18 08:51:37 -04:00
4 changed files with 27 additions and 2 deletions
+4
View File
@@ -1,3 +1,7 @@
# 0.3.4
* Fixed bug #50 affecting subdirectory listing
# 0.3.3 # 0.3.3
* Fixed bug #48 affecting cache pruning * Fixed bug #48 affecting cache pruning
+1 -1
View File
@@ -7,4 +7,4 @@
# OR CONDITIONS OF ANY KIND, either express or implied. See the License for # OR CONDITIONS OF ANY KIND, either express or implied. See the License for
# the specific language governing permissions and limitations under the License. # the specific language governing permissions and limitations under the License.
__version__ = "0.3.3" __version__ = "0.3.4"
@@ -51,7 +51,7 @@ class FileItemSource(ItemSource):
return self.convert_h5ad_path_to_annotation(item.descriptor) return self.convert_h5ad_path_to_annotation(item.descriptor)
def list_items(self, filter: str = None) -> ItemTree: def list_items(self, filter: str = None) -> ItemTree:
item_tree = self.scan_directory() item_tree = self.scan_directory("" if filter is None else filter)
"""def get_items(dir): """def get_items(dir):
if dir.branches: if dir.branches:
+21
View File
@@ -1,10 +1,31 @@
import tempfile import tempfile
import unittest import unittest
from unittest.mock import patch
from cellxgene_gateway.items.file.fileitem_source import FileItemSource from cellxgene_gateway.items.file.fileitem_source import FileItemSource
def stub_join(path):
path.join = lambda x, y: x + "/" + y
class TestFileItemSource(unittest.TestCase): class TestFileItemSource(unittest.TestCase):
@patch("os.path")
@patch("os.listdir")
def test_list_items_GIVEN_no_subpath_THEN_checks_dir(self, listdir, path):
stub_join(path)
source = FileItemSource("/tmp/unittest", "local")
source.list_items()
path.exists.assert_called_once_with("/tmp/unittest/")
@patch("os.path")
@patch("os.listdir")
def test_list_items_GIVEN_subpath_THEN_checks_subpath(self, listdir, path):
stub_join(path)
source = FileItemSource("/tmp/unittest", "local")
source.list_items("foo")
path.exists.assert_called_once_with("/tmp/unittest/foo")
def test_make_fileitem_from_path_GIVEN_annotation_file_THEN_name_lacks_csv( def test_make_fileitem_from_path_GIVEN_annotation_file_THEN_name_lacks_csv(
self, self,
): ):