summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_glob.py
diff options
context:
space:
mode:
authorBrian Curtin <brian.curtin@gmail.com>2010-07-08 21:39:08 (GMT)
committerBrian Curtin <brian.curtin@gmail.com>2010-07-08 21:39:08 (GMT)
commitd40e6f70a5edabffcbfff22912163520da3a29e2 (patch)
treeef8d44ca974bf606f3437d2ce9977207b8748174 /Lib/test/test_glob.py
parent0dd8f7890a3396eaef8c740588c65af9422a65a5 (diff)
downloadcpython-d40e6f70a5edabffcbfff22912163520da3a29e2.zip
cpython-d40e6f70a5edabffcbfff22912163520da3a29e2.tar.gz
cpython-d40e6f70a5edabffcbfff22912163520da3a29e2.tar.bz2
Implement #1578269. Patch by Jason R. Coombs.
Added Windows support for os.symlink when run on Windows 6.0 or greater, aka Vista. Previous Windows versions will raise NotImplementedError when trying to symlink. Includes numerous test updates and additions to test_os, including a symlink_support module because of the fact that privilege escalation is required in order to run the tests to ensure that the user is able to create symlinks. By default, accounts do not have the required privilege, so the escalation code will have to be exposed later (or documented on how to do so). I'll be following up with that work next. Note that the tests use ctypes, which was agreed on during the PyCon language summit.
Diffstat (limited to 'Lib/test/test_glob.py')
-rw-r--r--Lib/test/test_glob.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/test/test_glob.py b/Lib/test/test_glob.py
index 5a3be94..05e29b5 100644
--- a/Lib/test/test_glob.py
+++ b/Lib/test/test_glob.py
@@ -1,5 +1,5 @@
import unittest
-from test.support import run_unittest, TESTFN
+from test.support import run_unittest, TESTFN, skip_unless_symlink, can_symlink
import glob
import os
import shutil
@@ -25,7 +25,7 @@ class GlobTests(unittest.TestCase):
self.mktemp('ZZZ')
self.mktemp('a', 'bcd', 'EF')
self.mktemp('a', 'bcd', 'efg', 'ha')
- if hasattr(os, 'symlink'):
+ if can_symlink():
os.symlink(self.norm('broken'), self.norm('sym1'))
os.symlink(self.norm('broken'), self.norm('sym2'))
@@ -98,12 +98,12 @@ class GlobTests(unittest.TestCase):
# either of these results are reasonable
self.assertIn(res[0], [self.tempdir, self.tempdir + os.sep])
+ @skip_unless_symlink
def test_glob_broken_symlinks(self):
- if hasattr(os, 'symlink'):
- eq = self.assertSequencesEqual_noorder
- eq(self.glob('sym*'), [self.norm('sym1'), self.norm('sym2')])
- eq(self.glob('sym1'), [self.norm('sym1')])
- eq(self.glob('sym2'), [self.norm('sym2')])
+ eq = self.assertSequencesEqual_noorder
+ eq(self.glob('sym*'), [self.norm('sym1'), self.norm('sym2')])
+ eq(self.glob('sym1'), [self.norm('sym1')])
+ eq(self.glob('sym2'), [self.norm('sym2')])
def test_main():