tychota / pyv8

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

Unit test failed with r253 #47

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Ubuntu 10.04 updated, PyV8 r253, V8 r4380

gauss@pmain:~/Projects/pyv8$ python PyV8.py
.....................Fhello world
..............
======================================================================
FAIL: testDate (__main__.TestWrapper)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "PyV8.py", line 1004, in testDate
    self.assert_(str(func(now)).startswith(now.strftime("%a %b %d %Y 
%H:%M:%S")))
AssertionError

----------------------------------------------------------------------
Ran 36 tests in 3.267s

FAILED (failures=1)

Original issue reported on code.google.com by gauss...@gmail.com on 10 Apr 2010 at 7:18

GoogleCodeExporter commented 9 years ago
Could verify with latest v8 and pyv8 SVN code, I can't reproduce it on Windows 
and 
Debian/Linux x86. 

Original comment by flier...@gmail.com on 11 Apr 2010 at 12:42

GoogleCodeExporter commented 9 years ago
Looks like a daylight saving time related problem. I've added:
print str(func(now)), str(now.strftime("%a %b %d %Y %H:%M:%S"))
before assertion and got this:

gauss@pmain:~/Projects/pyv8$ date
Вск Апр 11 19:08:05 MSD 2010

gauss@pmain:~/Projects/pyv8$ python PyV8.py
.....................Sun Apr 11 2010 20:08:54 GMT+0400 (MSD) Sun Apr 11 2010 
19:08:54
F..............
======================================================================
FAIL: testDate (__main__.TestWrapper)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "PyV8.py", line 1006, in testDate
    self.assert_(str(func(now)).startswith(now.strftime("%a %b %d %Y %H:%M:%S")))
AssertionError

----------------------------------------------------------------------
Ran 36 tests in 12.429s

FAILED (failures=1)

Original comment by gauss...@gmail.com on 11 Apr 2010 at 3:12

GoogleCodeExporter commented 9 years ago
Thanks for your feedback, I will study the daylight saving time more detail 
later :)

Original comment by flier...@gmail.com on 12 Apr 2010 at 1:37

GoogleCodeExporter commented 9 years ago
I have debug the issue on a debian 5, it seems v8 and python use different time 
zone, it is very strange, I need check their code for more detail. :S

Original comment by flier...@gmail.com on 17 Jun 2010 at 4:13

GoogleCodeExporter commented 9 years ago
import datetime
import PyV8

class Global(PyV8.JSClass):
    def now(self):
        return datetime.datetime.now()

ctx = PyV8.JSContext(Global())  # create another context with the global object
ctx.enter()
javascript_now = ctx.eval("new Date()")
javascript_global_now = ctx.eval("now()")
python_now = datetime.datetime.now()
print("javascript_global_now=%s" % javascript_global_now)
print("javascript_now=%s" % javascript_now)
print("python_now=%s" % python_now)

Outputs three different timezones on MacOSX:
javascript_global_now=2012-07-21 08:20:06.104000
javascript_now=2012-07-21 07:20:06.103000
python_now=2012-07-21 01:20:06.104915

Original comment by jasonxro...@gmail.com on 21 Jul 2012 at 7:21

GoogleCodeExporter commented 9 years ago
Same here with 

javascript_global_now=2012-08-27 08:15:01.376000
javascript_now=2012-08-27 07:15:01.376000
python_now=2012-08-27 09:15:01.376350

Python now is actually the correct time.

Distributor ID: Ubuntu
Description:    Ubuntu 12.04 LTS
Release:        12.04
Codename:       precise

Original comment by glas...@gmail.com on 27 Aug 2012 at 7:16

GoogleCodeExporter commented 9 years ago
force to use summer (i.e., Daylight Saving) time, contribute by
Russell

Original comment by flier...@gmail.com on 17 Apr 2013 at 4:38