Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load Session from Zipfile #2437

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions botocore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# language governing permissions and limitations under the License.

import logging
import os
import re

__version__ = '1.26.2'
Expand Down Expand Up @@ -60,8 +59,6 @@ def emit(self, record):
# individual case.
ScalarTypes = ('string', 'integer', 'boolean', 'timestamp', 'float', 'double')

BOTOCORE_ROOT = os.path.dirname(os.path.abspath(__file__))


# Used to specify anonymous (unsigned) request signature
class UNSIGNED:
Expand Down
5 changes: 3 additions & 2 deletions botocore/loaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@
import logging
import os

from botocore import BOTOCORE_ROOT
import pkg_resources

from botocore.compat import HAS_GZIP, OrderedDict, json
from botocore.exceptions import DataNotFoundError, UnknownServiceError
from botocore.utils import deep_merge
Expand Down Expand Up @@ -233,7 +234,7 @@ class Loader:

FILE_LOADER_CLASS = JSONFileLoader
# The included models in botocore/data/ that we ship with botocore.
BUILTIN_DATA_PATH = os.path.join(BOTOCORE_ROOT, 'data')
BUILTIN_DATA_PATH = pkg_resources.resource_filename('botocore', 'data')
# For convenience we automatically add ~/.aws/models to the data path.
CUSTOMER_DATA_PATH = os.path.join(
os.path.expanduser('~'), '.aws', 'models'
Expand Down
21 changes: 21 additions & 0 deletions tests/functional/test_zip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import os
import shutil
import sys
import tempfile

from tests import BaseSessionTest


class ZipTest(BaseSessionTest):
def test_load_from_zip(self):
fd, temp_path = tempfile.mkstemp(suffix='.zip')
root, ext = os.path.splitext(temp_path)
shutil.make_archive(root, 'zip', '../..')
sys.path.insert(0, temp_path)
super(ZipTest, self).setUp()
self.region = 'us-west-2'
self.client = self.session.create_client(
's3', self.region)
sys.path.remove(temp_path)
os.close(fd)
os.remove(temp_path)