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

Method setUp

Lib/test/test_filecmp.py:25–43  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

23
24class FileCompareTestCase(unittest.TestCase):
25 def setUp(self):
26 self.name = os_helper.TESTFN
27 self.name_same = os_helper.TESTFN + '-same'
28 self.name_diff = os_helper.TESTFN + '-diff'
29 self.name_same_shallow = os_helper.TESTFN + '-same-shallow'
30 data = 'Contents of file go here.\n'
31 for name in [self.name, self.name_same, self.name_diff]:
32 with open(name, 'w', encoding="utf-8") as output:
33 output.write(data)
34
35 with open(self.name_diff, 'a+', encoding="utf-8") as output:
36 output.write('An extra line.\n')
37
38 for name in [self.name_same, self.name_diff]:
39 shutil.copystat(self.name, name)
40
41 _create_file_shallow_equal(self.name, self.name_same_shallow)
42
43 self.dir = tempfile.gettempdir()
44
45 def tearDown(self):
46 os.unlink(self.name)

Callers

nothing calls this directly

Calls 3

openFunction · 0.50
writeMethod · 0.45

Tested by

no test coverage detected