-
Notifications
You must be signed in to change notification settings - Fork 756
chore: Prevent test suite artifact creation in work directory #6438
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
Changes from all commits
bd4cb9a
adbdee1
02f1c5f
2c3ebaa
a291735
954a27a
a18c1f8
5afd314
53dadf1
68dd89a
b5cfb38
b6e933b
3a74f9a
18441d2
c258a59
5ae532c
43808a1
9c4712f
e9bc0ae
1f329bf
0c4b97a
85543c6
64a27f4
b0648c4
6261c7b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ | |
| import faker.config | ||
| import os | ||
| import random | ||
| import shutil | ||
| from PIL import Image | ||
|
|
||
| from unidecode import unidecode | ||
| from unicodedata import normalize | ||
|
|
@@ -103,10 +103,9 @@ def default_photo(obj, create, extracted, **kwargs): # pylint: disable=no-self-a | |
| media_name = "%s/%s.jpg" % (settings.PHOTOS_DIRNAME, photo_name) | ||
| obj.photo = media_name | ||
| obj.photo_thumb = media_name | ||
| photosrc = os.path.join(settings.TEST_DATA_DIR, "profile-default.jpg") | ||
| photodst = os.path.join(settings.PHOTOS_DIR, photo_name + '.jpg') | ||
| if not os.path.exists(photodst): | ||
| shutil.copy(photosrc, photodst) | ||
| img = Image.new('RGB', (200, 200)) | ||
| img.save(photodst) | ||
|
Comment on lines
+107
to
+108
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remind me why we're not just making a copy of the profile-default.jpg again?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's just avoiding a file that (as far as I can tell) exists only for the tests. I don't have an opinion one way or the other, but maybe there's a lighter weight library for generating an empty image for testing.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's PyPNG - much smaller it seems, but requires less clearly intentioned code to generate a blank image and is somewhat slower on a per-image basis. The import of PIL on my system looks to be a few tens of ms - and I think we probably only hit that once per test run. (Though I haven't actually done a profile to see if the import is being exercised more than once; not sure how to do that)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I suspect there's a valid, small, literal we can use as a PNG, but not going to slow this down over it.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We use PIL for resizing images in Checked and PyPNG is a < 40kb python file. It can read and write PNGs, so if we do need to create one for some reason, it's a pretty minimal bit of baggage. |
||
| def delete_file(file): | ||
| os.unlink(file) | ||
| atexit.register(delete_file, photodst) | ||
|
|
||
This file was deleted.
|
rjsparks marked this conversation as resolved.
|
Uh oh!
There was an error while loading. Please reload this page.