Skip to content

Commit

Permalink
Merge pull request #480 from jantman/test-fixes
Browse files Browse the repository at this point in the history
Switch from deprecated pep8 to pycodestyle; fix failing tests
  • Loading branch information
jantman committed Sep 17, 2020
2 parents bc32d6d + aa6e56e commit 743067a
Show file tree
Hide file tree
Showing 62 changed files with 306 additions and 244 deletions.
8 changes: 1 addition & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ sudo: false
cache: pip
matrix:
include:
- python: "2.7"
env: TOXENV=py27
- python: "3.4"
env: TOXENV=py34
- python: "3.5"
env: TOXENV=py35
- python: "3.6"
Expand All @@ -27,9 +23,7 @@ matrix:
- docker
- python: "3.8"
env: TOXENV=docs
- python: "2.7"
env: TOXENV=integration
- python: "3.7"
- python: "3.8"
env: TOXENV=integration3
install:
- git config --global user.email "travisci@jasonantman.com"
Expand Down
12 changes: 12 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
Changelog
=========

.. _changelog.8_1_0:

8.1.0 (2020-09-18)
------------------

* Internal testing changes:

* Stop testing under Python 2.7 and Python 3.4.
* Switch from deprecated pep8 / pytest-pep8 to pycodestyle / pytest-pycodestyle.
* Pin pytest to ``<6.0.0`` to avoid some breaking changes for now.
* Switch integration test environment from Python 3.7 to Python 3.8.

.. _changelog.8_0_2:

8.0.2 (2020-03-03)
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Requirements

**Either Docker in order to run via the** `docker image <http://awslimitchecker.readthedocs.io/en/latest/docker.html>`__, **or:**

* Python 3.5 or newer. Python 2.7 will not be supported as of January 1, 2020.
* Python 3.5 or newer.
* Python `VirtualEnv <http://www.virtualenv.org/>`_ and ``pip`` (recommended installation method; your OS/distribution should have packages for these)
* `boto3 <http://boto3.readthedocs.org/>`_ >= 1.4.6 and its dependency `botocore <https://botocore.readthedocs.io/en/latest/>`_ >= 1.6.0.

Expand Down
6 changes: 3 additions & 3 deletions awslimitchecker/limit.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,13 @@ def get_current_usage_str(self):
"<unknown>".
If the limit has only one current usage instance, this will be
that instance's :py:meth:`~.AwsLimitUsage.__str__` value.
that instance's ``AwsLimitUsage.__str__`` value.
If the limit has more than one current usage instance, this
will be the a string of the form ``max: X (Y)`` where ``X`` is
the :py:meth:`~.AwsLimitUsage.__str__` value of the instance
the ``AwsLimitUsage.__str__`` value of the instance
with the maximum value, and ``Y`` is a comma-separated list
of the :py:meth:`~.AwsLimitUsage.__str__` values of all usage
of the ``AwsLimitUsage.__str__`` values of all usage
instances in ascending order.
:returns: representation of current usage
Expand Down
6 changes: 4 additions & 2 deletions awslimitchecker/services/dynamodb.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ def _find_usage_dynamodb(self):
gsi_write += gsi['ProvisionedThroughput'][
'WriteCapacityUnits']
table_write_capacity = table.provisioned_throughput[
'WriteCapacityUnits'] + gsi_write
'WriteCapacityUnits'
] + gsi_write
table_read_capacity = table.provisioned_throughput[
'ReadCapacityUnits'] + gsi_read
'ReadCapacityUnits'
] + gsi_read
region_write_capacity += table_write_capacity
region_read_capacity += table_read_capacity

