Exemplo n.º 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()
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 4
0
 def test_absolute_path(self):
     assert which(os.path.join(self.systemdir, 'cmd.exe')) is not None
Exemplo n.º 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()
Exemplo n.º 6
0
 def test_simple(self):
     assert which('cmd.exe') is not None
     assert which('chcp.com') is not None