Skip to content

Commit c4b4d2f

Browse files
authored
SG-4483: Fixes a problem with a test fixture causing pip install problems on Windows. (shotgunsoftware#180)
There was a file included in the tests used the check compatibility with a non-standard string encoding and non-ascii characters in file names that caused problems with pip install on Windows. The file has been removed from the repo, and is now created by the relevant test on the fly.
1 parent d589f4b commit c4b4d2f

3 files changed

Lines changed: 24 additions & 0 deletions

File tree

HISTORY.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ Shotgun Python API Changelog
44

55
Here you can see the full list of changes between each Python API release.
66

7+
v3.0.37
8+
=====================
9+
10+
- Proper support added for unicode and utf-8 string paths given to upload methods, and a sane error is raised when an unusable string encoding is used.
11+
- Adds support for querying preferences from Shotgun via the new preferences_read method.
12+
713
v3.0.36
814
=====================
915

tests/test_api.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,23 @@ def test_upload_download(self):
252252

253253
# Make sure that non-utf-8 encoded paths raise when they can't be
254254
# converted to utf-8.
255+
#
256+
# We need to touch the file we're going to test with first. We can't
257+
# bundle a file with this filename in the repo due to some pip install
258+
# problems on Windows. Note that the path below is utf-8 encoding of
259+
# what we'll eventually encode as shift-jis.
260+
file_path_s = os.path.join(this_dir, "./\xe3\x81\x94.shift-jis")
261+
file_path_u = file_path_s.decode("utf-8")
262+
if sys.platform.startswith("win"):
263+
fh = open(file_path_u, "w")
264+
else:
265+
fh = open(file_path_s, "w")
266+
267+
try:
268+
fh.write("This is just a test file with some random data in it.")
269+
finally:
270+
fh.close()
271+
255272
u_path = os.path.abspath(
256273
os.path.expanduser(
257274
glob.glob(os.path.join(unicode(this_dir), u'*.shift-jis'))[0]
@@ -278,6 +295,7 @@ def test_upload_download(self):
278295

279296
# cleanup
280297
os.remove(file_path)
298+
os.remove(u_path)
281299

282300
def test_upload_thumbnail_in_create(self):
283301
"""Upload a thumbnail via the create method"""

tests/ご.shift-jis

-11.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)