Skip to content

Commit

Permalink
Add CI for Python 2.7, 3.4, 3.5, 3.6 (#86)
Browse files Browse the repository at this point in the history
only manylinux builds are running all variants for now.

Also fix python 2
  • Loading branch information
graebm authored Oct 17, 2019
1 parent 72780d2 commit 3da3a7b
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 9 deletions.
24 changes: 23 additions & 1 deletion builder.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,29 @@
"variables": {
"openssl_include": "=/opt/openssl/include",
"openssl_lib": "=/opt/openssl/lib"
}
},
"post_build_steps": [
["echo", "------ Python 3.6 ------"],
["/opt/python/cp36-cp36m/bin/python", "setup.py", "--verbose", "build_ext", "--include-dirs{openssl_include}", "--library-dirs{openssl_lib}", "install"],
["/opt/python/cp36-cp36m/bin/python", "-m", "unittest", "discover", "--verbose"],
["/opt/python/cp37-cp37m/bin/python", "aws-c-http/integration-testing/http_client_test.py", "/opt/python/cp36-cp36m/bin/python", "elasticurl.py"],
["echo", "------ Python 3.5 ------"],
["/opt/python/cp35-cp35m/bin/python", "setup.py", "--verbose", "build_ext", "--include-dirs{openssl_include}", "--library-dirs{openssl_lib}", "install"],
["/opt/python/cp35-cp35m/bin/python", "-m", "unittest", "discover", "--verbose"],
["/opt/python/cp37-cp37m/bin/python", "aws-c-http/integration-testing/http_client_test.py", "/opt/python/cp35-cp35m/bin/python", "elasticurl.py"],
["echo", "------ Python 3.4 ------"],
["/opt/python/cp34-cp34m/bin/python", "setup.py", "--verbose", "build_ext", "--include-dirs{openssl_include}", "--library-dirs{openssl_lib}", "install"],
["/opt/python/cp34-cp34m/bin/python", "-m", "unittest", "discover", "--verbose"],
["/opt/python/cp37-cp37m/bin/python", "aws-c-http/integration-testing/http_client_test.py", "/opt/python/cp34-cp34m/bin/python", "elasticurl.py"],
["echo", "------ Python 2.7 narrow-unicode ------"],
["/opt/python/cp27-cp27m/bin/python", "setup.py", "--verbose", "build_ext", "--include-dirs{openssl_include}", "--library-dirs{openssl_lib}", "install"],
["/opt/python/cp27-cp27m/bin/python", "-m", "unittest", "discover", "--verbose"],
["/opt/python/cp37-cp37m/bin/python", "aws-c-http/integration-testing/http_client_test.py", "/opt/python/cp27-cp27m/bin/python", "elasticurl.py"],
["echo", "------ Python 2.7 wide-unicode ------"],
["/opt/python/cp27-cp27mu/bin/python", "setup.py", "--verbose", "build_ext", "--include-dirs{openssl_include}", "--library-dirs{openssl_lib}", "install"],
["/opt/python/cp27-cp27mu/bin/python", "-m", "unittest", "discover", "--verbose"],
["/opt/python/cp37-cp37m/bin/python", "aws-c-http/integration-testing/http_client_test.py", "/opt/python/cp27-cp27mu/bin/python", "elasticurl.py"]
]
}
},
"targets": {
Expand Down
3 changes: 2 additions & 1 deletion elasticurl.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@
# on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.
from __future__ import print_function
import argparse
import sys
import os
from io import BytesIO
from io import BytesIO, open # Python2's built-in open() doesn't return a stream
from awscrt import io, http
try:
from urllib.parse import urlparse
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.

from __future__ import print_function
import distutils.ccompiler
import glob
import os
Expand Down
24 changes: 17 additions & 7 deletions test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
# express or implied. See the License for the specific language governing
# permissions and limitations under the License.

from __future__ import print_function
from awscrt import NativeResource
import gc
import inspect
import sys
import types
import unittest
Expand Down Expand Up @@ -44,16 +46,24 @@ def tearDown(self):
# - the rest are what's causing this leak.
refcount = sys.getrefcount(i) - 2

# The act of iterating a WeakSet creates a reference. Don't show that.
referrers = gc.get_referrers(i)
for r in referrers:
if isinstance(r, types.FrameType) and '_weakrefset.py' in str(r):
referrers.remove(r)
break
# Gather list of referrers, but don't show those created by the act of iterating the WeakSet
referrers = []
for r in gc.get_referrers(i):
if isinstance(r, types.FrameType):
frameinfo = inspect.getframeinfo(r)
our_fault = (frameinfo.filename.endswith('_weakrefset.py') or
frameinfo.filename.endswith('test/__init__.py'))
if our_fault:
continue

referrers.append(r)

print(' sys.getrefcount():', refcount)
print(' gc.referrers():', len(referrers))
for r in referrers:
print(' -', r)
if isinstance(r, types.FrameType):
print(' -', inspect.getframeinfo(r))
else:
print(' -', r)

self.assertEqual(0, len(NativeResource._living))
1 change: 1 addition & 0 deletions test/test_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from awscrt.http import HttpClientConnection, HttpClientStream, HttpHeaders, HttpRequest
from awscrt.io import TlsContextOptions, ClientTlsContext, TlsConnectionOptions
from concurrent.futures import Future
from io import open # Python2's built-in open() doesn't return a stream
import ssl
from test import NativeResourceTest
import threading
Expand Down

0 comments on commit 3da3a7b

Please sign in to comment.