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_dir(path)
def test_file(self): with tempfile.NamedTemporaryFile() as f: with self.assertRaises(cargparse.ValidationFailed): cargparse.require_dir(f.name)
def test_char_special(self): with self.assertRaises(cargparse.ValidationFailed): cargparse.require_dir('/dev/null')
def test_doesnt_exist(self): with temporary_directory() as d: with self.assertRaises(cargparse.ValidationFailed): cargparse.require_dir(os.path.join(d, 'doesnt-exist'))
def test_dir(self): with temporary_directory() as d: cargparse.require_dir(d)