<feed xmlns='http://www.w3.org/2005/Atom'>
<title>delta/python-packages/eventlet.git/tests, branch pull-331</title>
<subtitle>github.com: eventlet/eventlet.git
</subtitle>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/eventlet.git/'/>
<entry>
<title>websocket: support Gunicorn environ['gunicorn.socket']</title>
<updated>2016-07-06T13:53:53+00:00</updated>
<author>
<name>catroot</name>
<email>andrey@ledovskikh.ru</email>
</author>
<published>2016-07-04T19:00:53+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/eventlet.git/commit/?id=6de8d478ca2ee152e1c28d37b1c91b15a6717faf'/>
<id>6de8d478ca2ee152e1c28d37b1c91b15a6717faf</id>
<content type='text'>
Now you able to upgrade connection with eventlet.websocket.WebSocketsWSGI when app runs under `gunicorn application:app -k eventlet`

https://github.com/eventlet/eventlet/pull/331
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now you able to upgrade connection with eventlet.websocket.WebSocketsWSGI when app runs under `gunicorn application:app -k eventlet`

https://github.com/eventlet/eventlet/pull/331
</pre>
</div>
</content>
</entry>
<entry>
<title>greenio: only trampoline when we block</title>
<updated>2016-07-01T09:29:16+00:00</updated>
<author>
<name>David Szotten</name>
<email>davidszotten@gmail.com</email>
</author>
<published>2016-07-01T09:29:16+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/eventlet.git/commit/?id=863a1b7605b5c90ba470e597666c61a3261b706c'/>
<id>863a1b7605b5c90ba470e597666c61a3261b706c</id>
<content type='text'>
https://github.com/eventlet/eventlet/pull/314</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
https://github.com/eventlet/eventlet/pull/314</pre>
</div>
</content>
</entry>
<entry>
<title>tests: clean out unittest.main()</title>
<updated>2016-06-01T13:00:20+00:00</updated>
<author>
<name>Sergey Shepelev</name>
<email>temotor@gmail.com</email>
</author>
<published>2016-06-01T13:00:20+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/eventlet.git/commit/?id=41bbe278d6ab1eaf52e4d7af3a01a4053fc6e2b1'/>
<id>41bbe278d6ab1eaf52e4d7af3a01a4053fc6e2b1</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>socket: family kwarg name compatibility</title>
<updated>2016-05-24T08:03:04+00:00</updated>
<author>
<name>Sergey Shepelev</name>
<email>temotor@gmail.com</email>
</author>
<published>2016-05-24T07:59:47+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/eventlet.git/commit/?id=d0837ba1cf8324d678b54567a7570421b7ede18c'/>
<id>d0837ba1cf8324d678b54567a7570421b7ede18c</id>
<content type='text'>
GreenSocket was (family_or_realsock=AF_INET, ...) which breaks code like socket(family=...)
https://github.com/eventlet/eventlet/issues/319
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
GreenSocket was (family_or_realsock=AF_INET, ...) which breaks code like socket(family=...)
https://github.com/eventlet/eventlet/issues/319
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove select.poll and improve subprocess</title>
<updated>2016-05-20T08:23:36+00:00</updated>
<author>
<name>Jakub Stasiak</name>
<email>jakub@stasiak.at</email>
</author>
<published>2016-05-20T08:23:36+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/eventlet.git/commit/?id=614a20462aebfe85a54ce35a7daaf1a7dbde44a7'/>
<id>614a20462aebfe85a54ce35a7daaf1a7dbde44a7</id>
<content type='text'>
green select: Delete unpatched poll once again

https://github.com/eventlet/eventlet/pull/317

Previously attempted in f63165c, had to be reverted in 8ea9df6 because
subprocess was failing after monkey patching.

Turns out we haven't been monkey patching the subprocess module at all,
this patch adds that in order for the tests to pass.

This part is changed because otherwise Popen class instantiation would
cause an infinite loop when monkey patching is applied:

    -subprocess_orig = __import__("subprocess")
    +subprocess_orig = patcher.original("subprocess")

This patch is contributed by Smarkets Limited.

* green subprocess: Provide green check_output

This patch is contributed by Smarkets Limited.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
green select: Delete unpatched poll once again

https://github.com/eventlet/eventlet/pull/317

Previously attempted in f63165c, had to be reverted in 8ea9df6 because
subprocess was failing after monkey patching.

Turns out we haven't been monkey patching the subprocess module at all,
this patch adds that in order for the tests to pass.

This part is changed because otherwise Popen class instantiation would
cause an infinite loop when monkey patching is applied:

    -subprocess_orig = __import__("subprocess")
    +subprocess_orig = patcher.original("subprocess")

This patch is contributed by Smarkets Limited.

* green subprocess: Provide green check_output

