示例#1
0
def test_prepending_variable_already_here():
    env = {"PATH": "/foo:/bar"}
    envsetter = qisys.envsetter.EnvSetter(build_env=env)
    envsetter.prepend_to_path("/baz")
    envsetter.prepend_to_path("/foo")
    actual = envsetter.get_build_env()["PATH"]
    assert actual == "/foo:/baz:/bar"
示例#2
0
 def test_prepend_to_path(self):
     previous_path = os.environ["PATH"]
     envsetter = qisys.envsetter.EnvSetter()
     envsetter.prepend_to_path(self.unlikely)
     build_env = envsetter.get_build_env()
     self.assertEquals(os.environ["PATH"], previous_path)
     new_path = build_env["PATH"]
     self._check_is_in_path(self.unlikely, new_path)
示例#3
0
 def test_prepend_to_path(self):
     previous_path = os.environ["PATH"]
     envsetter = qisys.envsetter.EnvSetter()
     envsetter.prepend_to_path(self.unlikely)
     build_env = envsetter.get_build_env()
     self.assertEquals(os.environ["PATH"], previous_path)
     new_path = build_env["PATH"]
     self._check_is_in_path(self.unlikely, new_path)
示例#4
0
 def test_prepend_to_path_multi(self):
     """ Adding a directory containing os.path.sep should do the smart thing """
     envsetter = qisys.envsetter.EnvSetter()
     to_add = self.unlikely + os.path.pathsep + self.absurd
     envsetter.prepend_to_path(to_add)
     env_path = envsetter.get_build_env()["PATH"]
     self._check_is_in_path(self.unlikely, env_path)
     self._check_is_in_path(self.absurd, env_path)
示例#5
0
 def test_prepend_to_path_multi(self):
     # Adding a directory containing os.path.sep should
     # do the smart thing:
     envsetter = qisys.envsetter.EnvSetter()
     to_add = self.unlikely + os.path.pathsep + self.absurd
     envsetter.prepend_to_path(to_add)
     env_path = envsetter.get_build_env()["PATH"]
     self._check_is_in_path(self.unlikely, env_path)
     self._check_is_in_path(self.absurd, env_path)
示例#6
0
def test_prepending_variable_already_here():
    env = {
            "PATH" : "/foo:/bar"
    }
    envsetter = qisys.envsetter.EnvSetter(build_env=env)
    envsetter.prepend_to_path("/baz")
    envsetter.prepend_to_path("/foo")
    actual = envsetter.get_build_env()["PATH"]
    assert actual == "/foo:/baz:/bar"
示例#7
0
 def test_prepend_to_path_several_times(self):
     # adding two different paths should work
     previous_path = os.environ["PATH"]
     envsetter = qisys.envsetter.EnvSetter()
     envsetter.prepend_to_path(self.unlikely)
     envsetter.prepend_to_path(self.absurd)
     path_env = envsetter.get_build_env()["PATH"]
     self.assertEquals(os.environ["PATH"], previous_path)
     self._check_is_in_path(self.unlikely, path_env)
     self._check_is_in_path(self.absurd, path_env)
示例#8
0
 def test_prepend_to_path_several_times(self):
     # adding two different paths should work
     previous_path = os.environ["PATH"]
     envsetter = qisys.envsetter.EnvSetter()
     envsetter.prepend_to_path(self.unlikely)
     envsetter.prepend_to_path(self.absurd)
     path_env = envsetter.get_build_env()["PATH"]
     self.assertEquals(os.environ["PATH"], previous_path)
     self._check_is_in_path(self.unlikely, path_env)
     self._check_is_in_path(self.absurd  , path_env)
示例#9
0
 def test_prepend_to_path_twice_the_same(self):
     # adding the same path twice should be a no-op
     previous_path = os.environ["PATH"]
     envsetter = qisys.envsetter.EnvSetter()
     envsetter.prepend_to_path(self.unlikely)
     path_env1 = envsetter.get_build_env()["PATH"]
     envsetter.prepend_to_path(self.unlikely)
     path_env2 = envsetter.get_build_env()["PATH"]
     self.assertEquals(os.environ["PATH"], previous_path)
     self.assertEquals(path_env1, path_env2)
     self._check_is_in_path(self.unlikely, path_env1)
示例#10
0
 def test_prepend_to_path_twice_the_same(self):
     # adding the same path twice should be a no-op
     previous_path = os.environ["PATH"]
     envsetter = qisys.envsetter.EnvSetter()
     envsetter.prepend_to_path(self.unlikely)
     path_env1 = envsetter.get_build_env()["PATH"]
     envsetter.prepend_to_path(self.unlikely)
     path_env2 = envsetter.get_build_env()["PATH"]
     self.assertEquals(os.environ["PATH"], previous_path)
     self.assertEquals(path_env1, path_env2)
     self._check_is_in_path(self.unlikely, path_env1)