Ejemplo n.º 1
0
def load(fname):
    """
	Convert a exa configuration format to its dictionary representation
	Can raise InvalidFormat and all file related exceptions such as IOError
	"""
    with Reader(fname) as reader:
        return json.load(reader)
Ejemplo n.º 2
0
def load (fname):
	"""
	Convert a exa configuration format to its dictionary representation
	Can raise InvalidFormat and all file related exceptions such as IOError
	"""
	with Reader(fname) as reader:
		return json.load(reader)
Ejemplo n.º 3
0
def test ():
	from exabgp.configuration.json import load,JSONError

	try:
		name = _make_config()
	except:
		return 'could not create temp file'

	try:
		json = load(name)
	except JSONError,e:
		os.remove(name)
		return 'configuration parsing file: %s' % str(e)
Ejemplo n.º 4
0
def test():
    from exabgp.configuration.json import load, JSONError

    try:
        name = _make_config()
    except:
        return 'could not create temp file'

    try:
        json = load(name)
    except JSONError, e:
        os.remove(name)
        return 'configuration parsing file: %s' % str(e)
Ejemplo n.º 5
0
		f.write(configuration)
	print 'created'
	return name


def test ():
	from exabgp.configuration.json import load
from exabgp.configuration.json import JSONError

	try:
		name = _make_config()
	except:
		return 'could not create temp file'

	try:
		json = load(name)
	except JSONError,e:
		os.remove(name)
		return 'configuration parsing file: %s' % str(e)

	del json

class TestData (unittest.TestCase):

	def test_1 (self):
		if not os.environ.get('profile',False):
			result = test()
			if result: self.fail(result)

	def test_2 (self):
		if not not os.environ.get('profile',False):