def test_add_envs_dont_call_set_when_variables_dont_change(self):
     plugin = ApprcWatcher("", "", 1)
     envs = copy.deepcopy(NOPATH_OUTPUT)
     envs["options"]["env"].update(os.environ)
     plugin.call, kw = create_fake_call(None, envs)
     plugin.add_envs(name="name", envs=NOPATH_OUTPUT["options"]["env"])
     self.assertEqual([], kw)
Esempio n. 2
0
 def test_add_envs_dont_call_set_when_variables_dont_change(self):
     plugin = ApprcWatcher("", "", 1)
     envs = copy.deepcopy(NOPATH_OUTPUT)
     envs["options"]["env"].update(os.environ)
     plugin.call, kw = create_fake_call(None, envs)
     plugin.add_envs(name="name", envs=NOPATH_OUTPUT["options"]["env"])
     self.assertEqual([], kw)
 def test_add_envs(self):
     plugin = ApprcWatcher("", "", 1)
     plugin.call, kw = create_fake_call(None)
     plugin.add_envs(name="name", envs={"foo": "bar"})
     env = copy.deepcopy(os.environ)
     env["foo"] = "bar"
     expected = [{"name": "name", "options": {"env": env}}]
     self.assertEqual(expected, kw)
Esempio n. 4
0
 def test_add_envs(self):
     plugin = ApprcWatcher("", "", 1)
     plugin.call, kw = create_fake_call(None)
     plugin.add_envs(name="name", envs={"foo": "bar"})
     env = copy.deepcopy(os.environ)
     env["foo"] = "bar"
     expected = [{"name": "name", "options": {"env": env}}]
     self.assertEqual(expected, kw)
Esempio n. 5
0
 def test_add_env_doesnt_ignore_PYTHONPATH_from_apprc(self):
     plugin = ApprcWatcher("", "", 1)
     plugin.call, kw = create_fake_call(None)
     plugin.add_envs(name="name", envs={"foo": "bar",
                                        "PYTHONPATH": "/usr/lib/python"})
     env = copy.deepcopy(os.environ)
     env["foo"] = "bar"
     env["PYTHONPATH"] = "/usr/lib/python"
     expected = [{"name": "name", "options": {"env": env}}]
     self.assertEqual(expected, kw)
 def test_add_env_ignores_PYTHONPATH_from_os_environ(self):
     os.environ["PYTHONPATH"] = "/home/user/python"
     self.addCleanup(remove_env, "PYTHONPATH")
     plugin = ApprcWatcher("", "", 1)
     plugin.call, kw = create_fake_call(None)
     plugin.add_envs(name="name", envs={"foo": "bar"})
     env = copy.deepcopy(os.environ)
     env["foo"] = "bar"
     del env["PYTHONPATH"]
     expected = [{"name": "name", "options": {"env": env}}]
     self.assertEqual(expected, kw)
Esempio n. 7
0
 def test_add_env_ignores_PYTHONPATH_from_os_environ(self):
     os.environ["PYTHONPATH"] = "/home/user/python"
     self.addCleanup(remove_env, "PYTHONPATH")
     plugin = ApprcWatcher("", "", 1)
     plugin.call, kw = create_fake_call(None)
     plugin.add_envs(name="name", envs={"foo": "bar"})
     env = copy.deepcopy(os.environ)
     env["foo"] = "bar"
     del env["PYTHONPATH"]
     expected = [{"name": "name", "options": {"env": env}}]
     self.assertEqual(expected, kw)
Esempio n. 8
0
 def test_add_envs_may_override_os_environ(self):
     os.environ["SOMETHING_UNKNOWN"] = "123"
     self.addCleanup(remove_env, "SOMETHING_UNKNOWN")
     plugin = ApprcWatcher("", "", 1)
     plugin.call, kw = create_fake_call(None)
     plugin.add_envs(name="name", envs={"foo": "bar",
                                        "SOMETHING_UNKNOWN": "456"})
     env = copy.deepcopy(os.environ)
     env["SOMETHING_UNKNOWN"] = "456"
     env["foo"] = "bar"
     expected = [{"name": "name", "options": {"env": env}}]
     self.assertEqual(expected, kw)
 def test_add_env_doesnt_ignore_PYTHONPATH_from_apprc(self):
     plugin = ApprcWatcher("", "", 1)
     plugin.call, kw = create_fake_call(None)
     plugin.add_envs(name="name",
                     envs={
                         "foo": "bar",
                         "PYTHONPATH": "/usr/lib/python"
                     })
     env = copy.deepcopy(os.environ)
     env["foo"] = "bar"
     env["PYTHONPATH"] = "/usr/lib/python"
     expected = [{"name": "name", "options": {"env": env}}]
     self.assertEqual(expected, kw)
Esempio n. 10
0
 def test_add_envs_may_override_os_environ(self):
     os.environ["SOMETHING_UNKNOWN"] = "123"
     self.addCleanup(remove_env, "SOMETHING_UNKNOWN")
     plugin = ApprcWatcher("", "", 1)
     plugin.call, kw = create_fake_call(None)
     plugin.add_envs(name="name",
                     envs={
                         "foo": "bar",
                         "SOMETHING_UNKNOWN": "456"
                     })
     env = copy.deepcopy(os.environ)
     env["SOMETHING_UNKNOWN"] = "456"
     env["foo"] = "bar"
     expected = [{"name": "name", "options": {"env": env}}]
     self.assertEqual(expected, kw)