From 3d6510555d1f913f3ce11bc872a28ca095aa10ba Mon Sep 17 00:00:00 2001 From: Hugo Date: Sat, 20 Oct 2018 15:50:55 +0300 Subject: [PATCH 01/27] Fix filename --- test/{test_lisence.py => test_license.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/{test_lisence.py => test_license.py} (100%) diff --git a/test/test_lisence.py b/test/test_license.py similarity index 100% rename from test/test_lisence.py rename to test/test_license.py From e9f58e39b93941a5cabc9b822a5d8fe28bfb415c Mon Sep 17 00:00:00 2001 From: Hugo Date: Sat, 20 Oct 2018 15:52:48 +0300 Subject: [PATCH 02/27] Remove unused imports --- test/test_license.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/test/test_license.py b/test/test_license.py index b3a7645..ddd3cd8 100644 --- a/test/test_license.py +++ b/test/test_license.py @@ -1,15 +1,8 @@ -import sendgrid -from sendgrid.helpers.mail import * -from sendgrid.version import __version__ - try: import unittest2 as unittest except ImportError: import unittest -import os -import subprocess -import sys -import time + import datetime host = "http://localhost:4010" From 749533c05743ce15dcd4f9a339e625a56ef6e8e6 Mon Sep 17 00:00:00 2001 From: Hugo Date: Sat, 20 Oct 2018 15:53:07 +0300 Subject: [PATCH 03/27] Remove unused variable --- test/test_license.py | 1 - 1 file changed, 1 deletion(-) diff --git a/test/test_license.py b/test/test_license.py index ddd3cd8..c72fa1f 100644 --- a/test/test_license.py +++ b/test/test_license.py @@ -5,7 +5,6 @@ import datetime -host = "http://localhost:4010" def test_license_year(self): From f5af067b9ed7e735a07d56e158c6dd35df5ace8e Mon Sep 17 00:00:00 2001 From: Hugo Date: Sat, 20 Oct 2018 15:54:15 +0300 Subject: [PATCH 04/27] Fix unittest subclass --- test/test_license.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/test_license.py b/test/test_license.py index c72fa1f..964015f 100644 --- a/test/test_license.py +++ b/test/test_license.py @@ -6,9 +6,12 @@ import datetime +class LicenseTests(unittest.TestCase): + def test_license_year(self): + with open("license.txt", "r") as f: + copyright_line = f.readline().rstrip() -def test_license_year(self): - LICENSE_FILE = 'license.txt' - with open(LICENSE_FILE, 'r') as f: - copyright_line = f.readline().rstrip() - self.assertEqual('Copyright (c) 2012-%s SendGrid, Inc.' % datetime.datetime.now().year, copyright_line) + self.assertEqual( + "Copyright (c) 2012-%s SendGrid, Inc." % datetime.datetime.now().year, + copyright_line, + ) From 42c2b563a89c16155d5f125c598ee5ee1c325f91 Mon Sep 17 00:00:00 2001 From: Hugo Date: Sat, 20 Oct 2018 16:00:21 +0300 Subject: [PATCH 05/27] Sort --- .gitignore | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 40d319c..3f9396f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,13 @@ -*.pyc *.egg *.egg-info -dist -eggs -build -sdist +*.pyc +.env .Python bin/ +build +dist +eggs include/ lib/ -.env +sdist smtpapi/VERSION.txt From 540cc25fb13ab7c516a94dfda8a71726dc86c71a Mon Sep 17 00:00:00 2001 From: Hugo Date: Sat, 20 Oct 2018 16:00:47 +0300 Subject: [PATCH 06/27] Ignore .coverage dir --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 3f9396f..f15a69c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.egg *.egg-info *.pyc +.coverage .env .Python bin/ From 31e0b3cc82cbb8cdc1e04c09e18b15be6d663f3a Mon Sep 17 00:00:00 2001 From: Hugo Date: Sat, 20 Oct 2018 16:01:08 +0300 Subject: [PATCH 07/27] Enforce flake8 (=pycodestyle+pyflakes) on CI --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2d337f9..aa6aba7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,10 +6,11 @@ python: - '3.5' install: - python setup.py install - - pip install codecov + - pip install codecov flake8 script: - python test/__init__.py - coverage run test/__init__.py + - flake8 --statistics --count after_success: - codecov notifications: From 8c210605ec7e31da6ddc99f3cf0550a1380bc767 Mon Sep 17 00:00:00 2001 From: Hugo Date: Sat, 20 Oct 2018 16:06:02 +0300 Subject: [PATCH 08/27] Use Python's 'or', not '||' --- test/test_project.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/test_project.py b/test/test_project.py index 41e440a..47ab912 100644 --- a/test/test_project.py +++ b/test/test_project.py @@ -10,11 +10,11 @@ class ProjectTests(unittest.TestCase): # ./Docker or docker/Docker def test_docker_dir(self): - self.assertEqual(True, os.path.isdir("./Dockerfile") || os.path.isdir("./docker/Dockerfile")) + self.assertEqual(True, os.path.isdir("./Dockerfile") or os.path.isdir("./docker/Dockerfile")) # ./docker-compose.yml or ./docker/docker-compose.yml def test_docker_compose(self): - self.assertEqual(True, os.path.isfile('./docker-compose.yml') || os.path.isfile('./docker/docker-compose.yml')) + self.assertEqual(True, os.path.isfile('./docker-compose.yml') or os.path.isfile('./docker/docker-compose.yml')) # ./.env_sample def test_env(self): @@ -50,7 +50,7 @@ def test_issue_template(self): # ./LICENSE.md def test_license(self): - self.assertEqual(True, os.path.isfile('./LICENSE.md') || os.path.isfile('./LICENSE.txt')) + self.assertEqual(True, os.path.isfile('./LICENSE.md') or os.path.isfile('./LICENSE.txt')) # ./.github/PULL_REQUEST_TEMPLATE def test_pr_template(self): From 4e54678301d3c38c486120f8ecfea86535c8301c Mon Sep 17 00:00:00 2001 From: Hugo Date: Sat, 20 Oct 2018 16:08:29 +0300 Subject: [PATCH 09/27] Ignore the build dir --- .flake8 | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .flake8 diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..2810d67 --- /dev/null +++ b/.flake8 @@ -0,0 +1,2 @@ +[flake8] +exclude = build From 9ed1591f58a76dc6e4c602bb5ee38102b2c9373c Mon Sep 17 00:00:00 2001 From: Hugo Date: Sat, 20 Oct 2018 16:09:36 +0300 Subject: [PATCH 10/27] Also exclude defaults --- .flake8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.flake8 b/.flake8 index 2810d67..1a3aff3 100644 --- a/.flake8 +++ b/.flake8 @@ -1,2 +1,2 @@ [flake8] -exclude = build +exclude = build,.svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg From cc1f4467012bbfdc1f9fef68d1f500fed9762c72 Mon Sep 17 00:00:00 2001 From: Hugo Date: Sat, 20 Oct 2018 16:17:54 +0300 Subject: [PATCH 11/27] Fix flake8 warnings --- examples/example.py | 19 ++++++++++++------- setup.py | 5 ++++- smtpapi/__init__.py | 3 ++- test/__init__.py | 25 ++++++++++++++++++++----- test/test_license.py | 3 ++- test/test_project.py | 22 ++++++++++++++++++---- 6 files changed, 58 insertions(+), 19 deletions(-) diff --git a/examples/example.py b/examples/example.py index 719eb17..c8943fe 100644 --- a/examples/example.py +++ b/examples/example.py @@ -8,7 +8,6 @@ from os import sys, path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) - from smtpapi import SMTPAPIHeader header = SMTPAPIHeader() @@ -16,11 +15,13 @@ # header.add_to('test@example.com') header.set_tos(['test1@example.com', 'test2@example.com']) -# [Substitutions](http://sendgrid.com/docs/API_Reference/SMTP_API/substitution_tags.html) +# [Substitutions] +# (http://sendgrid.com/docs/API_Reference/SMTP_API/substitution_tags.html) # header.add_substitution('key', 'value') header.set_substitutions({'key': ['value1', 'value2']}) -# [Unique Arguments](http://sendgrid.com/docs/API_Reference/SMTP_API/unique_arguments.html) +# [Unique Arguments] +# (http://sendgrid.com/docs/API_Reference/SMTP_API/unique_arguments.html) # header.add_unique_arg('key', 'value') header.set_unique_args({'key': 'value'}) @@ -32,16 +33,20 @@ # header.add_section('key', 'section') header.set_sections({'key1': 'section1', 'key2': 'section2'}) -# [Filters](http://sendgrid.com/docs/API_Reference/SMTP_API/apps.html) +# [Filters] +# (http://sendgrid.com/docs/API_Reference/SMTP_API/apps.html) header.add_filter('filter', 'setting', 'value') -# [ASM Group ID](https://sendgrid.com/docs/User_Guide/advanced_suppression_manager.html) +# [ASM Group ID] +# (https://sendgrid.com/docs/User_Guide/advanced_suppression_manager.html) header.set_asm_group_id('value') -# [IP Pools](https://sendgrid.com/docs/API_Reference/Web_API_v3/IP_Management/ip_pools.html) +# [IP Pools] +# (https://sendgrid.com/docs/API_Reference/Web_API_v3/IP_Management/ip_pools.html) header.set_ip_pool("testPool") -# [Scheduling Parameters](https://sendgrid.com/docs/API_Reference/SMTP_API/scheduling_parameters.html) +# [Scheduling Parameters] +# (https://sendgrid.com/docs/API_Reference/SMTP_API/scheduling_parameters.html) # header.add_send_each_at(unix_timestamp) # must be a unix timestamp # header.set_send_each_at([]) # must be a unix timestamp header.set_send_at(int(time.time())) # must be a unix timestamp diff --git a/setup.py b/setup.py index a6e11d0..368bbaa 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,10 @@ dir_path = os.path.abspath(os.path.dirname(__file__)) readme = io.open(os.path.join(dir_path, 'README.rst'), encoding='utf-8').read() -version = io.open(os.path.join(dir_path, 'VERSION.txt'), encoding='utf-8').read().strip() +version = io.open( + os.path.join(dir_path, 'VERSION.txt'), + encoding='utf-8', +).read().strip() copy_file(os.path.join(dir_path, 'VERSION.txt'), os.path.join(dir_path, 'smtpapi', 'VERSION.txt'), verbose=0) diff --git a/smtpapi/__init__.py b/smtpapi/__init__.py index 13306e6..b865bf7 100644 --- a/smtpapi/__init__.py +++ b/smtpapi/__init__.py @@ -12,7 +12,8 @@ class _CustomJSONEncoder(json.JSONEncoder): def default(self, o): if isinstance(o, decimal.Decimal): return float(o) - # Provide a fallback to the default encoder if we haven't implemented special support for the object's class + # Provide a fallback to the default encoder if we haven't implemented + # special support for the object's class return super(_CustomJSONEncoder, self).default(o) diff --git a/test/__init__.py b/test/__init__.py index 3e700d8..048fc10 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -46,7 +46,11 @@ def test_add(self): def test_set(self): header = SMTPAPIHeader() - header.set_tos(["test@email.com", "test2@email.com", "test3@email.com"]) + header.set_tos([ + "test@email.com", + "test2@email.com", + "test3@email.com", + ]) header.set_substitutions({ "subKey": ["subValue"], "decimalKey": [decimal.Decimal("1.23456789")] @@ -85,7 +89,11 @@ def test_license_year(self): if line.startswith('Copyright'): copyright_line = line.strip() break - self.assertEqual('Copyright (c) 2013-%s SendGrid, Inc.' % datetime.datetime.now().year, copyright_line) + self.assertEqual( + 'Copyright (c) 2013-%s SendGrid, Inc.' + % datetime.datetime.now().year, + copyright_line) + class TestRepository(unittest.TestCase): @@ -118,10 +126,17 @@ def test_repository_files_exists(self): for file_path in self.required_files: if isinstance(file_path, list): # multiple file paths: assert that any one of the files exists - self.assertTrue(any(os.path.exists(f) for f in file_path), - msg=self.file_not_found_message.format('" or "'.join(file_path))) + self.assertTrue( + any(os.path.exists(f) for f in file_path), + msg=self.file_not_found_message.format( + '" or "'.join(file_path)), + ) else: - self.assertTrue(os.path.exists(file_path), msg=self.file_not_found_message.format(file_path)) + self.assertTrue( + os.path.exists(file_path), + msg=self.file_not_found_message.format(file_path), + ) + if __name__ == '__main__': diff --git a/test/test_license.py b/test/test_license.py index 964015f..42d03d6 100644 --- a/test/test_license.py +++ b/test/test_license.py @@ -12,6 +12,7 @@ def test_license_year(self): copyright_line = f.readline().rstrip() self.assertEqual( - "Copyright (c) 2012-%s SendGrid, Inc." % datetime.datetime.now().year, + "Copyright (c) 2012-%s SendGrid, Inc." + % datetime.datetime.now().year, copyright_line, ) diff --git a/test/test_project.py b/test/test_project.py index 47ab912..abc6291 100644 --- a/test/test_project.py +++ b/test/test_project.py @@ -10,11 +10,19 @@ class ProjectTests(unittest.TestCase): # ./Docker or docker/Docker def test_docker_dir(self): - self.assertEqual(True, os.path.isdir("./Dockerfile") or os.path.isdir("./docker/Dockerfile")) + self.assertEqual( + True, + os.path.isdir("./Dockerfile") + or os.path.isdir("./docker/Dockerfile"), + ) # ./docker-compose.yml or ./docker/docker-compose.yml def test_docker_compose(self): - self.assertEqual(True, os.path.isfile('./docker-compose.yml') or os.path.isfile('./docker/docker-compose.yml')) + self.assertEqual( + True, + os.path.isfile('./docker-compose.yml') + or os.path.isfile('./docker/docker-compose.yml'), + ) # ./.env_sample def test_env(self): @@ -50,11 +58,17 @@ def test_issue_template(self): # ./LICENSE.md def test_license(self): - self.assertEqual(True, os.path.isfile('./LICENSE.md') or os.path.isfile('./LICENSE.txt')) + self.assertEqual( + True, + os.path.isfile('./LICENSE.md') or os.path.isfile('./LICENSE.txt'), + ) # ./.github/PULL_REQUEST_TEMPLATE def test_pr_template(self): - self.assertEqual(True, os.path.isfile('./.github/PULL_REQUEST_TEMPLATE')) + self.assertEqual( + True, + os.path.isfile('./.github/PULL_REQUEST_TEMPLATE'), + ) # ./README.rst def test_readme(self): From ab23c2717cd3aa948cd59268861e6e3477d28877 Mon Sep 17 00:00:00 2001 From: Hugo Date: Sat, 20 Oct 2018 16:22:52 +0300 Subject: [PATCH 12/27] Flake8 doesn't support Python 2.6 --- .travis.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index aa6aba7..1263f25 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,11 +6,12 @@ python: - '3.5' install: - python setup.py install - - pip install codecov flake8 + - pip install codecov + - if [[ $TRAVIS_PYTHON_VERSION != 2.6 ]]; then pip install flake8; fi script: - python test/__init__.py - coverage run test/__init__.py - - flake8 --statistics --count + - if [[ $TRAVIS_PYTHON_VERSION != 2.6 ]]; then flake8 --statistics --count; fi after_success: - codecov notifications: From d82297cbe52579be3112d3abb8745f5806337ef4 Mon Sep 17 00:00:00 2001 From: Hugo Date: Sat, 20 Oct 2018 16:40:35 +0300 Subject: [PATCH 13/27] Tidy imports --- examples/example.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/example.py b/examples/example.py index c8943fe..49ab1f5 100644 --- a/examples/example.py +++ b/examples/example.py @@ -3,10 +3,11 @@ from smtpapi import SMTPAPIHeader import time +from os import path, sys -if __name__ == '__main__' and __package__ is None: - from os import sys, path +from smtpapi import SMTPAPIHeader +if __name__ == '__main__' and __package__ is None: sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) header = SMTPAPIHeader() From 41616010d1d6ce5c23a3ce26fc740c4bd1ab6c01 Mon Sep 17 00:00:00 2001 From: Hugo Date: Sun, 28 Oct 2018 11:27:06 +0200 Subject: [PATCH 14/27] Consistent newlines --- test/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/__init__.py b/test/__init__.py index 048fc10..f053c53 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -92,7 +92,8 @@ def test_license_year(self): self.assertEqual( 'Copyright (c) 2013-%s SendGrid, Inc.' % datetime.datetime.now().year, - copyright_line) + copyright_line + ) @@ -129,7 +130,8 @@ def test_repository_files_exists(self): self.assertTrue( any(os.path.exists(f) for f in file_path), msg=self.file_not_found_message.format( - '" or "'.join(file_path)), + '" or "'.join(file_path) + ), ) else: self.assertTrue( From f221cb8a4dea139c6cf51e89f282061ec0fcefd6 Mon Sep 17 00:00:00 2001 From: Hugo Date: Sun, 28 Oct 2018 19:40:28 +0200 Subject: [PATCH 15/27] Use assertTrue(x) over assertEqual(True, x) --- test/test_project.py | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/test/test_project.py b/test/test_project.py index abc6291..d1c451b 100644 --- a/test/test_project.py +++ b/test/test_project.py @@ -10,81 +10,77 @@ class ProjectTests(unittest.TestCase): # ./Docker or docker/Docker def test_docker_dir(self): - self.assertEqual( - True, + self.assertTrue( os.path.isdir("./Dockerfile") or os.path.isdir("./docker/Dockerfile"), ) # ./docker-compose.yml or ./docker/docker-compose.yml def test_docker_compose(self): - self.assertEqual( - True, + self.assertTrue( os.path.isfile('./docker-compose.yml') or os.path.isfile('./docker/docker-compose.yml'), ) # ./.env_sample def test_env(self): - self.assertEqual(True, os.path.isfile('./env_sample')) + self.assertTrue(os.path.isfile('./env_sample')) # ./.gitignore def test_gitignore(self): - self.assertEqual(True, os.path.isfile('./.gitignore')) + self.assertTrue(os.path.isfile('./.gitignore')) # ./.travis.yml def test_travis(self): - self.assertEqual(True, os.path.isfile('./.travis.yml')) + self.assertTrue(os.path.isfile('./.travis.yml')) # ./.codeclimate.yml def test_codeclimate(self): - self.assertEqual(True, os.path.isfile('./.codeclimate.yml')) + self.assertTrue(os.path.isfile('./.codeclimate.yml')) # ./CHANGELOG.md def test_changelog(self): - self.assertEqual(True, os.path.isfile('./CHANGELOG.md')) + self.assertTrue(os.path.isfile('./CHANGELOG.md')) # ./CODE_OF_CONDUCT.md def test_code_of_conduct(self): - self.assertEqual(True, os.path.isfile('./CODE_OF_CONDUCT.md')) + self.assertTrue(os.path.isfile('./CODE_OF_CONDUCT.md')) # ./CONTRIBUTING.md def test_contributing(self): - self.assertEqual(True, os.path.isfile('./CONTRIBUTING.md')) + self.assertTrue(os.path.isfile('./CONTRIBUTING.md')) # ./.github/ISSUE_TEMPLATE def test_issue_template(self): - self.assertEqual(True, os.path.isfile('./.github/ISSUE_TEMPLATE')) + self.assertTrue(os.path.isfile('./.github/ISSUE_TEMPLATE')) # ./LICENSE.md def test_license(self): - self.assertEqual( - True, + self.assertTrue( os.path.isfile('./LICENSE.md') or os.path.isfile('./LICENSE.txt'), ) # ./.github/PULL_REQUEST_TEMPLATE def test_pr_template(self): - self.assertEqual( - True, + self.assertTrue( os.path.isfile('./.github/PULL_REQUEST_TEMPLATE'), ) # ./README.rst def test_readme(self): - self.assertEqual(True, os.path.isfile('./README.rst')) + self.assertTrue(os.path.isfile('./README.rst')) # ./TROUBLESHOOTING.md def test_troubleshooting(self): - self.assertEqual(True, os.path.isfile('./TROUBLESHOOTING.md')) + self.assertTrue(os.path.isfile('./TROUBLESHOOTING.md')) # ./USAGE.md def test_usage(self): - self.assertEqual(True, os.path.isfile('./USAGE.md')) + self.assertTrue(os.path.isfile('./USAGE.md')) # ./VERSION.txt def test_use_cases(self): - self.assertEqual(True, os.path.isfile('./VERSION.txt')) + self.assertTrue(os.path.isfile('./VERSION.txt')) if __name__ == '__main__': From 6a7bc4725dccd055cdbb515e6fbacbaac54aa4b8 Mon Sep 17 00:00:00 2001 From: Hugo Date: Sun, 28 Oct 2018 20:05:22 +0200 Subject: [PATCH 16/27] Fix rebase --- examples/example.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/example.py b/examples/example.py index 49ab1f5..07c3b15 100644 --- a/examples/example.py +++ b/examples/example.py @@ -5,8 +5,6 @@ import time from os import path, sys -from smtpapi import SMTPAPIHeader - if __name__ == '__main__' and __package__ is None: sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) From c897224ab17bcf9dc884f06bc5bce80f91fc672b Mon Sep 17 00:00:00 2001 From: hugovk Date: Wed, 31 Oct 2018 09:10:54 +0200 Subject: [PATCH 17/27] Fix flake8 --- test/__init__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/__init__.py b/test/__init__.py index f053c53..76659ca 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -96,7 +96,6 @@ def test_license_year(self): ) - class TestRepository(unittest.TestCase): def setUp(self): @@ -140,6 +139,5 @@ def test_repository_files_exists(self): ) - if __name__ == '__main__': unittest.main() From 843018ac5a2333db469b6a544e085a64f15f050b Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 31 Oct 2018 20:54:11 +0200 Subject: [PATCH 18/27] Remove trailing commas --- test/test_project.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/test_project.py b/test/test_project.py index d1c451b..4b16f38 100644 --- a/test/test_project.py +++ b/test/test_project.py @@ -12,14 +12,14 @@ class ProjectTests(unittest.TestCase): def test_docker_dir(self): self.assertTrue( os.path.isdir("./Dockerfile") - or os.path.isdir("./docker/Dockerfile"), + or os.path.isdir("./docker/Dockerfile") ) # ./docker-compose.yml or ./docker/docker-compose.yml def test_docker_compose(self): self.assertTrue( os.path.isfile('./docker-compose.yml') - or os.path.isfile('./docker/docker-compose.yml'), + or os.path.isfile('./docker/docker-compose.yml') ) # ./.env_sample @@ -57,13 +57,13 @@ def test_issue_template(self): # ./LICENSE.md def test_license(self): self.assertTrue( - os.path.isfile('./LICENSE.md') or os.path.isfile('./LICENSE.txt'), + os.path.isfile('./LICENSE.md') or os.path.isfile('./LICENSE.txt') ) # ./.github/PULL_REQUEST_TEMPLATE def test_pr_template(self): self.assertTrue( - os.path.isfile('./.github/PULL_REQUEST_TEMPLATE'), + os.path.isfile('./.github/PULL_REQUEST_TEMPLATE') ) # ./README.rst From 28462d22660336ae7c9b8255adecb54baf87c42d Mon Sep 17 00:00:00 2001 From: childish-sambino Date: Wed, 1 Jul 2020 14:46:13 -0500 Subject: [PATCH 19/27] Update test_project.py --- test/test_project.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_project.py b/test/test_project.py index 5efe648..e63fb9d 100644 --- a/test/test_project.py +++ b/test/test_project.py @@ -11,7 +11,7 @@ class ProjectTests(unittest.TestCase): # ./Docker or docker/Docker def test_docker_dir(self): self.assertTrue( - os.path.isdir("./Dockerfile") + os.path.isfile("./Dockerfile") or os.path.isdir("./docker/Dockerfile") ) @@ -24,7 +24,7 @@ def test_docker_compose(self): # ./.env_sample def test_env(self): - self.assertTrue(os.path.isfile('./env_sample')) + self.assertTrue(os.path.isfile('./.env_sample')) # ./.gitignore def test_gitignore(self): From 51606bf2158265aabf6f1ab8f9d3fce34d7cb0b7 Mon Sep 17 00:00:00 2001 From: childish-sambino Date: Wed, 1 Jul 2020 14:47:43 -0500 Subject: [PATCH 20/27] Delete test_license.py --- test/test_license.py | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 test/test_license.py diff --git a/test/test_license.py b/test/test_license.py deleted file mode 100644 index 42d03d6..0000000 --- a/test/test_license.py +++ /dev/null @@ -1,18 +0,0 @@ -try: - import unittest2 as unittest -except ImportError: - import unittest - -import datetime - - -class LicenseTests(unittest.TestCase): - def test_license_year(self): - with open("license.txt", "r") as f: - copyright_line = f.readline().rstrip() - - self.assertEqual( - "Copyright (c) 2012-%s SendGrid, Inc." - % datetime.datetime.now().year, - copyright_line, - ) From 5d1286a370ff3605931b9a7652137c19e7422256 Mon Sep 17 00:00:00 2001 From: childish-sambino Date: Wed, 1 Jul 2020 14:50:01 -0500 Subject: [PATCH 21/27] Update test_project.py --- test/test_project.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/test/test_project.py b/test/test_project.py index e63fb9d..f0db93e 100644 --- a/test/test_project.py +++ b/test/test_project.py @@ -1,10 +1,5 @@ import os -try: - import unittest2 as unittest -except ImportError: - import unittest - class ProjectTests(unittest.TestCase): From 27508d9b98cc55aebb2b86e26673bbb77fe9c1de Mon Sep 17 00:00:00 2001 From: childish-sambino Date: Wed, 1 Jul 2020 14:52:29 -0500 Subject: [PATCH 22/27] Update test_project.py --- test/test_project.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test/test_project.py b/test/test_project.py index f0db93e..fdd3684 100644 --- a/test/test_project.py +++ b/test/test_project.py @@ -1,4 +1,5 @@ import os +import unittest class ProjectTests(unittest.TestCase): From 5f9b7e2a45b88007f08d651f34e5acd77a97cf4a Mon Sep 17 00:00:00 2001 From: childish-sambino Date: Wed, 1 Jul 2020 14:55:33 -0500 Subject: [PATCH 23/27] Update .travis.yml --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c172959..3f53f34 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,6 @@ install: - make install - make test-install - pip install codecov - - pip install flake8 script: - make test - . venv/bin/activate; coverage run test/__init__.py From 13027c3078d2af960c60e9e8e9a3550b54fccc85 Mon Sep 17 00:00:00 2001 From: childish-sambino Date: Wed, 1 Jul 2020 14:56:05 -0500 Subject: [PATCH 24/27] Update requirements.txt --- test/requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/requirements.txt b/test/requirements.txt index 5b3644a..89035cf 100644 --- a/test/requirements.txt +++ b/test/requirements.txt @@ -1,2 +1,3 @@ sendgrid coverage +flake8 From 1a055fef0d6529876e31a5f6e8c7dfff511400d4 Mon Sep 17 00:00:00 2001 From: childish-sambino Date: Wed, 1 Jul 2020 15:01:25 -0500 Subject: [PATCH 25/27] Update .flake8 --- .flake8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.flake8 b/.flake8 index 1a3aff3..e83285b 100644 --- a/.flake8 +++ b/.flake8 @@ -1,2 +1,2 @@ [flake8] -exclude = build,.svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg +exclude = build,venv,prism,.svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg From 3eed6095a2d610b1efe6532509ac5ec1e5d8f6b7 Mon Sep 17 00:00:00 2001 From: childish-sambino Date: Wed, 1 Jul 2020 15:05:03 -0500 Subject: [PATCH 26/27] Update __init__.py --- test/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/__init__.py b/test/__init__.py index 29d3c09..149d225 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -89,7 +89,11 @@ def test_license_year(self): if line.startswith('Copyright'): copyright_line = line.strip() break - self.assertEqual('Copyright (C) %s, Twilio SendGrid, Inc. ' % datetime.datetime.now().year, copyright_line) + self.assertEqual( + 'Copyright (C) %s, Twilio SendGrid, Inc. ' + % datetime.datetime.now().year, + copyright_line + ) class TestRepository(unittest.TestCase): From 00753077c6afcca3788763143579b5ede44c94e7 Mon Sep 17 00:00:00 2001 From: childish-sambino Date: Wed, 1 Jul 2020 15:07:15 -0500 Subject: [PATCH 27/27] Update .flake8 --- .flake8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.flake8 b/.flake8 index e83285b..47be0b2 100644 --- a/.flake8 +++ b/.flake8 @@ -1,2 +1,2 @@ [flake8] -exclude = build,venv,prism,.svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg +exclude = build,venv,.svn,CVS,.bzr,.hg,.git,__pycache__,.tox,.eggs,*.egg