test_analyzer: separate running_unittests & integration tests.
BUG=chromium:818020
TEST=Ran bin/run_unittests, bin/run_integration_tests.
Change-Id: Ief4fba5692362fb3aa93747f8bd070e61c8fe439
Reviewed-on: https://chromium-review.googlesource.com/963547
Tested-by: Xixuan Wu <xixuan@chromium.org>
Trybot-Ready: Xixuan Wu <xixuan@chromium.org>
Reviewed-by: Shuhei Takahashi <nya@chromium.org>
Reviewed-by: Paul Hobbs <phobbs@google.com>
Commit-Queue: Xixuan Wu <xixuan@chromium.org>
diff --git a/README.md b/README.md
index a1a7faf..7e2f698 100644
--- a/README.md
+++ b/README.md
@@ -15,8 +15,8 @@
For unittest:
- bin/run_tests
+ bin/run_unittests
For integration test:
- pipenv run pytest test_analyzer/integration_test/
+ bin/run_integration_tests
diff --git a/bin/run_integration_tests b/bin/run_integration_tests
new file mode 100755
index 0000000..22caee0
--- /dev/null
+++ b/bin/run_integration_tests
@@ -0,0 +1,11 @@
+#!/bin/bash
+# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+#
+# Run unit tests.
+set -eu
+cd "$(dirname "$0")/.."
+
+# Only execute integration tests.
+exec pipenv run pytest test_analyzer/integration_test/
diff --git a/bin/run_tests b/bin/run_unittests
similarity index 78%
rename from bin/run_tests
rename to bin/run_unittests
index 083d192..366b28d 100755
--- a/bin/run_tests
+++ b/bin/run_unittests
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 2017 The Chromium OS Authors. All rights reserved.
+# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/test_analyzer/integration_test/bigquery_client_test.py b/test_analyzer/integration_test/bigquery_client_test.py
index 8ab9c62..0179044 100644
--- a/test_analyzer/integration_test/bigquery_client_test.py
+++ b/test_analyzer/integration_test/bigquery_client_test.py
@@ -8,21 +8,13 @@
from __future__ import division
from __future__ import print_function
-import unittest
-
from test_analyzer import bigquery_client
-class BigqueryClientTest(unittest.TestCase):
- """Tests for bigquery_client."""
-
- def testConnectionSuccessfully(self):
- project_name = 'google.com:chromeos-lab'
- bq_client = bigquery_client.CreateClient(project_name, is_stage=True)
- datasets = list(bq_client.list_datasets())
- dataset_ids = [d.dataset_id for d in datasets]
- self.assertIn('%s:ci_results' % project_name, dataset_ids)
-
-
-if __name__ == '__main__':
- unittest.main()
+def testConnectionSuccessfully():
+ """Test connections to real bigquery_dataset by bigquery client."""
+ project_name = 'google.com:chromeos-lab'
+ bq_client = bigquery_client.CreateClient(project_name, is_stage=True)
+ datasets = list(bq_client.list_datasets())
+ dataset_ids = [d.dataset_id for d in datasets]
+ assert '%s:ci_results' % project_name in dataset_ids