Пример #1
0
 def test__eq(self):
     prog1 = Executable(sys.executable)
     prog2 = Executable(sys.executable)
     prog3 = Executable("/bin/ls")
     self.assertEqual(prog1, prog2)
     assert prog1 != prog3
Пример #2
0
 def test__str(self):
     prog = Executable(sys.executable)
     str(prog)
Пример #3
0
 def test__init__with_only_prog_name__should_try_to_find_full_path(self):
     prog = Executable("ls")
     actual_path = check_output("which ls",
                                shell=True).decode('utf-8').strip()
     self.assertEqual(prog.path, actual_path)
Пример #4
0
 def test__init__should_find_version_if_possible(self):
     #prog = Executable("/bin/ls")
     #self.assertEqual(prog.version, None) # this is true on Darwin, but not on Ubuntu
     prog = Executable(sys.executable)
     python_version = "%d.%d.%d" % tuple(sys.version_info[:3])
     self.assertEqual(prog.version, python_version)
Пример #5
0
 def test__init__with_a_full_path_should_just_set_it(self):
     prog = Executable("/bin/ls")
     self.assertEqual(prog.path, "/bin/ls")