This patch is contributed by Smarkets Limited.
</pre>
</div>
</content>
</entry>
<entry>
<title>greendns tests: Work around patcher/green package weirdness</title>
<updated>2016-05-18T13:14:07+00:00</updated>
<author>
<name>Jakub Stasiak</name>
<email>jakub.stasiak@smarkets.com</email>
</author>
<published>2016-05-18T12:13:09+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/eventlet.git/commit/?id=e3e6789a40191613e48561fe10948e74240ab04a'/>
<id>e3e6789a40191613e48561fe10948e74240ab04a</id>
<content type='text'>
The issue can be demonstrated by running the following piece of code:

    # t.py
    from __future__ import print_function

    from eventlet.support import greendns

    import sys
    if sys.argv[1] == 'yes':
        import dns.resolver

    print(sys.argv[1], issubclass(greendns.HostsAnswer, greendns.dns.resolver.Answer))

The results:

    # Python 2.7.11
    % python t.py yes
    yes False
    % python t.py no
    no True

    # Python 3.5.1
    % python t.py yes
    yes False
    % python t.py no
    no True

Interestingly enough this particular test issue was only affecting Python
3.5+ before 861d684. Why?

* This issue appears to be caused by importing green version of a package
  being followed by importing a non-green version of the same package
* When we run tests using nose it first imports the main tests module
  (tests/__init__.py) which imports eventlet, that imports
  eventlet.convenience and that then imports eventlet.green.sockt.
* Before 861d684 on Python &lt; 3.5 the eventlet.green.socket import mentioned
  above would fail to import greendns (because of an import cycle) so when
  running those tests greendns was only being correctly imported *after* the
  regular dns
* Since 861d684 (or on Python 3.5+) the green socket module correctly
  imports greendns which means that when the regular dns subpackages are
  being imported in this test file greendns is already imported and the
  patching issue demonstrated by the code above is in effect

The patching/greening weirdness is reported[1] now.

Fixes https://github.com/eventlet/eventlet/issues/267

This patch is contributed by Smarkets Limited.

[1] https://github.com/eventlet/eventlet/issues/316
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The issue can be demonstrated by running the following piece of code:

    # t.py
    from __future__ import print_function

    from eventlet.support import greendns

    import sys
    if sys.argv[1] == 'yes':
        import dns.resolver

    print(sys.argv[1], issubclass(greendns.HostsAnswer, greendns.dns.resolver.Answer))

The results:

    # Python 2.7.11
    % python t.py yes
    yes False
    % python t.py no
    no True

    # Python 3.5.1
    % python t.py yes
    yes False
    % python t.py no
    no True

Interestingly enough this particular test issue was only affecting Python
3.5+ before 861d684. Why?

* This issue appears to be caused by importing green version of a package
  being followed by importing a non-green version of the same package
* When we run tests using nose it first imports the main tests module
  (tests/__init__.py) which imports eventlet, that imports
  eventlet.convenience and that then imports eventlet.green.sockt.
* Before 861d684 on Python &lt; 3.5 the eventlet.green.socket import mentioned
  above would fail to import greendns (because of an import cycle) so when
  running those tests greendns was only being correctly imported *after* the
  regular dns
* Since 861d684 (or on Python 3.5+) the green socket module correctly
  imports greendns which means that when the regular dns subpackages are
  being imported in this test file greendns is already imported and the
  patching issue demonstrated by the code above is in effect

The patching/greening weirdness is reported[1] now.

Fixes https://github.com/eventlet/eventlet/issues/267

This patch is contributed by Smarkets Limited.

[1] https://github.com/eventlet/eventlet/issues/316
</pre>
</div>
</content>
</entry>
<entry>
<title>socket: Actually provide non-blocking DNS methods</title>
<updated>2016-05-18T12:24:10+00:00</updated>
<author>
<name>Jakub Stasiak</name>
<email>jakub.stasiak@smarkets.com</email>
</author>
<published>2016-05-17T19:16:58+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/eventlet.git/commit/?id=861d68439949b1f514ab9bbb53958a4592944c4a'/>
<id>861d68439949b1f514ab9bbb53958a4592944c4a</id>
<content type='text'>
The green socket module seemed to have only blocking DNS resolution
methods even with dnspython installed which is inconsistent with the
documentation.

This patch has a few consequences:

* an import cycle is eliminated
* if an import cycle reappears here it'll be visible

Note: eliminating the import cycle revealed an issue related to monkey
patching and the way we perform greendns tests (the test failures were
already present on Python 3.5[1] as that version has some import cycle
handling changes). The failures look like this:

======================================================================
FAIL: test_query_ans_types (tests.greendns_test.TestHostsResolver)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/kuba/projects/eventlet/tests/greendns_test.py", line 97, in test_query_ans_types
    assert isinstance(ans, greendns.dns.resolver.Answer)