Expand Down
56 changes: 30 additions & 26 deletions awslimitchecker/services/ebs.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,32 +117,36 @@ def _find_usage_ebs(self):
piops,
aws_type='AWS::EC2::Volume'
)
self.limits['Provisioned IOPS (SSD) storage '
'(GiB)']._add_current_usage(
piops_gb,
aws_type='AWS::EC2::Volume'
)
self.limits['General Purpose (SSD) volume storage '
'(GiB)']._add_current_usage(
gp_gb,
aws_type='AWS::EC2::Volume'
)
self.limits['Magnetic volume storage '
'(GiB)']._add_current_usage(
mag_gb,
aws_type='AWS::EC2::Volume'
)
self.limits['Throughput Optimized (HDD) volume storage '
'(GiB)']._add_current_usage(
st_gb,
aws_type='AWS::EC2::Volume'
)
self.limits['Cold (HDD) volume storage '
'(GiB)']._add_current_usage(
sc_gb,
aws_type='AWS::EC2::Volume'
)

self.limits[
'Provisioned IOPS (SSD) storage (GiB)'
]._add_current_usage(
piops_gb,
aws_type='AWS::EC2::Volume'
)
self.limits[
'General Purpose (SSD) volume storage (GiB)'
]._add_current_usage(
gp_gb,
aws_type='AWS::EC2::Volume'
)
self.limits[
'Magnetic volume storage (GiB)'
]._add_current_usage(
mag_gb,
aws_type='AWS::EC2::Volume'
)
self.limits[
'Throughput Optimized (HDD) volume storage (GiB)'
]._add_current_usage(
st_gb,
aws_type='AWS::EC2::Volume'
)
self.limits[
'Cold (HDD) volume storage (GiB)'
]._add_current_usage(
sc_gb,
aws_type='AWS::EC2::Volume'
)
self.limits['Active volumes']._add_current_usage(
vols,
aws_type='AWS::EC2::Volume'
Expand Down
13 changes: 7 additions & 6 deletions awslimitchecker/services/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,12 +698,13 @@ def _find_usage_networking_eni_sg(self):
for iface in ints:
if iface.vpc is None:
continue
self.limits['VPC security groups per elastic network '
'interface']._add_current_usage(
len(iface.groups),
aws_type='AWS::EC2::NetworkInterface',
resource_id=iface.id,
)
self.limits[
'VPC security groups per elastic network interface'
]._add_current_usage(
len(iface.groups),
aws_type='AWS::EC2::NetworkInterface',
resource_id=iface.id,
)

def _get_limits_networking(self):
"""
Expand Down
21 changes: 14 additions & 7 deletions awslimitchecker/services/lambdafunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,11 @@ def find_usage(self):
logger.warn('Skipping Lambda: %s', str(ex))
return
self.limits['Function Count']._add_current_usage(
resp['AccountUsage']['FunctionCount'])
resp['AccountUsage']['FunctionCount']
)
self.limits['Total Code Size (MiB)']._add_current_usage(
int((resp['AccountUsage']['TotalCodeSize'])/1048576))
int((resp['AccountUsage']['TotalCodeSize']) / 1048576)
)
self._have_usage = True

def get_limits(self):
Expand Down Expand Up @@ -98,15 +100,20 @@ def _update_limits_from_api(self):
self.connect()
lims = self.conn.get_account_settings()['AccountLimit']
self.limits['Total Code Size (MiB)']._set_api_limit(
(lims['TotalCodeSize']/1048576))
(lims['TotalCodeSize'] / 1048576)
)
self.limits['Code Size Unzipped (MiB) per Function']._set_api_limit(
(lims['CodeSizeUnzipped']/1048576))
(lims['CodeSizeUnzipped'] / 1048576)
)
self.limits['Unreserved Concurrent Executions']._set_api_limit(
lims['UnreservedConcurrentExecutions'])
lims['UnreservedConcurrentExecutions']
)
self.limits['Concurrent Executions']._set_api_limit(
lims['ConcurrentExecutions'])
lims['ConcurrentExecutions']
)
self.limits['Code Size Zipped (MiB) per Function']._set_api_limit(
(lims['CodeSizeZipped']/1048576))
(lims['CodeSizeZipped'] / 1048576)
)

def _construct_limits(self):
self.limits = {}
Expand Down

0 comments on commit 743067a

Please sign in to comment.