11import os
22from unittest import TestCase , mock
33
4- from interpreter .core .async_core import Server , AsyncInterpreter
4+ from interpreter .core .async_core import AsyncInterpreter , Server
55
66
77class TestServerConstruction (TestCase ):
@@ -20,7 +20,7 @@ def test_host_and_port_defaults(self):
2020 s = Server (AsyncInterpreter ())
2121 self .assertEqual (s .host , Server .DEFAULT_HOST )
2222 self .assertEqual (s .port , Server .DEFAULT_PORT )
23-
23+
2424 def test_host_and_port_passed_in (self ):
2525 """
2626 Tests that a Server object takes on the passed-in host and port when they are passed-in,
@@ -29,11 +29,14 @@ def test_host_and_port_passed_in(self):
2929 host = "the-really-real-host"
3030 port = 2222
3131
32- with mock .patch .dict (os .environ , {"HOST" : "this-is-supes-fake" , "PORT" : "9876" }):
32+ with mock .patch .dict (
33+ os .environ ,
34+ {"INTERPRETER_HOST" : "this-is-supes-fake" , "INTERPRETER_PORT" : "9876" },
35+ ):
3336 sboth = Server (AsyncInterpreter (), host , port )
3437 self .assertEqual (sboth .host , host )
3538 self .assertEqual (sboth .port , port )
36-
39+
3740 def test_host_and_port_from_env_1 (self ):
3841 """
3942 Tests that the Server object takes on the HOST and PORT env vars as host and port when
@@ -42,7 +45,10 @@ def test_host_and_port_from_env_1(self):
4245 fake_host = "fake_host"
4346 fake_port = 1234
4447
45- with mock .patch .dict (os .environ , {"HOST" : fake_host , "PORT" : str (fake_port )}):
48+ with mock .patch .dict (
49+ os .environ ,
50+ {"INTERPRETER_HOST" : fake_host , "INTERPRETER_PORT" : str (fake_port )},
51+ ):
4652 s = Server (AsyncInterpreter ())
4753 self .assertEqual (s .host , fake_host )
4854 self .assertEqual (s .port , fake_port )
0 commit comments