MCPcopy Index your code
hub / github.com/python/cpython / setUp

Method setUp

Lib/test/test_httpservers.py:510–529  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

508 pass
509
510 def setUp(self):
511 super().setUp()
512 self.cwd = os.getcwd()
513 basetempdir = tempfile.gettempdir()
514 os.chdir(basetempdir)
515 self.data = b'We are the knights who say Ni!'
516 self.tempdir = tempfile.mkdtemp(dir=basetempdir)
517 self.tempdir_name = os.path.basename(self.tempdir)
518 self.base_url = '/' + self.tempdir_name
519 tempname = os.path.join(self.tempdir, 'test')
520 with open(tempname, 'wb') as temp:
521 temp.write(self.data)
522 temp.flush()
523 mtime = os.stat(tempname).st_mtime
524 # compute last modification datetime for browser cache tests
525 last_modif = datetime.datetime.fromtimestamp(mtime,
526 datetime.timezone.utc)
527 self.last_modif_datetime = last_modif.replace(microsecond=0)
528 self.last_modif_header = email.utils.formatdate(
529 last_modif.timestamp(), usegmt=True)
530
531 def tearDown(self):
532 try:

Callers

nothing calls this directly

Calls 12

superClass · 0.85
mkdtempMethod · 0.80
timestampMethod · 0.80
openFunction · 0.50
setUpMethod · 0.45
basenameMethod · 0.45
joinMethod · 0.45
writeMethod · 0.45
flushMethod · 0.45
statMethod · 0.45
fromtimestampMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected