Fix #11939. Set st_dev attribute on Windows to simplify os.path.samef… · python/cpython@490b32a (original) (raw)
`@@ -186,63 +186,6 @@ def test_islink(self):
`
186
186
`if not f.close():
`
187
187
`f.close()
`
188
188
``
189
``
`-
@staticmethod
`
190
``
`-
def _create_file(filename):
`
191
``
`-
with open(filename, 'wb') as f:
`
192
``
`-
f.write(b'foo')
`
193
``
-
194
``
`-
def test_samefile(self):
`
195
``
`-
test_fn = support.TESTFN + "1"
`
196
``
`-
self._create_file(test_fn)
`
197
``
`-
self.assertTrue(posixpath.samefile(test_fn, test_fn))
`
198
``
`-
self.assertRaises(TypeError, posixpath.samefile)
`
199
``
-
200
``
`-
@unittest.skipIf(
`
201
``
`-
sys.platform.startswith('win'),
`
202
``
`-
"posixpath.samefile does not work on links in Windows")
`
203
``
`-
@unittest.skipUnless(hasattr(os, "symlink"),
`
204
``
`-
"Missing symlink implementation")
`
205
``
`-
def test_samefile_on_links(self):
`
206
``
`-
test_fn1 = support.TESTFN + "1"
`
207
``
`-
test_fn2 = support.TESTFN + "2"
`
208
``
`-
self._create_file(test_fn1)
`
209
``
-
210
``
`-
os.symlink(test_fn1, test_fn2)
`
211
``
`-
self.assertTrue(posixpath.samefile(test_fn1, test_fn2))
`
212
``
`-
os.remove(test_fn2)
`
213
``
-
214
``
`-
self._create_file(test_fn2)
`
215
``
`-
self.assertFalse(posixpath.samefile(test_fn1, test_fn2))
`
216
``
-
217
``
-
218
``
`-
def test_samestat(self):
`
219
``
`-
test_fn = support.TESTFN + "1"
`
220
``
`-
self._create_file(test_fn)
`
221
``
`-
test_fns = [test_fn]*2
`
222
``
`-
stats = map(os.stat, test_fns)
`
223
``
`-
self.assertTrue(posixpath.samestat(*stats))
`
224
``
-
225
``
`-
@unittest.skipIf(
`
226
``
`-
sys.platform.startswith('win'),
`
227
``
`-
"posixpath.samestat does not work on links in Windows")
`
228
``
`-
@unittest.skipUnless(hasattr(os, "symlink"),
`
229
``
`-
"Missing symlink implementation")
`
230
``
`-
def test_samestat_on_links(self):
`
231
``
`-
test_fn1 = support.TESTFN + "1"
`
232
``
`-
test_fn2 = support.TESTFN + "2"
`
233
``
`-
self._create_file(test_fn1)
`
234
``
`-
test_fns = (test_fn1, test_fn2)
`
235
``
`-
os.symlink(*test_fns)
`
236
``
`-
stats = map(os.stat, test_fns)
`
237
``
`-
self.assertTrue(posixpath.samestat(*stats))
`
238
``
`-
os.remove(test_fn2)
`
239
``
-
240
``
`-
self._create_file(test_fn2)
`
241
``
`-
stats = map(os.stat, test_fns)
`
242
``
`-
self.assertFalse(posixpath.samestat(*stats))
`
243
``
-
244
``
`-
self.assertRaises(TypeError, posixpath.samestat)
`
245
``
-
246
189
`def test_ismount(self):
`
247
190
`self.assertIs(posixpath.ismount("/"), True)
`
248
191
`with warnings.catch_warnings():
`
`@@ -518,11 +461,6 @@ def test_relpath_bytes(self):
`
518
461
`finally:
`
519
462
`os.getcwdb = real_getcwdb
`
520
463
``
521
``
`-
def test_sameopenfile(self):
`
522
``
`-
fname = support.TESTFN + "1"
`
523
``
`-
with open(fname, "wb") as a, open(fname, "wb") as b:
`
524
``
`-
self.assertTrue(posixpath.sameopenfile(a.fileno(), b.fileno()))
`
525
``
-
526
464
``
527
465
`class PosixCommonTest(test_genericpath.CommonTest):
`
528
466
`pathmodule = posixpath
`