Exemplo n.º 1
0
 def test_char_special(self):
     with self.assertRaises(cargparse.ValidationFailed):
         cargparse.require_file('/dev/null')
Exemplo n.º 2
0
 def test_dir(self):
     with temporary_directory() as d:
         with self.assertRaises(cargparse.ValidationFailed):
             cargparse.require_file(d)
Exemplo n.º 3
0
 def test_file(self):
     with tempfile.NamedTemporaryFile() as f:
         cargparse.require_file(f.name)
Exemplo n.º 4
0
 def test_fifo(self):
     with temporary_directory() as d:
         path = os.path.join(d, 'fifo')
         os.mkfifo(path)
         with self.assertRaises(cargparse.ValidationFailed):
             cargparse.require_file(path)
Exemplo n.º 5
0
 def test_doesnt_exist(self):
     with temporary_directory() as d:
         with self.assertRaises(cargparse.ValidationFailed):
             cargparse.require_file(os.path.join(d, 'doesnt-exist'))
Exemplo n.º 6
0
 def test_file(self):
     with tempfile.NamedTemporaryFile() as f:
         cargparse.require_file(f.name)
Exemplo n.º 7
0
 def test_dir(self):
     with temporary_directory() as d:
         with self.assertRaises(cargparse.ValidationFailed):
             cargparse.require_file(d)
Exemplo n.º 8
0
 def test_doesnt_exist(self):
     with temporary_directory() as d:
         with self.assertRaises(cargparse.ValidationFailed):
             cargparse.require_file(os.path.join(d, 'doesnt-exist'))
Exemplo n.º 9
0
 def test_fifo(self):
     with temporary_directory() as d:
         path = os.path.join(d, 'fifo')
         os.mkfifo(path)
         with self.assertRaises(cargparse.ValidationFailed):
             cargparse.require_file(path)
Exemplo n.º 10
0
 def test_char_special(self):
     with self.assertRaises(cargparse.ValidationFailed):
         cargparse.require_file('/dev/null')