From 10863fea460c1bc8243ed0bfec02d31a2b4d45b3 Mon Sep 17 00:00:00 2001 From: Antony Oduor Date: Tue, 18 Aug 2020 18:05:52 -0600 Subject: [PATCH 1/4] Fix: Invoke bake() via Flake in test_generation sh The error below happened in `sh.flake8()` instead of `sh.flake8.bake()` `TypeError: Failed expected string as 'msg' parameter, got 'ErrorReturnCode_1' instead.` Signed-off-by: Antony Oduor --- tests/test_cookiecutter_generation.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/test_cookiecutter_generation.py b/tests/test_cookiecutter_generation.py index abb5239..3b2d338 100644 --- a/tests/test_cookiecutter_generation.py +++ b/tests/test_cookiecutter_generation.py @@ -76,11 +76,10 @@ def test_generation(cookies, context): base_path = str(result.project) # Run Flake 8 try: - sh.flake8('{path}/setup.py {path}/{namespace}'.format( - path=base_path, - namespace=context['namespace'] - ) - ) + sh.flake8.bake('{path}/setup.py {path}/{namespace}'.format( + path=base_path, + namespace=context['namespace'] + )) except sh.ErrorReturnCode as e: pytest.fail(e) # Run tests From 735f7878b5c0c63ed12cb5831b1dacca6448f433 Mon Sep 17 00:00:00 2001 From: Antony Oduor Date: Tue, 18 Aug 2020 18:10:00 -0600 Subject: [PATCH 2/4] Add flake8 in Tox INI to Ignore W605 This caused "W605 invalid escape sequence '\s'" in raw pattern strings such as CC_PATTERN in the test_cookiecutter_generation. I reckon there is a better way to fix it than ignoring... Signed-off-by: Antony Oduor --- tox.ini | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tox.ini b/tox.ini index cc6f4b7..f05cdb9 100644 --- a/tox.ini +++ b/tox.ini @@ -1,3 +1,6 @@ +[flake8] +ignore=W605 + [tox] skip_missing_interpreters=true skipsdist = true From 237f10dcb7dcdf90ebcb647cbc6e69e379c7abcd Mon Sep 17 00:00:00 2001 From: Antony Oduor Date: Tue, 18 Aug 2020 18:15:27 -0600 Subject: [PATCH 3/4] Add requirements.txt for Development Work Signed-off-by: Antony Oduor --- requirements.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..1419b3b --- /dev/null +++ b/requirements.txt @@ -0,0 +1,16 @@ +cookiecutter +sh +binaryornot + +# Code quality +# ------------------------------------------------------------------------------ +flake8 +pycodestyle +pyflakes + +# Testing +# ------------------------------------------------------------------------------ +tox +pytest +pytest-cookies + From e845b2725c19939d9ed8ada2e2141a08665c8de2 Mon Sep 17 00:00:00 2001 From: Antony Oduor Date: Tue, 18 Aug 2020 18:18:48 -0600 Subject: [PATCH 4/4] Git Ignore Python Byte-compiled Files Signed-off-by: Antony Oduor --- .gitignore | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 92871e8..2351a5e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,9 @@ - d] +# Byte-compiled / optimized / DLL files +__pycache__/ + # C extensions *.so @@ -47,4 +50,5 @@ output/ boilerplate/ # pyenv -.python-version \ No newline at end of file +.python-version +