twisted / twisted/twisted

asyncio reactor callLater() 's DelayedCall returns time not relevant to epoch

Open
#8,886 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

core enhancement new priority-normal
Dominant language
Python
Stars
6k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
10

Description

rodrigc's avatar @rodrigc reported
Trac ID trac#8886
Type enhancement
Created 2016-11-01 00:09:44Z

When testing the SIP protocol on Python 3,
I found that if I did:

env TWISTED_REACTOR=asyncio python -m tox -r -e py36-alldeps-nocov-posix twisted.test.test_sip.RegistrationTests.testRegister

I got:

[FAIL]
Traceback (most recent call last):
  File "/Users/crodrigues/twisted8/build/py36-alldeps-nocov-posix/lib/python3.6/site-packages/twisted/test/test_sip.py", line 608, in testRegister
    int(m.headers["expires"][0]) in (3600, 3601, 3599, 3598))
  File "/Users/crodrigues/twisted8/build/py36-alldeps-nocov-posix/lib/python3.6/site-packages/twisted/trial/_synctest.py", line 388, in assertTrue
    super(_Assertions, self).assertTrue(condition, msg)
  File "/usr/local/Cellar/python3/HEAD-42a10253d066_1/Frameworks/Python.framework/Versions/3.6/lib/python3.6/unittest/case.py", line 677, in assertTrue
    raise self.failureException(msg)
twisted.trial.unittest.FailTest: False is not true

twisted.test.test_sip.RegistrationTests.testRegister

It seems that the asyncio reactor's callLater() method
returns a DelayedCall, and the getTime() method on this object is
returning a timestamp that is not relevant to the epoch.

This causes this test to fail.

Searchable metadata
trac-id__8886 8886
type__enhancement enhancement
reporter__rodrigc rodrigc
priority__normal normal
milestone__Python_3_x Python-3.x
branch__ 
branch_author__ 
status__new new
resolution__None None
component__core core
keywords__None None
time__1477958984433692 1477958984433692
changetime__1477958984433692 1477958984433692
version__None None
owner__None None

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with twisted.test.test_sip.RegistrationTests.testRegister and the asyncio reactor's callLater() and DelayedCall behavior. Reproduce the failure with the provided tox command, then verify that DelayedCall.getTime() is epoch-relevant and that the SIP registration test passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, networking
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.