mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
Renamed file variable
This commit is contained in:
parent
95f77ef54a
commit
525eaf7389
|
@ -12,11 +12,11 @@ YA_EXTRA_DIR = "Tests/images/msp"
|
|||
class TestFileMsp(PillowTestCase):
|
||||
|
||||
def test_sanity(self):
|
||||
file = self.tempfile("temp.msp")
|
||||
test_file = self.tempfile("temp.msp")
|
||||
|
||||
hopper("1").save(file)
|
||||
hopper("1").save(test_file)
|
||||
|
||||
im = Image.open(file)
|
||||
im = Image.open(test_file)
|
||||
im.load()
|
||||
self.assertEqual(im.mode, "1")
|
||||
self.assertEqual(im.size, (128, 128))
|
||||
|
|
|
@ -604,16 +604,16 @@ def _save_netpbm(im, fp, filename):
|
|||
|
||||
import os
|
||||
from subprocess import Popen, check_call, PIPE, CalledProcessError
|
||||
file = im._dump()
|
||||
tempfile = im._dump()
|
||||
|
||||
with open(filename, 'wb') as f:
|
||||
if im.mode != "RGB":
|
||||
with open(os.devnull, 'wb') as devnull:
|
||||
check_call(["ppmtogif", file], stdout=f, stderr=devnull)
|
||||
check_call(["ppmtogif", tempfile], stdout=f, stderr=devnull)
|
||||
else:
|
||||
# Pipe ppmquant output into ppmtogif
|
||||
# "ppmquant 256 %s | ppmtogif > %s" % (file, filename)
|
||||
quant_cmd = ["ppmquant", "256", file]
|
||||
# "ppmquant 256 %s | ppmtogif > %s" % (tempfile, filename)
|
||||
quant_cmd = ["ppmquant", "256", tempfile]
|
||||
togif_cmd = ["ppmtogif"]
|
||||
with open(os.devnull, 'wb') as devnull:
|
||||
quant_proc = Popen(quant_cmd, stdout=PIPE, stderr=devnull)
|
||||
|
@ -632,7 +632,7 @@ def _save_netpbm(im, fp, filename):
|
|||
raise CalledProcessError(retcode, togif_cmd)
|
||||
|
||||
try:
|
||||
os.unlink(file)
|
||||
os.unlink(tempfile)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user