AssertionError

======================================================================
FAIL: test_query_unknown_no_raise (tests.greendns_test.TestHostsResolver)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/kuba/projects/eventlet/tests/greendns_test.py", line 129, in test_query_unknown_no_raise
    assert isinstance(ans, greendns.dns.resolver.Answer)
AssertionError

This issue will be addressed in a separate commit.

This patch is contributed by Smarkets Limited.

[1] https://github.com/eventlet/eventlet/issues/267
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The green socket module seemed to have only blocking DNS resolution
methods even with dnspython installed which is inconsistent with the
documentation.

This patch has a few consequences:

* an import cycle is eliminated
* if an import cycle reappears here it'll be visible

Note: eliminating the import cycle revealed an issue related to monkey
patching and the way we perform greendns tests (the test failures were
already present on Python 3.5[1] as that version has some import cycle
handling changes). The failures look like this:

======================================================================
FAIL: test_query_ans_types (tests.greendns_test.TestHostsResolver)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/kuba/projects/eventlet/tests/greendns_test.py", line 97, in test_query_ans_types
    assert isinstance(ans, greendns.dns.resolver.Answer)
AssertionError

======================================================================
FAIL: test_query_unknown_no_raise (tests.greendns_test.TestHostsResolver)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/kuba/projects/eventlet/tests/greendns_test.py", line 129, in test_query_unknown_no_raise
    assert isinstance(ans, greendns.dns.resolver.Answer)
AssertionError

This issue will be addressed in a separate commit.

This patch is contributed by Smarkets Limited.

[1] https://github.com/eventlet/eventlet/issues/267
</pre>
</div>
</content>
</entry>
<entry>
<title>tests: Make greendns tests less repetitive</title>
<updated>2016-05-18T12:23:52+00:00</updated>
<author>
<name>Jakub Stasiak</name>
<email>jakub.stasiak@smarkets.com</email>
</author>
<published>2016-05-17T18:56:59+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/eventlet.git/commit/?id=edd8cfa417d54b9b33a3a3a98f29e3d4147815d1'/>
<id>edd8cfa417d54b9b33a3a3a98f29e3d4147815d1</id>
<content type='text'>
This patch is contributed by Smarkets Limited.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This patch is contributed by Smarkets Limited.
</pre>
</div>
</content>
</entry>
<entry>
<title>green.urllib2: missing patched ssl module</title>
<updated>2016-04-22T04:33:10+00:00</updated>
<author>
<name>Collin RM Stocks</name>
<email>collinstocks@gmail.com</email>
</author>
<published>2016-04-22T04:32:17+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/eventlet.git/commit/?id=869432f9ab4772da2d728733838744244402ed13'/>
<id>869432f9ab4772da2d728733838744244402ed13</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>patcher: patch existing threading locks; Thanks to Alexis Lee</title>
<updated>2016-04-18T20:07:00+00:00</updated>
<author>
<name>Alexis Lee</name>
<email>github@lxsli.co.uk</email>
</author>
<published>2016-04-18T20:07:00+00:00</published>
<link rel='alternate' type='text/html' href='http://91.123.203.49/cgit/delta/python-packages/eventlet.git/commit/?id=bbeaa2e3a0b6da26af08f5e6734767e04c187c5b'/>
<id>bbeaa2e3a0b6da26af08f5e6734767e04c187c5b</id>
<content type='text'>
In projects which dynamically determine whether to activate eventlet,
it can be hard not to import a low level module like logging before
eventlet. When logging is imported it initialises a threading.RLock
which it uses to protect the logging configuration. If two
greenthreads attempt to claim this lock, the second one will block the
/native/ thread not just itself. As green systems usually only have
one native thread, this will freeze the whole system.

Search the GC for unsafe RLocks and replace their internal Lock with a
safe one while monkey-patching.

The tests pass, but were they to fail, the test process would never
return. To deal with this, I've added a test dependency on
subprocess32 which is a backport of the stdlib subprocess module from
Python3. This offers a timeout option on Popen#communicate, which I've
arbitrarily set at 30 seconds.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
In projects which dynamically determine whether to activate eventlet,
it can be hard not to import a low level module like logging before
eventlet. When logging is imported it initialises a threading.RLock
which it uses to protect the logging configuration. If two
greenthreads attempt to claim this lock, the second one will block the
/native/ thread not just itself. As green systems usually only have
one native thread, this will freeze the whole system.

Search the GC for unsafe RLocks and replace their internal Lock with a
safe one while monkey-patching.

The tests pass, but were they to fail, the test process would never
return. To deal with this, I've added a test dependency on
subprocess32 which is a backport of the stdlib subprocess module from
Python3. This offers a timeout option on Popen#communicate, which I've
arbitrarily set at 30 seconds.</pre>
</div>
</content>
</entry>
</feed>
