Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rename pyramid_sqla to sqlahelper.

--HG--
rename : pyramid_sqla.py => sqlahelper.py
  • Loading branch information...
commit 3707b36a3e5053b502fdbe7ec99e807f34490aed 1 parent 02a9d6b
@mikeorr mikeorr authored
View
6 .hgignore
@@ -1,12 +1,8 @@
syntax: glob
.coverage
-pyramid_sqla.egg-info
+SQLAHelper.egg-info
*.egg
*.pyc
dist/
docs/_build
env26/
-
-syntax: regexp
-^pyramid_sqla/pyramid_sqla.egg-info
-^unfinished/.*egg-info
View
28 CHANGES.txt
@@ -1,13 +1,17 @@
-1.0rc3 (unreleased)
--------------------
-- Clone repository 'pyramid_akhet' from 'pyramid_sqla'.
+1.0b1 (unreleased)
+------------------
+
+Repository sqlahelper created
+------------------------------
+- Clone repository 'sqlahelper' from 'pyramid_sqla'.
- Delete application template and non-SQLAlchemy code; they're now in
pyramid_akhet-1.0b1.
-- Change ``pyramid_sqla`` from a package to a module.
+- Rename ``pyramid_sqla`` to ``sqlahelper`` and change it from a package to a
+ module.
- Move pyramid_sqla/tests/test.py to tests.py.
-1.0rc2 (2010-02-20, never released)
------------------------------------
+pylons_sqla-1.0rc2 (2010-02-20, never released)
+-----------------------------------------------
- ``add_static_route`` is now a Pyramid config method if you call the new
``includeme`` function. This is used in the application template.
- Add ``pyramid_sqla`` as a dependency in the application template.
@@ -18,23 +22,23 @@
- Delete unneeded development code in static.py.
- Set Mako's 'strict_undefined' option in the application template.
-1.0rc1 (2010-01-26)
---------------------
+pyramid_sqla-1.0rc1 (2010-01-26)
+---------------------------------
- 'pyramid_sqla' application template supports commit veto feature in
repoze.tm2 1.0b1.
- Add production.ini to application template.
- Delete stray files in application template that were accidentally included.
-0.2 (2011-01-19)
------------------
+pyramid_sqla-0.2 (2011-01-19)
+------------------------------
- Pyramid 1.0a10 spins off view handler support to 'pyramid_handlers' package.
- 'pyramid_sqla' application template depends on Pyramid>=1.0a10.
-0.1 (2011-01-12)
------------------
+pyramid_sqla-0.1 (2011-01-12)
+------------------------------
- Initial release.
- Warning: a change in Pyramid 1.0a10 broke applications created using the
View
2  setup.cfg
@@ -2,7 +2,7 @@
zip_ok = false
[nosetests]
-cover-package = pyramid_sqla
+cover-package = sqlahelper
nocapture = 1
cover-erase = 1
match = ^test
View
15 setup.py
@@ -18,28 +18,27 @@
entry_points = """
"""
-setup(name='pyramid_sqla',
- version='1.0rc2',
- description='A SQLAlchemy library for Pyramid applications',
+setup(name='SQLAHelper',
+ version='1.0b1',
+ description='A convenience library SQLAlchemy web applications',
long_description=README + '\n\n' + CHANGES,
classifiers=[
"Intended Audience :: Developers",
- "Framework :: Pylons",
"Programming Language :: Python",
"License :: OSI Approved :: MIT License",
"Topic :: Database",
],
- keywords='web wsgi pylons pyramid',
+ keywords='',
author="Mike Orr",
author_email="sluggoster@gmail.com",
url="http://docs.pylonshq.com",
license="MIT",
- py_modules=["pyramid_sqla"],
+ py_modules=["sqlahelper"],
include_package_data=True,
zip_safe=False,
tests_require=tests_require,
- install_requires = ["SQLAlchemy", "zope.sqlalchemy"],
- test_suite="pyramid_sqla",
+ install_requires = requires,
+ test_suite="sqlahelper",
entry_points=entry_points,
)
View
0  pyramid_sqla.py → sqlahelper.py
File renamed without changes
View
70 tests.py
@@ -6,7 +6,7 @@
import sqlalchemy as sa
from sqlalchemy.engine.base import Engine
-import pyramid_sqla as psqla
+import sqlahelper as sa_helper
class DBInfo(object):
def __init__(self, dir, filename):
@@ -21,7 +21,7 @@ def setUp(self):
self.db3 = DBInfo(self.dir, "db3.sqlite")
def tearDown(self):
- psqla.reset()
+ sa_helper.reset()
shutil.rmtree(self.dir, True)
if not hasattr(unittest.TestCase, "assertIsInstance"): # pragma: no cover
@@ -43,17 +43,17 @@ def assertIs(self, a, b):
class TestAddEngine(PyramidSQLATestCase):
def test_keyword_args(self):
- engine = psqla.add_engine(url=self.db1.url)
+ engine = sa_helper.add_engine(url=self.db1.url)
self.assertIsInstance(engine, Engine)
def test_simplest_settings(self):
settings = {"sqlalchemy.url": self.db1.url}
- engine = psqla.add_engine(settings, prefix="sqlalchemy.")
+ engine = sa_helper.add_engine(settings, prefix="sqlalchemy.")
self.assertIsInstance(engine, Engine)
def test_existing_engine(self):
e = sa.create_engine(self.db1.url)
- engine = psqla.add_engine(engine=e)
+ engine = sa_helper.add_engine(engine=e)
self.assertIs(engine, e)
def test_multiple_engines(self):
@@ -61,47 +61,47 @@ def test_multiple_engines(self):
"sqlalchemy.url": self.db1.url,
"stats.url": self.db2.url,
"foo": "bar"}
- default = psqla.add_engine(settings)
- stats = psqla.add_engine(settings, name="stats", prefix="stats.")
+ default = sa_helper.add_engine(settings)
+ stats = sa_helper.add_engine(settings, name="stats", prefix="stats.")
# Can we retrieve the engines?
- self.assertIs(psqla.get_engine(), default)
- self.assertIs(psqla.get_engine("default"), default)
- self.assertIs(psqla.get_engine("stats"), stats)
+ self.assertIs(sa_helper.get_engine(), default)
+ self.assertIs(sa_helper.get_engine("default"), default)
+ self.assertIs(sa_helper.get_engine("stats"), stats)
# Are the session binding and base binding set correctly?
- self.assertIs(psqla.get_session().bind, default)
- self.assertIs(psqla.get_base().metadata.bind, default)
+ self.assertIs(sa_helper.get_session().bind, default)
+ self.assertIs(sa_helper.get_base().metadata.bind, default)
def test_multiple_engines_without_default(self):
settings = {
"db1.url": self.db1.url,
"db2.url": self.db2.url,
"foo": "bar"}
- db1 = psqla.add_engine(settings, name="db1", prefix="db1.")
- db2 = psqla.add_engine(settings, name="db2", prefix="db2.")
+ db1 = sa_helper.add_engine(settings, name="db1", prefix="db1.")
+ db2 = sa_helper.add_engine(settings, name="db2", prefix="db2.")
# Can we retrieve the engines?
- self.assertIs(psqla.get_engine("db1"), db1)
- self.assertIs(psqla.get_engine("db2"), db2)
+ self.assertIs(sa_helper.get_engine("db1"), db1)
+ self.assertIs(sa_helper.get_engine("db2"), db2)
# There should be no default engine
- self.assertIs(psqla.get_session().bind, None)
- self.assertIs(psqla.get_base().metadata.bind, None)
- self.assertRaises(RuntimeError, psqla.get_engine)
+ self.assertIs(sa_helper.get_session().bind, None)
+ self.assertIs(sa_helper.get_base().metadata.bind, None)
+ self.assertRaises(RuntimeError, sa_helper.get_engine)
class TestDeclarativeBase(PyramidSQLATestCase):
def test1(self):
import transaction
- Base = psqla.get_base()
+ Base = sa_helper.get_base()
class Person(Base):
__tablename__ = "people"
id = sa.Column(sa.Integer, primary_key=True)
first_name = sa.Column(sa.Unicode(100), nullable=False)
last_name = sa.Column(sa.Unicode(100), nullable=False)
- psqla.add_engine(url=self.db1.url)
+ sa_helper.add_engine(url=self.db1.url)
Base.metadata.create_all()
fred = Person(id=1, first_name=u"Fred", last_name=u"Flintstone")
wilma = Person(id=2, first_name=u"Wilma", last_name=u"Flintstone")
barney = Person(id=3, first_name=u"Barney", last_name=u"Rubble")
betty = Person(id=4, first_name=u"Betty", last_name=u"Rubble")
- Session = psqla.get_session()
+ Session = sa_helper.get_session()
sess = Session()
sess.add_all([fred, wilma, barney, betty])
transaction.commit()
@@ -120,19 +120,19 @@ class Person(Base):
self.assertEqual(result, control)
def test1_without_transaction_manager(self):
- Base = psqla.get_base()
+ Base = sa_helper.get_base()
class Person(Base):
__tablename__ = "people"
id = sa.Column(sa.Integer, primary_key=True)
first_name = sa.Column(sa.Unicode(100), nullable=False)
last_name = sa.Column(sa.Unicode(100), nullable=False)
- psqla.add_engine(url=self.db1.url)
+ sa_helper.add_engine(url=self.db1.url)
Base.metadata.create_all()
fred = Person(id=1, first_name=u"Fred", last_name=u"Flintstone")
wilma = Person(id=2, first_name=u"Wilma", last_name=u"Flintstone")
barney = Person(id=3, first_name=u"Barney", last_name=u"Rubble")
betty = Person(id=4, first_name=u"Betty", last_name=u"Rubble")
- Session = psqla.get_session()
+ Session = sa_helper.get_session()
Session.configure(extension=None) # XXX Kludge for SQLAlchemy/ZopeTransactionExtension bug
sess = Session()
sess.add_all([fred, wilma, barney, betty])
@@ -156,21 +156,21 @@ def setUp(self):
self.engines = {}
self.session = DummySession()
self.base = DummyBase()
- self.old_engines = psqla._engines
- self.old_base = psqla._base
- self.old_session = psqla._session
- psqla._engines = self.engines
- psqla._base = self.base
- psqla._session = self.session
+ self.old_engines = sa_helper._engines
+ self.old_base = sa_helper._base
+ self.old_session = sa_helper._session
+ sa_helper._engines = self.engines
+ sa_helper._base = self.base
+ sa_helper._session = self.session
def tearDown(self):
- psqla._engines = self.old_engines
- psqla._base = self.old_base
- psqla._session = self.old_session
+ sa_helper._engines = self.old_engines
+ sa_helper._base = self.old_base
+ sa_helper._session = self.old_session
def _callFUT(self, settings=None, name='default', prefix='sqlalchemy.',
engine=None, **engine_args):
- return psqla.add_engine(
+ return sa_helper.add_engine(
settings=settings, name=name, prefix=prefix, engine=engine,
**engine_args)
Please sign in to comment.
Something went wrong with that request. Please try again.