Example #1
0
 def testCachedWrappers1(self):
     l1 = jscore._cachedStats()['wrappedJSObjsCount']
     obj2 = self.ctx.evaluateScript("({c: 3})")
     self.assertTrue(jscore._cachedStats()['wrappedJSObjsCount'] > l1)
     del obj2
     self.assertTrue(jscore._cachedStats()['wrappedJSObjsCount'] == l1)
Example #2
0
import sys
import os

baseDir = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
sys.path.insert(0, baseDir)

import unittest

import javascriptcore as jscore

import jsfrompy
import pyfromjs


_moduleSuites = [
    unittest.defaultTestLoader.loadTestsFromModule(jsfrompy),
    unittest.defaultTestLoader.loadTestsFromModule(pyfromjs),
    ]

mainSuite = unittest.TestSuite(_moduleSuites)
unittest.TextTestRunner(verbosity=2).run(mainSuite)

# These objects store intances of the test cases, we must delete them
# before...
del mainSuite
del _moduleSuites

# ... we can check that nothing is still hanging around in the cache.
assert jscore._cachedStats()['wrappedJSObjsCount'] == 0
assert jscore._cachedStats()['wrappedPyObjsCount'] == 0
Example #3
0
 def testCachedWrappers1(self):
     l1 = jscore._cachedStats()['wrappedJSObjsCount']
     obj2 = self.ctx.evaluateScript("({c: 3})")
     self.assertTrue(jscore._cachedStats()['wrappedJSObjsCount'] > l1)
     del obj2
     self.assertTrue(jscore._cachedStats()['wrappedJSObjsCount'] == l1)
Example #4
0
import sys
import os

baseDir = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
sys.path.insert(0, baseDir)

import unittest

import javascriptcore as jscore

import jsfrompy
import pyfromjs


_moduleSuites = [
    unittest.defaultTestLoader.loadTestsFromModule(jsfrompy),
    unittest.defaultTestLoader.loadTestsFromModule(pyfromjs),
]

mainSuite = unittest.TestSuite(_moduleSuites)
unittest.TextTestRunner(verbosity=2).run(mainSuite)

# These objects store intances of the test cases, we must delete them
# before...
del mainSuite
del _moduleSuites

# ... we can check that nothing is still hanging around in the cache.
assert jscore._cachedStats()["wrappedJSObjsCount"] == 0
assert jscore._cachedStats()["wrappedPyObjsCount"] == 0