From 312b9ca6debb65a6766c4e06dd28daf5ffb1aefb Mon Sep 17 00:00:00 2001 From: Kevin Grinberg Date: Mon, 9 Mar 2020 10:42:44 -0400 Subject: [PATCH 1/2] Fix old Django version detection --- CHANGELOG.md | 2 +- bin/steps/pip-install | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7617a30..64263b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,7 +3,7 @@ # Master - Correct ftp to https in vendored file -- Warn for Django 1.11 approaching EOL, provide link to roadmap +- Warn for Django 1.11 approaching EOL, provide link to roadmap [fixed detection] -------------------------------------------------------------------------------- diff --git a/bin/steps/pip-install b/bin/steps/pip-install index 403c3e7..481ffc6 100755 --- a/bin/steps/pip-install +++ b/bin/steps/pip-install @@ -38,10 +38,10 @@ if [ ! "$SKIP_PIP_INSTALL" ]; then mcount "failure.none-version" fi - if grep -q 'django==1.*' requirements.txt; then + if grep -qi '^django==1.*' requirements.txt; then puts-warn "Your Django version is nearing the end of its community support." puts-warn "Upgrade to continue to receive security updates and for the best experience with Django." - puts-warn "For more information, check out https://www.djangoproject.com/weblog/2015/jun/25/roadmap/" + puts-warn "For more information, check out https://www.djangoproject.com/download/#supported-versions" fi if [ ! -f "$BUILD_DIR/.heroku/python/bin/pip" ]; then From 48a368ac713a11b0b1ab366f94e181e204ad2a66 Mon Sep 17 00:00:00 2001 From: Casey Faist Date: Tue, 24 Mar 2020 14:48:17 -0400 Subject: [PATCH 2/2] Add test for expected behavior --- test/fixtures/not-old-django/requirements.txt | 2 ++ test/fixtures/old-django/requirements.txt | 1 + test/run-features | 12 ++++++++++++ 3 files changed, 15 insertions(+) create mode 100644 test/fixtures/not-old-django/requirements.txt create mode 100644 test/fixtures/old-django/requirements.txt diff --git a/test/fixtures/not-old-django/requirements.txt b/test/fixtures/not-old-django/requirements.txt new file mode 100644 index 0000000..52a0c57 --- /dev/null +++ b/test/fixtures/not-old-django/requirements.txt @@ -0,0 +1,2 @@ +pwned-passwords-django==1.4 +Django==2.1 diff --git a/test/fixtures/old-django/requirements.txt b/test/fixtures/old-django/requirements.txt new file mode 100644 index 0000000..f305b2f --- /dev/null +++ b/test/fixtures/old-django/requirements.txt @@ -0,0 +1 @@ +Django==1.11 diff --git a/test/run-features b/test/run-features index c3ee1f2..8982eb0 100755 --- a/test/run-features +++ b/test/run-features @@ -74,6 +74,18 @@ testNoRequirements() { assertCapturedError } +testWarnOldDjango() { + compile "old-django" + assertCaptured "Your Django version is nearing the end of its community support." + assertCapturedSuccess +} + +testDontWarnOldDjango() { + compile "not-old-django" + assertNotCaptured "Your Django version is nearing the end of its community support." + assertCapturedSuccess +} + pushd $(dirname 0) >/dev/null popd >/dev/null