python-google-cloud-storage/no-relative-imports.patch

90 lines
2.6 KiB
Diff

---
tests/unit/test__http.py | 3 +++
tests/unit/test__signing.py | 5 ++++-
tests/unit/test_blob.py | 2 ++
tests/unit/test_client.py | 5 ++++-
4 files changed, 13 insertions(+), 2 deletions(-)
--- a/tests/unit/test__http.py
+++ b/tests/unit/test__http.py
@@ -12,12 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+import os.path
+import sys
import unittest
from unittest.mock import patch
import mock
from google.cloud.storage import _helpers
+sys.path.insert(0, os.path.abspath(os.path.join(__file__, '..', '..', '..')))
from tests.unit.test__helpers import GCCL_INVOCATION_TEST_CONST
--- a/tests/unit/test__signing.py
+++ b/tests/unit/test__signing.py
@@ -19,6 +19,8 @@ import binascii
import calendar
import datetime
import json
+import os.path
+import sys
import time
import unittest
import urllib.parse
@@ -26,7 +28,8 @@ import urllib.parse
import mock
import pytest
-from . import _read_local_json
+sys.path.insert(0, os.path.abspath(os.path.join(__file__, '..', '..')))
+from unit import _read_local_json
_SERVICE_ACCOUNT_JSON = _read_local_json("url_signer_v4_test_account.json")
--- a/tests/unit/test_blob.py
+++ b/tests/unit/test_blob.py
@@ -18,6 +18,7 @@ import hashlib
import io
import json
import os
+import sys
import tempfile
import unittest
import http.client
@@ -35,6 +36,7 @@ from google.cloud.storage.retry import (
)
from google.cloud.storage.retry import DEFAULT_RETRY_IF_ETAG_IN_JSON
from google.cloud.storage.retry import DEFAULT_RETRY_IF_GENERATION_SPECIFIED
+sys.path.insert(0, os.path.abspath(os.path.join(__file__, '..', '..', '..')))
from tests.unit.test__helpers import GCCL_INVOCATION_TEST_CONST
--- a/tests/unit/test_client.py
+++ b/tests/unit/test_client.py
@@ -18,9 +18,11 @@ import io
import json
from unittest.mock import patch
import mock
+import os.path
import pytest
import re
import requests
+import sys
import unittest
import urllib
@@ -33,8 +35,9 @@ from google.cloud.storage._helpers impor
from google.cloud.storage import _helpers
from google.cloud.storage.retry import DEFAULT_RETRY
from google.cloud.storage.retry import DEFAULT_RETRY_IF_GENERATION_SPECIFIED
+sys.path.insert(0, os.path.abspath(os.path.join(__file__, '..', '..', '..')))
from tests.unit.test__helpers import GCCL_INVOCATION_TEST_CONST
-from . import _read_local_json
+from tests.unit import _read_local_json
_SERVICE_ACCOUNT_JSON = _read_local_json("url_signer_v4_test_account.json")
_CONFORMANCE_TESTS = _read_local_json("url_signer_v4_test_data.json")[