mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
bpo-31066: Fix test_httpservers.test_last_modified() (#2933)
Write the temporary file on disk and then get its modification time.
This commit is contained in:
parent
cc42c121eb
commit
28ce07ae9e
1 changed files with 6 additions and 4 deletions
|
@ -335,9 +335,11 @@ class SimpleHTTPServerTestCase(BaseTestCase):
|
|||
self.tempdir = tempfile.mkdtemp(dir=basetempdir)
|
||||
self.tempdir_name = os.path.basename(self.tempdir)
|
||||
self.base_url = '/' + self.tempdir_name
|
||||
with open(os.path.join(self.tempdir, 'test'), 'wb') as temp:
|
||||
tempname = os.path.join(self.tempdir, 'test')
|
||||
with open(tempname, 'wb') as temp:
|
||||
temp.write(self.data)
|
||||
mtime = os.fstat(temp.fileno()).st_mtime
|
||||
temp.flush()
|
||||
mtime = os.stat(tempname).st_mtime
|
||||
# compute last modification datetime for browser cache tests
|
||||
last_modif = datetime.datetime.fromtimestamp(mtime,
|
||||
datetime.timezone.utc)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue