Skip to content

Commit

Permalink
Fixed Flake8 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
wjdecorte committed Aug 13, 2019
1 parent 7580b23 commit 83c90c3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
8 changes: 3 additions & 5 deletions pydruid/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import re

from six.moves import urllib
from pydruid.query import QueryBuilder
from base64 import b64encode

if sys.version_info.major == 2 and sys.version_info.minor == 7:
import StringIO
Expand All @@ -36,11 +38,7 @@ def decompress(data):


else:
from gzip import compress, decompress

from pydruid.query import QueryBuilder
from base64 import b64encode

from gzip import decompress

# extract error from the <PRE> tag inside the HTML response
HTML_ERROR = re.compile("<pre>\\s*(.*?)\\s*</pre>", re.IGNORECASE)
Expand Down
14 changes: 9 additions & 5 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def compress(data):


else:
from gzip import compress, decompress
from gzip import compress


def create_client(headers=None):
Expand Down Expand Up @@ -76,8 +76,10 @@ def test_druid_returns_html_error(self, mock_urlopen):
<body>
<h2>HTTP ERROR: 500</h2>
<p>Problem accessing /druid/v2/. Reason:
<pre> javax.servlet.ServletException: java.lang.OutOfMemoryError: GC overhead limit exceeded</pre></p>
<hr /><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.3.19.v20170502</a><hr/>
<pre> javax.servlet.ServletException: java.lang.OutOfMemoryError: GC
overhead limit exceeded</pre></p>
<hr /><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.3.19.v20170502
</a><hr/>
</body>
</html>
"""
Expand All @@ -104,7 +106,8 @@ def test_druid_returns_html_error(self, mock_urlopen):
== textwrap.dedent(
"""
HTTP Error 500: Internal Server Error
Druid Error: javax.servlet.ServletException: java.lang.OutOfMemoryError: GC overhead limit exceeded
Druid Error: javax.servlet.ServletException: java.lang.OutOfMemoryError: GC
overhead limit exceeded
Query is: {
"aggregations": [
{
Expand Down Expand Up @@ -201,7 +204,8 @@ def test_client_allows_to_export_last_query(self, mock_urlopen):
)

# when / then
# assert that last_query.export_tsv method was called (it should throw an exception, given empty path)
# assert that last_query.export_tsv method was called (it should throw an
# exception, given empty path)
with pytest.raises(TypeError):
client.export_tsv(None)

Expand Down

0 comments on commit 83c90c3

Please sign in to comment.