Skip to content

Commit 294ea9b

Browse files
committed
Fix start\end time strings
1 parent 1c97460 commit 294ea9b

File tree

3 files changed

+7
-21
lines changed

3 files changed

+7
-21
lines changed

graphql/execution/base.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -311,22 +311,6 @@ def __init__(self, field_name, field_asts, return_type, parent_type,
311311
self.context = context
312312
self.path = path
313313

314-
def clone(self):
315-
return ResolveInfo(
316-
field_name=self.field_name,
317-
field_asts=self.field_asts,
318-
return_type=self.return_type,
319-
parent_type=self.parent_type,
320-
schema=self.schema,
321-
fragments=self.fragments,
322-
root_value=self.root_value,
323-
operation=self.operation,
324-
variable_values=self.variable_values,
325-
context=self.context,
326-
path=self.path[:] if self.path else []
327-
)
328-
329-
330314

331315
def default_resolve_fn(source, info, **args):
332316
"""If a resolve function is not given, then a default resolve behavior is used which takes the property of the source object

graphql/execution/tests/test_tracing.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
import time
12

23
from graphql.execution import execute
4+
from graphql.execution.tracing import TracingMiddleware
35
from graphql.language.parser import parse
46
from graphql.type import (GraphQLArgument, GraphQLBoolean, GraphQLField,
57
GraphQLID, GraphQLInt, GraphQLList, GraphQLNonNull,
@@ -116,8 +118,8 @@ def __init__(self, uid, width, height):
116118

117119
assert result.extensions['tracing'] == {
118120
'version': 1,
119-
'startTime': '1970-01-01T00:00:00.fZ',
120-
'endTime': '1970-01-01T04:26:40.fZ',
121+
'startTime': time.strftime(TracingMiddleware.DATETIME_FORMAT, time.gmtime(0)),
122+
'endTime': time.strftime(TracingMiddleware.DATETIME_FORMAT, time.gmtime(16)),
121123
'duration': 16000,
122124
'execution': {
123125
'resolvers': [

graphql/execution/tracing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import time
2-
import datetime
2+
33

44
class TracingMiddleware(object):
55
DATETIME_FORMAT = '%Y-%m-%dT%H:%M:%S.%fZ'
@@ -17,11 +17,11 @@ def end(self):
1717

1818
@property
1919
def start_time_str(self):
20-
return time.strftime(self.DATETIME_FORMAT, time.gmtime(self.start_time))
20+
return time.strftime(self.DATETIME_FORMAT, time.gmtime(self.start_time/1000))
2121

2222
@property
2323
def end_time_str(self):
24-
return time.strftime(self.DATETIME_FORMAT, time.gmtime(self.end_time))
24+
return time.strftime(self.DATETIME_FORMAT, time.gmtime(self.end_time/1000))
2525

2626
@property
2727
def duration(self):

0 commit comments

Comments
 (0)