Ejemplo n.º 1
0
from uuid import uuid4

import testdata

from prom import query
from prom.compat import *
from prom.model import Orm
from prom.config import Schema, DsnConnection, Field, Index
from prom.interface.postgres import PostgreSQL
from prom.interface.sqlite import SQLite
from prom.interface.base import Interface
from prom.interface import get_interfaces
import prom


testdata.basic_logging()


#os.environ.setdefault('PROM_SQLITE_DSN', 'prom.interface.sqlite.SQLite://:memory:')
os.environ.setdefault(
    'PROM_SQLITE_DSN',
    'prom.interface.sqlite.SQLite://{}.sqlite'.format(os.path.join(tempfile.gettempdir(), str(uuid4())))
)


class BaseTestCase(TestCase):

    connections = set()

    def tearDown(self):
        self.tearDownClass()
Ejemplo n.º 2
0
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, division, print_function, absolute_import
from unittest import TestCase
import os
from contextlib import contextmanager
import codecs
import datetime

import testdata

from wishlist.core import WishlistElement, Wishlist
from wishlist.exception import ParseError

testdata.basic_logging()


class BaseTestCase(TestCase):
    def get_body(self, filename):
        basepath = os.path.abspath(
            os.path.expanduser(os.path.dirname(__file__)))
        path = os.path.join(basepath, "testdata", filename)
        with codecs.open(path, encoding='utf-8', mode='r') as f:
            #with open(path) as f:
            body = f.read()
        return body


class WishlistElementTest(BaseTestCase):
    def get_item(self, filename):
        body = self.get_body(filename)
        we = WishlistElement(body)