Skip to content

Commit

Permalink
Merge pull request #84 from okigan/feature/conformant-main-method
Browse files Browse the repository at this point in the history
make main method more conformant
  • Loading branch information
okigan committed Dec 19, 2019
2 parents 1426201 + c63fd7b commit bcf66cb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pythonapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ jobs:
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest -v --cov=awscurl --cov-fail-under=80 --cov-report html --cov-report annotate
pytest -v --cov=awscurl --cov-fail-under=77 --cov-report html --cov-report annotate
- name: Test with tox
run: tox
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ env:
# command to run tests
script:
- pycodestyle -v awscurl
- pytest -v --cov=awscurl --cov-fail-under=80 --cov-report html --cov-report annotate
- pytest -v --cov=awscurl --cov-fail-under=77 --cov-report html --cov-report annotate

8 changes: 6 additions & 2 deletions awscurl/awscurl.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def load_aws_config(access_key, secret_key, security_token, credentials_path, pr
return access_key, secret_key, security_token


def main(argv):
def inner_main(argv):
"""
Awscurl CLI main entry point
"""
Expand Down Expand Up @@ -496,5 +496,9 @@ def main(argv):
return 0


def main():
inner_main(sys.argv[1:])


if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))
sys.exit(main())
2 changes: 1 addition & 1 deletion ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ pip install -r requirements-test.txt

pycodestyle -v awscurl

pytest -v --cov=awscurl --cov-fail-under=80 --cov-report html --cov-report annotate
pytest -v --cov=awscurl --cov-fail-under=77 --cov-report html --cov-report annotate
6 changes: 3 additions & 3 deletions tests/integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from mock import patch
from requests import HTTPError

from awscurl.awscurl import make_request, main
from awscurl.awscurl import make_request, inner_main

__author__ = 'iokulist'

Expand Down Expand Up @@ -106,8 +106,8 @@ def test_make_request(self, *args, **kvargs):
self.assertEqual(r.status_code, 200)


class TestMainMethod(TestCase):
class TestInnerMainMethod(TestCase):
maxDiff = None

with pytest.raises(HTTPError):
main(['--verbose', '--service', 's3', 'https://awscurl-sample-bucket.s3.amazonaws.com'])
inner_main(['--verbose', '--service', 's3', 'https://awscurl-sample-bucket.s3.amazonaws.com'])

0 comments on commit bcf66cb

Please sign in to comment.