25 lines
814 B
Python
25 lines
814 B
Python
import pathlib
|
|
import sys
|
|
import unittest
|
|
|
|
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
|
|
|
|
from loop_state.paths import RELEASE_ROOT, with_release_tools
|
|
|
|
TOOLS = str(RELEASE_ROOT / "bin")
|
|
|
|
|
|
class WithReleaseTools(unittest.TestCase):
|
|
def test_puts_the_releases_tools_first_on_path_and_keeps_every_other_variable(self):
|
|
self.assertEqual(with_release_tools({"PATH": "/usr/bin:/bin", "HOME": "/h"}), {"PATH": f"{TOOLS}:/usr/bin:/bin", "HOME": "/h"})
|
|
|
|
def test_leaves_a_path_that_already_opens_with_the_tools_as_it_is(self):
|
|
self.assertEqual(with_release_tools({"PATH": f"{TOOLS}:/bin"}), {"PATH": f"{TOOLS}:/bin"})
|
|
|
|
def test_an_environment_without_a_path_gets_the_tools_alone(self):
|
|
self.assertEqual(with_release_tools({}), {"PATH": TOOLS})
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|