ironm73 / pyv8

Automatically exported from code.google.com/p/pyv8
0 stars 0 forks source link

test fails after running them twice in a row #53

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I don't know if this should be considered an issue. I have edited unittest.py 
in order to run the tests more than once in the same Python instance.

What steps will reproduce the problem?
1. Open %your_path_to_python_lib%/unittest.py in your editor
2. Comment all the "sys.exit(...)" you find (there are 2 in mine)
3. Open a Python shell and run:
import PyV8
import unittest
unittest.main(PyV8)
unittest.main(PyV8)

What is the expected output? What do you see instead?
The first "unittest.main(PyV8)" returns:
----------------------------------------------------------------------
Ran 38 tests in 2.902s

OK

The second time, I get:
EF...E......F.........................
======================================================================
ERROR: testMultiNamespace (pyv8.PyV8.TestContext)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "pyv8\PyV8.py", line 548, in testMultiNamespace
    self.assert_(not bool(JSContext.entered))
JSError: JSError: <HandleScope::HandleScope> Entering the V8 API without proper 
locking in place

======================================================================
ERROR: testExtension (pyv8.PyV8.TestEngine)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "pyv8\PyV8.py", line 1371, in testExtension
    self.assertRaises(JSError, ctxt.eval, "hello('flier')")
  File "pyv8\PyV8.py", line 467, in __exit__
    self.leave()
JSError: JSError: <v8::Context::Exit()> Cannot exit non-entered context

======================================================================
FAIL: testEventDispatch (pyv8.PyV8.TestDebug)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "pyv8\PyV8.py", line 1531, in testEventDispatch
    self.assertEquals(4, len(self.events))
AssertionError: 4 != 8

======================================================================
FAIL: testLocker (pyv8.PyV8.TestMutithread)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "pyv8\PyV8.py", line 1182, in testLocker
    self.assertFalse(JSLocker.actived)
AssertionError

----------------------------------------------------------------------
Ran 38 tests in 2.792s

FAILED (failures=2, errors=2)

What version of the product are you using? On what operating system?
OS: Windows Vista
Python 2.6.4
Boost 1_42_0
V8 2.2.19
PyV8 Trunk (rev 269)

Please provide any additional information below.

Again, I don't know if this should be taken seriously, maybe a testcase is not 
meant to be run twice and is leaving a JSContext "entered". Thanks.

Original issue reported on code.google.com by mmuradas...@gtempaccount.com on 23 Jun 2010 at 11:06

GoogleCodeExporter commented 9 years ago
I will check the #1 and #2 issue, it seems there are some contexts was leaked.

The #3 is OK, because TestDebug.events is a class field, I could change it to a 
object field.
The #4 is OK, because the lock only could be enable once, and can't be disabled 
again.

Thanks

Original comment by flier...@gmail.com on 24 Jun 2010 at 1:37