Beispiel #1
0
 def test_current_directory_has_precendence(self):
     dname = self.tempdir()
     shutil.copyfile(os.path.join(self.systemdir, 'cmd.exe'),
                     os.path.join(dname, 'cmd.exe'))
     os.chdir(self.root)
     cmd1 = which('cmd.exe')
     os.chdir(dname)
     cmd2 = which('cmd.exe')
     assert cmd1.lower() != cmd2.lower()
Beispiel #2
0
 def test_no_path(self):
     os.environ['Path'] = ''
     os.chdir(self.root)
     assert which('cmd.exe') is None
     assert which(os.path.join(self.systemdir, 'cmd.exe')) is not None
Beispiel #3
0
 def test_current_directory(self):
     os.environ['Path'] = ''
     os.chdir(self.root)
     assert which('cmd.exe') is None
     os.chdir(self.systemdir)
     assert which('cmd.exe') is not None
Beispiel #4
0
 def test_absolute_path(self):
     assert which(os.path.join(self.systemdir, 'cmd.exe')) is not None
Beispiel #5
0
 def test_extensions(self):
     assert which('cmd').lower().endswith('.exe')
     assert which('cmd.exe').lower() == which('cmd').lower()
     assert which('chcp').lower().endswith('.com')
     assert which('chcp.com').lower() == which('chcp').lower()
Beispiel #6
0
 def test_simple(self):
     assert which('cmd.exe') is not None
     assert which('chcp.com') is not None