Skip to content

Commit

Permalink
Fix memoize, common_utils, mmap by updating import paths
Browse files Browse the repository at this point in the history
  • Loading branch information
atspaeth committed May 23, 2024
1 parent 0a56fd5 commit fa66a87
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
15 changes: 7 additions & 8 deletions tests/common_utils.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
import io
import unittest
from unittest.mock import patch, MagicMock
import common_utils
from common_utils import checkout, force_release_checkout, map2
from braingeneers.iot import messaging
import os
import tempfile
import unittest
from unittest.mock import patch, MagicMock

import braingeneers.utils.smart_open_braingeneers as smart_open
from typing import Union
from braingeneers.utils import common_utils
from braingeneers.utils.common_utils import checkout, map2


class TestFileListFunction(unittest.TestCase):

@patch('common_utils._lazy_init_s3_client') # Updated to common_utils
@patch('braingeneers.utils.common_utils._lazy_init_s3_client') # Updated to common_utils
def test_s3_files_exist(self, mock_s3_client):
# Mock S3 client response
mock_response = {
Expand All @@ -27,7 +26,7 @@ def test_s3_files_exist(self, mock_s3_client):
expected = [('file2.txt', '2023-01-02', 456), ('file1.txt', '2023-01-01', 123)]
self.assertEqual(result, expected)

@patch('common_utils._lazy_init_s3_client') # Updated to common_utils
@patch('braingeneers.utils.common_utils._lazy_init_s3_client') # Updated to common_utils
def test_s3_no_files(self, mock_s3_client):
# Mock S3 client response for no files
mock_s3_client.return_value.list_objects.return_value = {}
Expand Down
6 changes: 4 additions & 2 deletions tests/memoize_s3.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import pytest
import unittest
from unittest import mock

from botocore.exceptions import ClientError

from .configure import skip_unittest_if_offline
from .memoize_s3 import memoize
from braingeneers.utils.configure import skip_unittest_if_offline
from braingeneers.utils.memoize_s3 import memoize


@pytest.mark.filterwarnings('ignore::UserWarning')
class TestMemoizeS3(unittest.TestCase):
@skip_unittest_if_offline
def test(self):
Expand Down
4 changes: 2 additions & 2 deletions tests/numpy_s3_memmap.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import unittest
import numpy as np
from .configure import skip_unittest_if_offline
from .numpy_s3_memmap import NumpyS3Memmap
from braingeneers.utils.configure import skip_unittest_if_offline
from braingeneers.utils.numpy_s3_memmap import NumpyS3Memmap


class TestNumpyS3Memmap(unittest.TestCase):
Expand Down

0 comments on commit fa66a87

Please sign in to comment.