Skip to content

Commit

Permalink
Update setup dependencies and remove pinnings (#712)
Browse files Browse the repository at this point in the history
* setup: update dependencies and remove pinnings

* setup: add "testing" extras label to help with local testing

It's much easier to install test dependencies locally by doing
`pip install -e .[testing]` instead of having to manually copy and paste
the list from setup.py.
  • Loading branch information
danielkza authored and russellballestrini committed Mar 12, 2019
1 parent 3f97c9f commit c436eea
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ lint:
flake8 --require-code --min-version=2.7 --ignore FI50,FI51,FI53,FI14,E402,N802,W605 stacker/tests # ignore setUp naming

test-unit: clean
AWS_ACCESS_KEY_ID=x AWS_SECRET_ACCESS_KEY=x AWS_DEFAULT_REGION=us-east-1 python setup.py nosetests
python setup.py nosetests

test-unit3: clean
AWS_ACCESS_KEY_ID=x AWS_SECRET_ACCESS_KEY=x AWS_DEFAULT_REGION=us-east-1 python3 setup.py nosetests
python3 setup.py nosetests

clean:
rm -rf .egg stacker.egg-info
Expand Down
12 changes: 4 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@
install_requires = [
"future",
"troposphere>=1.9.0",
# pinning needed till https://github.com/spulec/moto/issues/1924 is
# resolved
"botocore<1.11.0",
"boto3>=1.7.0,<1.8.0",
"botocore",
"boto3>=1.9.111<2.0",
"PyYAML>=3.13b1",
"awacs>=0.6.0",
"gitpython>=2.0,<3.0",
Expand All @@ -23,11 +21,8 @@
]

tests_require = [
# pinning needed till https://github.com/spulec/moto/issues/1924 is
# resolved
"aws-xray-sdk==1.1.2",
"mock~=2.0.0",
"moto~=1.1.24",
"moto~=1.3.7",
"testfixtures~=4.10.0",
"coverage~=4.3.4",
"flake8-future-import",
Expand Down Expand Up @@ -64,6 +59,7 @@ def read(filename):
install_requires=install_requires,
tests_require=tests_require,
setup_requires=setup_requires,
extras_require=dict(testing=tests_require),
test_suite="nose.collector",
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down
34 changes: 34 additions & 0 deletions stacker/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
from __future__ import absolute_import, division, print_function

import logging
import os


logger = logging.getLogger(__name__)
_saved_env = {}


def setUpModule():
# Handle change in https://github.com/spulec/moto/issues/1924
# Ensure AWS SDK find some (bogus) credentials in the environment and
# doesn't try to use other providers
overrides = {
'AWS_ACCESS_KEY_ID': 'testing',
'AWS_SECRET_ACCESS_KEY': 'testing',
'AWS_DEFAULT_REGION': 'us-east-1'
}
for key, value in overrides.items():
logger.info('Overriding env var: {}={}'.format(key, value))
_saved_env[key] = os.environ.get(key, None)
os.environ[key] = value


def tearDownModule():
for key, value in _saved_env.items():
logger.info('Restoring saved env var: {}={}'.format(key, value))
if value is None:
del os.environ[key]
else:
os.environ[key] = value

_saved_env.clear()

0 comments on commit c436eea

Please sign in to comment.