MCPcopy Index your code
hub / github.com/RustPython/RustPython / setUp

Method setUp

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 12

superClass · 0.85
mkdtempMethod · 0.80
basenameMethod · 0.80
timestampMethod · 0.80
openFunction · 0.50
setUpMethod · 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