Repository: openmined/pysyft
Issue: Test share for keras does not work on macos in a virtual env

**Describe the bug**
Due to firewall issues, it is not possible to run test share on macos in a venv. This can be remedied by replacing network calls with mock.
**To Reproduce**
run make_test on a fresh macos install


**Additional context**
contact @robert-wagner to replicate as it is still broken on his system


Changed files:
syft/workers/tfe.py, test/keras/test_sequential.py, syft/frameworks/keras/model/sequential.py

diff --git a/syft/frameworks/keras/model/sequential.py b/syft/frameworks/keras/model/sequential.py
index eef07fc6b..e023e403b 100644
--- a/syft/frameworks/keras/model/sequential.py
+++ b/syft/frameworks/keras/model/sequential.py
@@ -15,7 +15,7 @@ _args_not_supported_by_tfe = [
 ]
 
 
-def share(model, *workers, target_graph=None):  # pragma: no cover
+def share(model, *workers, target_graph=None):
     """
     Secret share the model between `workers`.
 
@@ -58,7 +58,6 @@ def share(model, *workers, target_graph=None):  # pragma: no cover
 
     # Push and initialize shared model on servers
     sess = tfe.Session(graph=target_graph)
-    tf.Session.reset(sess.target)
     sess.run(initializer)
 
     model._tfe_session = sess
diff --git a/syft/workers/tfe.py b/syft/workers/tfe.py
index a44e88547..9be35dc06 100644
--- a/syft/workers/tfe.py
+++ b/syft/workers/tfe.py
@@ -19,6 +19,10 @@ class TFEWorker:
         self._auto_managed = auto_managed
 
     def start(self, player_name, *workers):
+        if self.host is None:
+            # we're running using a tfe.LocalConfig which doesn't require us to do anything
+            return
+
         config_filename = "/tmp/tfe.config"
 
         config, _ = self.config_from_workers(workers)
@@ -42,6 +46,10 @@ class TFEWorker:
             )
 
     def stop(self):
+        if self.host is None:
+            # we're running using a tfe.LocalConfig which doesn't require us to do anything
+            return
+
         if self._auto_managed:
             if self._server_process is None:
                 return
@@ -87,9 +95,16 @@ class TFEWorker:
         player_to_worker_mapping["server1"] = workers[1]
         player_to_worker_mapping["server2"] = workers[2]
 
+        use_local_config = all(worker.host is None for worker in workers)
+        if use_local_config:
+            config = tfe.LocalConfig(
+                player_names=player_to_worker_mapping.keys(), auto_add_unknown_players=False
+            )
+            return config, player_to_worker_mapping
+
+        # use tfe.RemoteConfig
         hostmap = OrderedDict(
             [(player_name, worker.host) for player_name, worker in player_to_worker_mapping.items()]
         )
         config = tfe.RemoteConfig(hostmap)
-
         return config, player_to_worker_mapping
diff --git a/test/keras/test_sequential.py b/test/keras/test_sequential.py
index 4724df5cf..58b32cf2b 100644
--- a/test/keras/test_sequential.py
+++ b/test/keras/test_sequential.py
@@ -43,8 +43,7 @@ def test_instantiate_tfe_layer():
     np.testing.assert_allclose(actual, expected, rtol=0.001)
 
 
-@pytest.mark.skip(reason="Currently breaks on macos")
-def test_share():  # pragma: no cover
+def test_share():
 
     from tensorflow.keras import Sequential
     from tensorflow.keras.layers import Dense
@@ -62,10 +61,9 @@ def test_share():  # pragma: no cover
         Dense(5, kernel_initializer=initializer, batch_input_shape=input_shape, use_bias=True)
     )
 
-    AUTO = True
-    alice = sy.TFEWorker(host="localhost:4000", auto_managed=AUTO)
-    bob = sy.TFEWorker(host="localhost:4001", auto_managed=AUTO)
-    carol = sy.TFEWorker(host="localhost:4002", auto_managed=AUTO)
+    alice = sy.TFEWorker(host=None)
+    bob = sy.TFEWorker(host=None)
+    carol = sy.TFEWorker(host=None)
 
     model.share(alice, bob, carol)