From: Zooko O'Whielacronx Date: Fri, 27 Apr 2007 05:16:48 +0000 (-0700) Subject: make testutil more flexible about what platform it runs on X-Git-Tag: allmydata-tahoe_v0.1.1-1-UNSTABLE~9 X-Git-Url: https://git.rkrishnan.org/vdrive/components/com_hotproperty/css/?a=commitdiff_plain;h=5121a8d4a2cddf572151a539042add20bafeeb97;p=tahoe-lafs%2Ftahoe-lafs.git make testutil more flexible about what platform it runs on --- diff --git a/src/allmydata/util/testutil.py b/src/allmydata/util/testutil.py index ad19c25e..f3ec44ed 100644 --- a/src/allmydata/util/testutil.py +++ b/src/allmydata/util/testutil.py @@ -80,14 +80,14 @@ class TestMixin(SignalMixin): if required_to_quiesce and active: self.fail("Reactor was still active when it was required to be quiescent.") -if sys.platform == 'win32': +try: import win32file import win32con def make_readonly(path): win32file.SetFileAttributes(path, win32con.FILE_ATTRIBUTE_READONLY) def make_accessible(path): win32file.SetFileAttributes(path, win32con.FILE_ATTRIBUTE_NORMAL) -else: +except ImportError: import stat def make_readonly(path): os.chmod(path, stat.S_IREAD) @@ -95,4 +95,3 @@ else: def make_accessible(path): os.chmod(os.path.dirname(path), stat.S_IWRITE | stat.S_IEXEC | stat.S_IREAD) os.chmod(path, stat.S_IWRITE | stat.S_IEXEC | stat.S_IREAD) -