pex_pytest migration (#2333)
diff --git a/heron/common/tests/python/pex_loader/BUILD b/heron/common/tests/python/pex_loader/BUILD
index 75bd9e9..735c207 100644
--- a/heron/common/tests/python/pex_loader/BUILD
+++ b/heron/common/tests/python/pex_loader/BUILD
@@ -1,15 +1,15 @@
package(default_visibility = ["//visibility:public"])
-pex_test(
+pex_pytest(
name = "pex_loader_unittest",
srcs = ["pex_loader_unittest.py", "constants.py"],
deps = [
"//heron/common/src/python:common-py",
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
diff --git a/heron/executor/tests/python/BUILD b/heron/executor/tests/python/BUILD
index 0ca8391..38b2cad 100644
--- a/heron/executor/tests/python/BUILD
+++ b/heron/executor/tests/python/BUILD
@@ -1,15 +1,15 @@
package(default_visibility = ["//visibility:public"])
-pex_test(
+pex_pytest(
name = "executor_unittest",
srcs = ["heron_executor_unittest.py"],
deps = [
"//heron/executor/src/python:executor-py",
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
-)
+)
\ No newline at end of file
diff --git a/heron/executor/tests/python/heron_executor_unittest.py b/heron/executor/tests/python/heron_executor_unittest.py
index 67b8fa6..a5a2d7a 100644
--- a/heron/executor/tests/python/heron_executor_unittest.py
+++ b/heron/executor/tests/python/heron_executor_unittest.py
@@ -15,6 +15,7 @@
import os
import socket
import unittest2 as unittest
+import json
from heron.executor.src.python.heron_executor import ProcessInfo
from heron.executor.src.python.heron_executor import HeronExecutor
@@ -264,9 +265,17 @@
self.executor_1.update_packing_plan(self.packing_plan_expected)
current_commands = self.executor_1.get_commands_to_run()
- self.assertEquals(dict(
+ temp_dict = dict(
map((lambda (process_info): (process_info.name, process_info.command.split(' '))),
- self.expected_processes_container_1)), current_commands)
+ self.expected_processes_container_1))
+
+ current_json = json.dumps(current_commands, sort_keys=True)
+ temp_json = json.dumps(temp_dict, sort_keys=True)
+
+ print current_json
+ print temp_json
+
+ self.assertEquals(current_json, temp_json)
# update instance distribution
new_packing_plan = self.build_packing_plan(
@@ -295,3 +304,4 @@
self.assertEquals(expected_process.name, found_processes[pid].name)
self.assertEquals(expected_process.command, found_processes[pid].command_str)
self.assertEquals(1, found_processes[pid].attempts)
+
diff --git a/heron/instance/tests/python/BUILD b/heron/instance/tests/python/BUILD
index 73036d4..4776db2 100644
--- a/heron/instance/tests/python/BUILD
+++ b/heron/instance/tests/python/BUILD
@@ -8,9 +8,9 @@
"//heronpy/api:heron-python-py",
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
"mock==1.0.1",
],
)
diff --git a/heron/instance/tests/python/basics/BUILD b/heron/instance/tests/python/basics/BUILD
deleted file mode 100644
index ae2fe3b..0000000
--- a/heron/instance/tests/python/basics/BUILD
+++ /dev/null
@@ -1,15 +0,0 @@
-package(default_visibility = ["//visibility:public"])
-
-pex_test(
- name = "bolt_instance_unittest",
- srcs = ["bolt_instance_unittest.py"],
- deps = [
- "//heron/instance/tests/python:instance-tests-py",
- ],
- reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
- ],
- size = "small",
-)
diff --git a/heron/instance/tests/python/basics/bolt_instance_unittest.py b/heron/instance/tests/python/basics/bolt_instance_unittest.py
deleted file mode 100644
index 1ec1c5b..0000000
--- a/heron/instance/tests/python/basics/bolt_instance_unittest.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright 2016 Twitter. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# pylint: disable=missing-docstring
-# pylint: disable=protected-access
-import unittest
-
-class BoltInstanceTest(unittest.TestCase):
- def setUp(self):
- pass
diff --git a/heron/instance/tests/python/network/BUILD b/heron/instance/tests/python/network/BUILD
index 9258156..b83a614 100644
--- a/heron/instance/tests/python/network/BUILD
+++ b/heron/instance/tests/python/network/BUILD
@@ -22,7 +22,7 @@
]
)
-pex_test(
+pex_pytest(
name = "st_stmgrcli_unittest",
srcs = ["st_stmgr_client_unittest.py"],
deps = [
@@ -31,14 +31,14 @@
"//heron/instance/src/python:instance-py",
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "metricsmgr_client_unittest",
srcs = ["metricsmgr_client_unittest.py"],
deps = [
@@ -47,9 +47,9 @@
"//heron/instance/src/python:instance-py",
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
@@ -61,13 +61,13 @@
":instance-network-mock-client",
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
)
-pex_test(
+pex_pytest(
name = "protocol_unittest",
srcs = ["protocol_unittest.py"],
deps = [
@@ -76,14 +76,14 @@
"//heron/instance/src/python:instance-py",
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "heron_client_unittest",
srcs = ["heron_client_unittest.py"],
deps = [
@@ -92,38 +92,38 @@
"//heron/instance/src/python:instance-py",
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
"mock==1.0.1",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "gateway_looper_unittest",
srcs = ["gateway_looper_unittest.py"],
deps = [
"//heron/instance/src/python:instance-py",
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "event_looper_unittest",
srcs = ["event_looper_unittest.py"],
deps = [
"//heron/instance/src/python:instance-py",
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
diff --git a/heron/instance/tests/python/utils/BUILD b/heron/instance/tests/python/utils/BUILD
index f2a2cbb..3b55873 100644
--- a/heron/instance/tests/python/utils/BUILD
+++ b/heron/instance/tests/python/utils/BUILD
@@ -12,105 +12,105 @@
]
)
-pex_test(
+pex_pytest(
name = "communicator_unittest",
srcs = ["communicator_unittest.py"],
deps = [
"//heron/instance/tests/python/utils:common-utils-mock",
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "custom_grouping_unittest",
srcs = ["custom_grouping_unittest.py"],
deps = [
"//heron/instance/tests/python/utils:common-utils-mock"
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "metrics_helper_unittest",
srcs = ["metrics_helper_unittest.py"],
deps = [
"//heron/instance/tests/python/utils:common-utils-mock"
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "outgoing_tuple_helper_unittest",
srcs = ["outgoing_tuple_helper_unittest.py"],
deps = [
"//heron/instance/tests/python/utils:common-utils-mock"
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "pplan_helper_unittest",
srcs = ["pplan_helper_unittest.py"],
deps = [
"//heron/instance/tests/python/utils:common-utils-mock"
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "topology_context_impl_unittest",
srcs = ["topology_context_impl_unittest.py"],
deps = [
"//heron/instance/tests/python/utils:common-utils-mock"
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "tuple_helper_unittest",
srcs = ["tuple_helper_unittest.py"],
deps = [
"//heron/instance/tests/python/utils:common-utils-mock"
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "global_metrics_unittest",
srcs = ["global_metrics_unittest.py"],
deps = [
@@ -118,36 +118,36 @@
"//heron/instance/tests/python:instance-tests-py",
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "py_metrics_unittest",
srcs = ["py_metrics_unittest.py"],
deps = [
"//heron/instance/tests/python/utils:common-utils-mock"
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "log_unittest",
srcs = ["log_unittest.py"],
deps = [
"//heron/instance/tests/python/utils:common-utils-mock"
],
reqs = [
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
diff --git a/heron/statemgrs/tests/python/BUILD b/heron/statemgrs/tests/python/BUILD
index 7f408b1..a5427ee 100644
--- a/heron/statemgrs/tests/python/BUILD
+++ b/heron/statemgrs/tests/python/BUILD
@@ -1,6 +1,6 @@
package(default_visibility = ["//visibility:public"])
-pex_test(
+pex_pytest(
name = "configloader_unittest",
srcs = [
"configloader_unittest.py",
@@ -8,15 +8,18 @@
deps = [
"//heron/statemgrs/src/python:statemgr-py",
],
+ data = [
+ "//heron/config/src/yaml:conf-yaml"
+ ],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "zkstatemanager_unittest",
srcs = [
"zkstatemanager_unittest.py",
@@ -25,14 +28,14 @@
"//heron/statemgrs/src/python:statemgr-py",
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "statemanagerfactory_unittest",
srcs = [
"statemanagerfactory_unittest.py",
@@ -41,9 +44,9 @@
"//heron/statemgrs/src/python:statemgr-py",
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
diff --git a/heron/tools/cli/tests/python/BUILD b/heron/tools/cli/tests/python/BUILD
index c1b4ab2..825df63 100644
--- a/heron/tools/cli/tests/python/BUILD
+++ b/heron/tools/cli/tests/python/BUILD
@@ -1,20 +1,20 @@
package(default_visibility = ["//visibility:public"])
-pex_test(
+pex_pytest(
name = "opts_unittest",
srcs = ["opts_unittest.py"],
deps = [
"//heron/tools/cli/src/python:cli-py",
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "client_command_unittest",
srcs = ["client_command_unittest.py"],
deps = [
@@ -22,9 +22,9 @@
],
reqs = [
"mock==1.0.1",
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
diff --git a/heron/tools/explorer/tests/python/BUILD b/heron/tools/explorer/tests/python/BUILD
index c0ba7fc..3fec805 100644
--- a/heron/tools/explorer/tests/python/BUILD
+++ b/heron/tools/explorer/tests/python/BUILD
@@ -1,6 +1,6 @@
package(default_visibility = ["//visibility:public"])
-pex_test(
+pex_pytest(
name = "explorer_unittest",
srcs = ["explorer_unittest.py"],
deps = [
@@ -10,9 +10,9 @@
],
reqs = [
"mock==1.0.1",
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
diff --git a/heron/tools/tracker/tests/python/BUILD b/heron/tools/tracker/tests/python/BUILD
index d07f99d..2c752e1 100644
--- a/heron/tools/tracker/tests/python/BUILD
+++ b/heron/tools/tracker/tests/python/BUILD
@@ -9,23 +9,24 @@
],
)
-pex_test(
+pex_pytest(
name = "topology_unittest",
- srcs = ["topology_unittest.py"],
+ srcs = ["topology_unittest.py", "mock_proto.py"],
deps = [
- ":mock_proto",
"//heron/tools/tracker/src/python:tracker-py",
+ "//heron/proto:proto-py",
+ "//heronpy/api:heron-python-py",
],
reqs = [
"mock==1.0.1",
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "query_operator_unittest",
srcs = ["query_operator_unittest.py"],
deps = [
@@ -33,14 +34,14 @@
],
reqs = [
"mock==1.0.1",
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "query_unittest",
srcs = ["query_unittest.py"],
deps = [
@@ -48,14 +49,14 @@
],
reqs = [
"mock==1.0.1",
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "tracker_unittest",
srcs = ["tracker_unittest.py"],
deps = [
@@ -64,9 +65,9 @@
],
reqs = [
"mock==1.0.1",
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
diff --git a/heronpy/api/tests/python/BUILD b/heronpy/api/tests/python/BUILD
index 8b5defa..dc807bd 100644
--- a/heronpy/api/tests/python/BUILD
+++ b/heronpy/api/tests/python/BUILD
@@ -1,71 +1,71 @@
package(default_visibility = ["//visibility:public"])
-pex_test(
+pex_pytest(
name = "component_unittest",
srcs = ["component_unittest.py"],
deps = [
"//heronpy/api:heron-python-py",
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "stream_unittest",
srcs = ["stream_unittest.py"],
deps = [
"//heronpy/api:heron-python-py",
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "topology_unittest",
srcs = ["topology_unittest.py"],
deps = [
"//heronpy/api:heron-python-py",
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "serializer_unittest",
srcs = ["serializer_unittest.py"],
deps = [
"//heronpy/api:heron-python-py",
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
-pex_test(
+pex_pytest(
name = "metrics_unittest",
srcs = ["metrics_unittest.py"],
deps = [
"//heronpy/api:heron-python-py",
],
reqs = [
- "py==1.4.27",
- "pytest==2.6.4",
- "unittest2==0.5.1",
+ "py==1.4.34",
+ "pytest==3.2.2",
+ "unittest2==1.1.0",
],
size = "small",
)
diff --git a/tools/rules/pex/pex_rules.bzl b/tools/rules/pex/pex_rules.bzl
index 89f7252..426ac07 100644
--- a/tools/rules/pex/pex_rules.bzl
+++ b/tools/rules/pex/pex_rules.bzl
@@ -416,7 +416,7 @@
"launcher_template": attr.label(
allow_files = True,
single_file = True,
- default = Label("//pex:testlauncher.sh.template"),
+ default = Label("//tools/rules/pex:testlauncher.sh.template"),
),
}),
)