Skip to content

Commit 6ee290d

Browse files
committed
Fix tests running under Linux
1 parent dc5debe commit 6ee290d

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

webware/PSP/Tests/TestCompiler.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import unittest
1212

1313
from io import StringIO
14+
from time import sleep
1415

1516
from PSP import Context, PSPCompiler
1617

@@ -27,6 +28,15 @@ def tearDownClass(cls):
2728
sys.path.remove(cls.testDir)
2829
shutil.rmtree(cls.testDir)
2930

31+
@staticmethod
32+
def sync():
33+
"""Make sure everything is written to disk."""
34+
try:
35+
os.sync()
36+
except AttributeError:
37+
pass # not Unix
38+
sleep(0.05)
39+
3040
def compileString(self, pspSource, classname):
3141
"""Compile a string to an object.
3242
@@ -48,10 +58,7 @@ def compileString(self, pspSource, classname):
4858
context.setPythonFileName(tmpOutName)
4959
clc = PSPCompiler.Compiler(context)
5060
clc.compile()
51-
try:
52-
os.sync() # make sure the file is written
53-
except AttributeError:
54-
pass # if not under Unix
61+
self.sync()
5562
self.assertTrue(os.path.isfile(tmpOutName))
5663
# Have Python import the .py file.
5764
theModule = importlib.__import__(moduleName)

webware/Tests/TestSessions/TestSessionFileStore.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
class SessionFileStoreTest(TestSessionMemoryStore):
88

99
_storeClass = SessionFileStore
10+
_storeIsOrdered = False
1011

1112
def testMemoryStoreRestoreFiles(self):
1213
app = self._app

0 commit comments

Comments
 (0)