From 7b9e82175e18ebf160109f7558b8d7ba47146007 Mon Sep 17 00:00:00 2001
From: Casey Faist <caseylfaist@gmail.com>
Date: Mon, 12 Nov 2018 17:10:30 -0600
Subject: [PATCH] add warning detection and per-stack checks

---
 test/fixtures/python2_warn/requirements.txt   |  1 +
 test/fixtures/python2_warn/runtime.txt        |  1 +
 test/fixtures/python3_4_warn/requirements.txt |  1 +
 test/fixtures/python3_4_warn/runtime.txt      |  1 +
 test/fixtures/python3_5_warn/requirements.txt |  1 +
 test/fixtures/python3_5_warn/runtime.txt      |  1 +
 test/fixtures/python3_6_warn/requirements.txt |  1 +
 test/fixtures/python3_6_warn/runtime.txt      |  1 +
 test/run                                      | 47 +++++++++++++++++--
 9 files changed, 52 insertions(+), 3 deletions(-)
 create mode 100644 test/fixtures/python2_warn/requirements.txt
 create mode 100644 test/fixtures/python2_warn/runtime.txt
 create mode 100644 test/fixtures/python3_4_warn/requirements.txt
 create mode 100644 test/fixtures/python3_4_warn/runtime.txt
 create mode 100644 test/fixtures/python3_5_warn/requirements.txt
 create mode 100644 test/fixtures/python3_5_warn/runtime.txt
 create mode 100644 test/fixtures/python3_6_warn/requirements.txt
 create mode 100644 test/fixtures/python3_6_warn/runtime.txt

diff --git a/test/fixtures/python2_warn/requirements.txt b/test/fixtures/python2_warn/requirements.txt
new file mode 100644
index 00000000..663bd1f6
--- /dev/null
+++ b/test/fixtures/python2_warn/requirements.txt
@@ -0,0 +1 @@
+requests
\ No newline at end of file
diff --git a/test/fixtures/python2_warn/runtime.txt b/test/fixtures/python2_warn/runtime.txt
new file mode 100644
index 00000000..53856820
--- /dev/null
+++ b/test/fixtures/python2_warn/runtime.txt
@@ -0,0 +1 @@
+python-2.7.14
diff --git a/test/fixtures/python3_4_warn/requirements.txt b/test/fixtures/python3_4_warn/requirements.txt
new file mode 100644
index 00000000..7e106024
--- /dev/null
+++ b/test/fixtures/python3_4_warn/requirements.txt
@@ -0,0 +1 @@
+flask
diff --git a/test/fixtures/python3_4_warn/runtime.txt b/test/fixtures/python3_4_warn/runtime.txt
new file mode 100644
index 00000000..fe5dcf7a
--- /dev/null
+++ b/test/fixtures/python3_4_warn/runtime.txt
@@ -0,0 +1 @@
+python-3.4.0
diff --git a/test/fixtures/python3_5_warn/requirements.txt b/test/fixtures/python3_5_warn/requirements.txt
new file mode 100644
index 00000000..7e106024
--- /dev/null
+++ b/test/fixtures/python3_5_warn/requirements.txt
@@ -0,0 +1 @@
+flask
diff --git a/test/fixtures/python3_5_warn/runtime.txt b/test/fixtures/python3_5_warn/runtime.txt
new file mode 100644
index 00000000..5486d7ad
--- /dev/null
+++ b/test/fixtures/python3_5_warn/runtime.txt
@@ -0,0 +1 @@
+python-3.5.3
diff --git a/test/fixtures/python3_6_warn/requirements.txt b/test/fixtures/python3_6_warn/requirements.txt
new file mode 100644
index 00000000..663bd1f6
--- /dev/null
+++ b/test/fixtures/python3_6_warn/requirements.txt
@@ -0,0 +1 @@
+requests
\ No newline at end of file
diff --git a/test/fixtures/python3_6_warn/runtime.txt b/test/fixtures/python3_6_warn/runtime.txt
new file mode 100644
index 00000000..486fcce1
--- /dev/null
+++ b/test/fixtures/python3_6_warn/runtime.txt
@@ -0,0 +1 @@
+python-3.6.5
diff --git a/test/run b/test/run
index 67d4113d..484f241d 100755
--- a/test/run
+++ b/test/run
@@ -87,19 +87,48 @@ testPylibmc() {
   assertCapturedSuccess
 }
 
+testPython2_warn() {
+    compile "python2_warn"
+    assertCaptured "python-2.7.14"
+    assertCaptured "security update!"
+    assertCapturedSuccess
+}
+
 testPython2() {
     compile "python2"
     assertCaptured "python-2.7.15"
     assertCapturedSuccess
 }
 
-# This will succeed on Cedar-14 and fail on 16 and 18
+# This fail
+testPython3_4_warn() {
+  compile "python3_4_warn"
+  if [[ $STACK = "cedar-14" ]]; then
+    assertCaptured "python-3.4.0"
+    assertCapturedSuccess
+  else
+    assertCapturedError
+  fi
+}
+
+# This fail
 testPython3_4() {
   compile "python3_4"
   assertCaptured "python-3.4.9"
   assertCapturedError
 }
 
+# This fail
+testPython3_5_warn() {
+  compile "python3_5_warn"
+  if [[ $STACK = "cedar-14" ]]; then
+    assertCaptured "python-3.5.3"
+    assertCapturedSuccess
+  else
+    assertCapturedError
+  fi
+}
+
 # This will fail
 testPython3_5() {
   compile "python3_5"
@@ -107,6 +136,14 @@ testPython3_5() {
   assertCapturedError
 }
 
+# This will warn
+testPython3_6_warn() {
+  compile "python3_6_warn"
+  assertCaptured "python-3.6.5"
+  assertCaptured "security update!"
+  assertCapturedSuccess
+}
+
 testPython3_6() {
   compile "python3_6"
   assertCaptured "python-3.6.6"
@@ -122,8 +159,12 @@ testPython3_6_7() {
 
 testPython3_7() {
   compile "python3_7"
-  assertCaptured "python-3.7.0"
-  assertCapturedSuccess
+  if [[ $STACK = "cedar-14" ]]; then
+    assertCapturedError
+  else
+    assertCaptured "python-3.7.0"
+    assertCapturedSuccess
+  fi
 }
 
 # This will fail
-- 
GitLab