Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Commit cd42fa8

Browse files
authored
Strip old python requirements (#3569)
* Remove enum34+future+argparse * Remove six * DRY up zkstatemanager.py * Remove pycrypto * Remove external dependancies for unittest2+mock+py
1 parent 8a825e4 commit cd42fa8

File tree

53 files changed

+78
-236
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+78
-236
lines changed

heron/common/tests/python/pex_loader/BUILD

-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ pex_pytest(
88
"pex_loader_unittest.py",
99
],
1010
reqs = [
11-
"py==1.4.34",
1211
"pytest==3.2.2",
13-
"unittest2==1.1.0",
1412
],
1513
deps = [
1614
"//heron/common/src/python:common-py",

heron/executor/tests/python/BUILD

-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ pex_pytest(
55
size = "small",
66
srcs = ["heron_executor_unittest.py"],
77
reqs = [
8-
"py==1.4.34",
98
"pytest==3.2.2",
10-
"unittest2==1.1.0",
119
],
1210
deps = [
1311
"//heron/executor/src/python:executor-py",

heron/executor/tests/python/heron_executor_unittest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
'''heron executor unittest'''
2222
import os
2323
import socket
24-
import unittest2 as unittest
24+
import unittest
2525
import json
2626

2727
from pprint import pprint

heron/instance/src/python/BUILD

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ pex_binary(
1818
srcs = ["instance/st_heron_instance.py"],
1919
reqs = [
2020
"colorlog==2.6.1",
21-
"future==0.18.2",
2221
"PyYAML==3.13",
2322
],
2423
deps = [":instance-py"],

heron/instance/tests/python/BUILD

-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ pex_library(
44
name = "instance-tests-py",
55
srcs = ["mock_protobuf.py"],
66
reqs = [
7-
"py==1.4.34",
87
"pytest==3.2.2",
9-
"unittest2==1.1.0",
10-
"mock==1.0.1",
11-
"future==0.18.2",
128
],
139
deps = [
1410
"//heron/proto:proto-py",

heron/instance/tests/python/network/BUILD

-17
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ pex_library(
44
name = "instance-network-mock",
55
srcs = ["mock_generator.py"],
66
reqs = [
7-
"mock==1.0.1",
87
],
98
deps = [
109
"//heron/instance/tests/python:instance-tests-py",
@@ -15,7 +14,6 @@ pex_library(
1514
name = "instance-network-mock-client",
1615
srcs = ["mock_generator_client.py"],
1716
reqs = [
18-
"mock==1.0.1",
1917
],
2018
deps = [
2119
"//heron/instance/tests/python:instance-tests-py",
@@ -27,9 +25,7 @@ pex_pytest(
2725
size = "small",
2826
srcs = ["st_stmgr_client_unittest.py"],
2927
reqs = [
30-
"py==1.4.34",
3128
"pytest==3.2.2",
32-
"unittest2==1.1.0",
3329
],
3430
deps = [
3531
":instance-network-mock",
@@ -43,9 +39,7 @@ pex_pytest(
4339
size = "small",
4440
srcs = ["metricsmgr_client_unittest.py"],
4541
reqs = [
46-
"py==1.4.34",
4742
"pytest==3.2.2",
48-
"unittest2==1.1.0",
4943
],
5044
deps = [
5145
":pytest-network-py",
@@ -58,9 +52,7 @@ pex_library(
5852
name = "pytest-network-py",
5953
srcs = ["mock_generator.py"],
6054
reqs = [
61-
"py==1.4.34",
6255
"pytest==3.2.2",
63-
"unittest2==1.1.0",
6456
],
6557
deps = [
6658
":instance-network-mock-client",
@@ -72,9 +64,7 @@ pex_pytest(
7264
size = "small",
7365
srcs = ["protocol_unittest.py"],
7466
reqs = [
75-
"py==1.4.34",
7667
"pytest==3.2.2",
77-
"unittest2==1.1.0",
7868
],
7969
deps = [
8070
":pytest-network-py",
@@ -88,10 +78,7 @@ pex_pytest(
8878
size = "small",
8979
srcs = ["heron_client_unittest.py"],
9080
reqs = [
91-
"py==1.4.34",
9281
"pytest==3.2.2",
93-
"unittest2==1.1.0",
94-
"mock==1.0.1",
9582
],
9683
deps = [
9784
":pytest-network-py",
@@ -105,9 +92,7 @@ pex_pytest(
10592
size = "small",
10693
srcs = ["gateway_looper_unittest.py"],
10794
reqs = [
108-
"py==1.4.34",
10995
"pytest==3.2.2",
110-
"unittest2==1.1.0",
11196
],
11297
deps = [
11398
"//heron/instance/src/python:instance-py",
@@ -119,9 +104,7 @@ pex_pytest(
119104
size = "small",
120105
srcs = ["event_looper_unittest.py"],
121106
reqs = [
122-
"py==1.4.34",
123107
"pytest==3.2.2",
124-
"unittest2==1.1.0",
125108
],
126109
deps = [
127110
"//heron/instance/src/python:instance-py",

heron/instance/tests/python/network/event_looper_unittest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
'''Unittest for EventLooper'''
2222
import time
23-
import unittest2 as unittest
23+
import unittest
2424

2525
from heron.instance.src.python.network import EventLooper
2626

heron/instance/tests/python/network/gateway_looper_unittest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
'''Unittest for GatewayLooper'''
2222
import threading
2323
import time
24-
import unittest2 as unittest
24+
import unittest
2525

2626
from heron.instance.src.python.network.gateway_looper import GatewayLooper
2727

heron/instance/tests/python/network/heron_client_unittest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# pylint: disable=missing-docstring
2323
# pylint: disable=protected-access
2424

25-
import unittest2 as unittest
25+
import unittest
2626
from heron.instance.src.python.network import StatusCode
2727
import heron.instance.tests.python.network.mock_generator_client as mock_generator
2828
import heron.instance.tests.python.mock_protobuf as mock_protobuf

heron/instance/tests/python/network/mock_generator.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
from heron.instance.src.python.network import SingleThreadStmgrClient, MetricsManagerClient
2727
from heron.instance.src.python.network import SocketOptions
2828
import heron.instance.tests.python.mock_protobuf as mock_protobuf
29-
from mock import Mock
29+
from unittest.mock import Mock
3030

31-
from mock import patch
31+
from unittest.mock import patch
3232

3333
class MockSTStmgrClient(SingleThreadStmgrClient):
3434
HOST = '127.0.0.1'

heron/instance/tests/python/network/protocol_unittest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121

2222
# pylint: disable=missing-docstring
23-
import unittest2 as unittest
23+
import unittest
2424
from heron.instance.src.python.network import REQID, HeronProtocol, IncomingPacket
2525
import heron.instance.tests.python.network.mock_generator_client as mock_generator
2626

heron/instance/tests/python/utils/BUILD

-20
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ pex_library(
44
name = "common-utils-mock",
55
srcs = ["mock_generator.py"],
66
reqs = [
7-
"mock==1.0.1",
87
],
98
deps = [
109
"//heron/instance/src/python:instance-py",
@@ -17,9 +16,7 @@ pex_pytest(
1716
size = "small",
1817
srcs = ["communicator_unittest.py"],
1918
reqs = [
20-
"py==1.4.34",
2119
"pytest==3.2.2",
22-
"unittest2==1.1.0",
2320
],
2421
deps = [
2522
"//heron/instance/tests/python/utils:common-utils-mock",
@@ -31,9 +28,7 @@ pex_pytest(
3128
size = "small",
3229
srcs = ["custom_grouping_unittest.py"],
3330
reqs = [
34-
"py==1.4.34",
3531
"pytest==3.2.2",
36-
"unittest2==1.1.0",
3732
],
3833
deps = [
3934
"//heron/instance/tests/python/utils:common-utils-mock",
@@ -45,9 +40,7 @@ pex_pytest(
4540
size = "small",
4641
srcs = ["metrics_helper_unittest.py"],
4742
reqs = [
48-
"py==1.4.34",
4943
"pytest==3.2.2",
50-
"unittest2==1.1.0",
5144
],
5245
deps = [
5346
"//heron/instance/tests/python/utils:common-utils-mock",
@@ -59,9 +52,7 @@ pex_pytest(
5952
size = "small",
6053
srcs = ["outgoing_tuple_helper_unittest.py"],
6154
reqs = [
62-
"py==1.4.34",
6355
"pytest==3.2.2",
64-
"unittest2==1.1.0",
6556
],
6657
deps = [
6758
"//heron/instance/tests/python/utils:common-utils-mock",
@@ -73,9 +64,7 @@ pex_pytest(
7364
size = "small",
7465
srcs = ["pplan_helper_unittest.py"],
7566
reqs = [
76-
"py==1.4.34",
7767
"pytest==3.2.2",
78-
"unittest2==1.1.0",
7968
],
8069
deps = [
8170
"//heron/instance/tests/python/utils:common-utils-mock",
@@ -87,9 +76,7 @@ pex_pytest(
8776
size = "small",
8877
srcs = ["topology_context_impl_unittest.py"],
8978
reqs = [
90-
"py==1.4.34",
9179
"pytest==3.2.2",
92-
"unittest2==1.1.0",
9380
],
9481
deps = [
9582
"//heron/instance/tests/python/utils:common-utils-mock",
@@ -101,9 +88,7 @@ pex_pytest(
10188
size = "small",
10289
srcs = ["tuple_helper_unittest.py"],
10390
reqs = [
104-
"py==1.4.34",
10591
"pytest==3.2.2",
106-
"unittest2==1.1.0",
10792
],
10893
deps = [
10994
"//heron/instance/tests/python/utils:common-utils-mock",
@@ -115,9 +100,7 @@ pex_pytest(
115100
size = "small",
116101
srcs = ["global_metrics_unittest.py"],
117102
reqs = [
118-
"py==1.4.34",
119103
"pytest==3.2.2",
120-
"unittest2==1.1.0",
121104
],
122105
deps = [
123106
":common-utils-mock",
@@ -130,9 +113,7 @@ pex_pytest(
130113
size = "small",
131114
srcs = ["py_metrics_unittest.py"],
132115
reqs = [
133-
"py==1.4.34",
134116
"pytest==3.2.2",
135-
"unittest2==1.1.0",
136117
],
137118
deps = [
138119
"//heron/instance/tests/python/utils:common-utils-mock",
@@ -145,7 +126,6 @@ pex_pytest(
145126
srcs = ["log_unittest.py"],
146127
reqs = [
147128
"pytest==3.2.2",
148-
"unittest2==1.1.0",
149129
],
150130
deps = [
151131
"//heron/instance/tests/python/utils:common-utils-mock",

heron/instance/tests/python/utils/log_unittest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
# pylint: disable=missing-docstring
2323

2424
import unittest
25-
from mock import patch, Mock, call
25+
from unittest.mock import patch, Mock, call
2626
from io import StringIO
2727

2828
from heron.common.src.python.utils import proc

heron/instance/tests/python/utils/mock_generator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
# pylint: disable=unused-argument
2525
# pylint: disable=missing-docstring
2626
import random
27-
from mock import patch
27+
from unittest.mock import patch
2828

2929
from heronpy.api.task_hook import ITaskHook
3030
from heronpy.api.custom_grouping import ICustomGrouping

heron/instance/tests/python/utils/py_metrics_unittest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
# pylint: disable=missing-docstring
2323
from collections import namedtuple
24-
from mock import Mock, patch
24+
from unittest.mock import Mock, patch
2525
import unittest
2626
import threading
2727

heron/shell/src/python/BUILD

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ pex_library(
88
reqs = [
99
"requests==2.12.3",
1010
"tornado==4.0.2",
11-
"future==0.18.2",
1211
],
1312
deps = [
1413
"//heron/common/src/python:common-py",

heron/shell/src/python/handlers/killexecutorhandler.py

-4
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@
2020

2121

2222
''' killexecutorhandler.py '''
23-
# pylint: disable=wrong-import-order
24-
from future.standard_library import install_aliases
25-
install_aliases()
26-
2723
import logging
2824
import os
2925
import signal

heron/statemgrs/src/python/statemanager.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
import socket
2525
import subprocess
26-
import six
2726

2827
from heron.statemgrs.src.python.log import Log as LOG
2928

@@ -35,7 +34,7 @@
3534
HERON_TOPOLOGIES_KEY = "{0}/topologies"
3635

3736
# pylint: disable=too-many-public-methods, attribute-defined-outside-init
38-
class StateManager(six.with_metaclass(abc.ABCMeta)):
37+
class StateManager(metaclass=abc.ABCMeta):
3938
"""
4039
This is the abstract base class for state manager. It provides methods to get/set/delete various
4140
state from the state store. The getters accept an optional callback, which will watch for state

0 commit comments

Comments
 (0)