Add more imports required for tests

Run pytest within the virtualenv with "pipenv run pytest".

Also, ignore glint errors if the binary doesn't exist. External developers or
Mac OS X developers don't have glint installed.

TEST=Unit tests pass with the proper pytest binary now.
BUG=chromium:789287

Change-Id: I06506811a60c3446f1d320ac83b7b77bdce1085e
Reviewed-on: https://chromium-review.googlesource.com/794902
Commit-Ready: Paul Hobbs <phobbs@google.com>
Tested-by: Paul Hobbs <phobbs@google.com>
Reviewed-by: Xixuan Wu <xixuan@chromium.org>
diff --git a/Pipfile b/Pipfile
index 240b9cd..a6766ff 100644
--- a/Pipfile
+++ b/Pipfile
@@ -19,6 +19,8 @@
 seaborn = "*"
 gunicorn = "*"
 fire = "*"
+pytest = "*"
+mox = "*"
 
 
 [packages]
diff --git a/Pipfile.lock b/Pipfile.lock
index e7ab3bb..53c4af7 100644
--- a/Pipfile.lock
+++ b/Pipfile.lock
@@ -1,7 +1,7 @@
 {
     "_meta": {
         "hash": {
-            "sha256": "ef63af145c02addeae47e45c1e58c46b3d565c019f880ab2c1998a2442c8d102"
+            "sha256": "c3813352c8d5f6ca4576d79cb4d5d48f8f6525ef6b80ced706479b2be40ffe26"
         },
         "host-environment-markers": {
             "implementation_name": "cpython",
@@ -346,6 +346,13 @@
             "markers": "sys_platform == 'darwin'",
             "version": "==0.1.0"
         },
+        "attrs": {
+            "hashes": [
+                "sha256:e7d51b70f19a4da5fe6b3c9938983e0af3b91e230edc504bd73c443d98037063",
+                "sha256:c78f53e32d7cf36d8597c8a2c7e3c0ad210f97b9509e152e4c37fa80869f823c"
+            ],
+            "version": "==17.3.0"
+        },
         "backports-abc": {
             "hashes": [
                 "sha256:52089f97fe7a9aa0d3277b220c1d730a85aefd64e1b2664696fe35317c5470a7",
@@ -426,6 +433,14 @@
             ],
             "version": "==0.1.2"
         },
+        "funcsigs": {
+            "hashes": [
+                "sha256:330cc27ccbf7f1e992e69fef78261dc7c6569012cf397db8d3de0234e6c937ca",
+                "sha256:a7bb0f2cf3a3fd1ab2732cb49eba4252c2af4240442415b4abce3b87022a8f50"
+            ],
+            "markers": "python_version < '3.0'",
+            "version": "==1.0.2"
+        },
         "functools32": {
             "hashes": [
                 "sha256:f6253dfbe0538ad2e387bd8fdfd9293c925d63553f5813c4e587745416501e6d",
@@ -557,6 +572,12 @@
             ],
             "version": "==0.8.1"
         },
+        "mox": {
+            "hashes": [
+                "sha256:424ee725ee12652802b4e86571f816059b0d392401ceae70bf6487d65602cba9"
+            ],
+            "version": "==0.5.3"
+        },
         "nbconvert": {
             "hashes": [
                 "sha256:260d390b989a647575b8ecae2cd06a9eaead10d396733d6e50185d5ebd08996e",
@@ -617,7 +638,7 @@
                 "sha256:db3e43032d23787d3e9aec8c7ef1e0d2c3c589d5f303477661ebda2ca6d4bfba",
                 "sha256:d32550b75a818b289bd4c1f96b60c89957811da205afcceab75bc8b4857ea5b3"
             ],
-            "markers": "python_version in '2.6 2.7 3.2 3.3'",
+            "markers": "python_version == '2.7' or python_version == '3.3'",
             "version": "==2.3.0"
         },
         "pexpect": {
@@ -635,6 +656,12 @@
             ],
             "version": "==0.7.4"
         },
+        "pluggy": {
+            "hashes": [
+                "sha256:7f8ae7f5bdf75671a718d2daf0a64b7885f74510bcd98b1a0bb420eb9a9d0cff"
+            ],
+            "version": "==0.6.0"
+        },
         "prompt-toolkit": {
             "hashes": [
                 "sha256:3f473ae040ddaa52b52f97f6b4a493cfa9f5920c255a12dc56a7d34397a398a4",
@@ -648,9 +675,15 @@
                 "sha256:e8c43b5eee76b2083a9badde89fd1bbce6c8942d1045146e100b7b5e014f4f1a",
                 "sha256:e64193f0047ad603b71f202332ab5527c5e52aa7c8b609704fc28c0dc20c4365"
             ],
-            "markers": "os_name != 'nt'",
             "version": "==0.5.2"
         },
+        "py": {
+            "hashes": [
+                "sha256:8cca5c229d225f8c1e3085be4fcf306090b00850fefad892f9d96c7b6e2f310f",
+                "sha256:ca18943e28235417756316bfada6cd96b23ce60dd532642690dcfdaba988a76d"
+            ],
+            "version": "==1.5.2"
+        },
         "pygments": {
             "hashes": [
                 "sha256:78f3f434bcc5d6ee09020f92ba487f95ba50f1e3ef83ae96b9d5ffa1bab25c5d",
@@ -670,6 +703,13 @@
             ],
             "version": "==2.2.0"
         },
+        "pytest": {
+            "hashes": [
+                "sha256:72186b294cc88322a4427225fdb9240c95e3f01cc53c1ea4f4f79ffe39ff1955",
+                "sha256:6db1c070aa412c30647b6aeb13c55670f900cf00fbafa003cdde560c3f4a8d76"
+            ],
+            "version": "==3.3.0"
+        },
         "python-dateutil": {
             "hashes": [
                 "sha256:95511bae634d69bc7329ba55e646499a842bc4ec342ad54a8cdb65645a0aad3c",
diff --git a/bin/run_lint b/bin/run_lint
index a5caf01..2df8e61 100755
--- a/bin/run_lint
+++ b/bin/run_lint
@@ -9,11 +9,15 @@
 
 readonly bin_dir=$(readlink -f -- "$(dirname -- "$0")")
 
-if (( $# == 0 )); then
-    echo "No file specified. Linting all files managed by git." >&2
-    cd "${bin_dir}/.."
-    git ls-files | xargs -d '\n' /usr/bin/glint
-    exit 0
+
+if [ -f /usr/bin/glint ]; then  # glint isn't external or on Mac OS X
+    if (( $# == 0 )); then
+        echo "No file specified. Linting all files managed by git." >&2
+        cd "${bin_dir}/.."
+        git ls-files | xargs -d '\n' /usr/bin/glint
+        exit 0
+    fi
+
+    exec "/usr/bin/glint" "$@"
 fi
 
-exec "/usr/bin/glint" "$@"
diff --git a/bin/run_tests b/bin/run_tests
index ed2212b..d32b571 100755
--- a/bin/run_tests
+++ b/bin/run_tests
@@ -10,4 +10,4 @@
 
 cd "${bin_dir}/.."
 
-pytest lib
+pipenv run pytest lib