Skip to content

Commit 93b6758

Browse files
wezFacebook Github Bot 5
authored andcommitted
watchman: fixup recent test tweaks for windows
Summary: Closes facebook#356 Reviewed By: sid0 fbshipit-source-id: 21223798900a435c90a8c148246d2f0877c46667
1 parent 39b814a commit 93b6758

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

runtests.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,10 @@ def runner():
297297
WatchmanInstance.setSharedInstance(inst)
298298
except Exception as e:
299299
print('while starting watchman: %s' % str(e))
300+
traceback.print_exc()
300301
broken = True
301302

302-
while True:
303+
while not broken:
303304
test = tests_queue.get()
304305
try:
305306
if test == 'terminate':
@@ -370,7 +371,7 @@ def queue_jobs(tests):
370371
tests_run, tests_failed, tests_skipped, args.concurrency))
371372

372373
if 'APPVEYOR' in os.environ:
373-
shutil.copytree(temp_dir, 'logs')
374+
shutil.copytree(temp_dir.get_dir(), 'logs')
374375
subprocess.call(['7z', 'a', 'logs.zip', 'logs'])
375376
subprocess.call(['appveyor', 'PushArtifact', 'logs.zip'])
376377

tests/integration/TempDir.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from __future__ import absolute_import
22
from __future__ import division
33
from __future__ import print_function
4-
from __future__ import unicode_literals
4+
# no unicode literals
55
import os
66
import shutil
77
import sys
@@ -42,9 +42,8 @@ def __init__(self, keepAtShutdown=False):
4242
else:
4343
prefix = 'watchmantest'
4444

45-
self.temp_dir = os.path.realpath(
46-
tempfile.mkdtemp(dir=parent_dir, prefix=prefix)
47-
)
45+
self.temp_dir = os.path.normcase(os.path.realpath(
46+
tempfile.mkdtemp(dir=parent_dir, prefix=prefix)))
4847
if os.name != 'nt':
4948
# On some platforms, setting the setgid bit on a directory doesn't
5049
# work if the user isn't a member of the directory's group. Set the

tests/integration/test_perms.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,17 @@
1919
import pywatchman
2020

2121

22+
def is_root():
23+
return hasattr(os, 'geteuid') and os.geteuid() == 0
24+
2225
@WatchmanTestCase.expand_matrix
2326
class TestPerms(WatchmanTestCase.WatchmanTestCase):
2427

2528
def checkOSApplicability(self):
2629
if os.name == 'nt':
2730
self.skipTest('N/A on Windows')
2831

29-
@unittest.skipIf(os.geteuid() == 0, "N/A if root")
32+
@unittest.skipIf(is_root(), "N/A if root")
3033
def test_permDeniedSubDir(self):
3134
root = self.mkdtemp()
3235
subdir = os.path.join(root, 'subdir')
@@ -40,7 +43,7 @@ def test_permDeniedSubDir(self):
4043
self.assertRegexpMatches(warning,
4144
'Marking this portion of the tree deleted')
4245

43-
@unittest.skipIf(os.geteuid() == 0, "N/A if root")
46+
@unittest.skipIf(is_root(), "N/A if root")
4447
def test_permDeniedRoot(self):
4548
root = self.mkdtemp()
4649
os.chmod(root, 0)

tests/integration/test_trigger_chdir.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ def fileHasValidJson(self, file_name):
3939
except Exception:
4040
return False
4141

42+
def checkOSApplicability(self):
43+
if os.name == 'nt':
44+
self.skipTest('no append on Windows')
45+
4246
def test_triggerChdir(self):
4347
root = self.mkdtemp()
4448
os.mkdir(os.path.join(root, 'sub'))

0 commit comments

Comments
 (0)