Skip to content

Commit 16d0595

Browse files
committed
Rename the plugin to 'pytest-flask-sqlalchemy'
1 parent 4f3111e commit 16d0595

File tree

9 files changed

+21
-20
lines changed

9 files changed

+21
-20
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
*.egg-info
22
__pycache__
3+
.pytest_cache
34
.cache

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,10 @@ whose blog post ["Delightful testing with pytest and
448448
Flask-SQLAlchemy"](http://alexmic.net/flask-sqlalchemy-pytest/) helped
449449
establish the basic approach on which this plugin builds.
450450

451+
Many thanks to [Igor Ghisi](https://github.com/igortg/), who donated the PyPi
452+
package name. Igor had been working on a similar plugin and proposed combining
453+
efforts. Thanks to Igor, the plugin name is much stronger.
454+
451455
## <a name="copyright"></a>Copyright
452456

453457
Copyright (c) 2018 Jean Cochrane and DataMade. Released under the MIT License.
File renamed without changes.

transactions/fixtures.py renamed to pytest_flask_sqlalchemy/fixtures.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ def _db():
1212
Session object that can access the test database. If the user hasn't defined
1313
that fixture, raise an error.
1414
'''
15-
msg = ("_db fixture not defined. The pytest-flask-sqlalchemy-transactions plugin " +
16-
"requires you to define a _db fixture that returns a SQLAlchemy session " +
15+
msg = ("_db fixture not defined. The pytest-flask-sqlalchemy plugin " +
16+
"requires you to define a _db fixture that returns a SQLAlchemy Session " +
1717
"with access to your test database. For more information, see the plugin " +
1818
"documentation: " +
19-
"https://github.com/jeancochrane/pytest-flask-sqlalchemy-transactions#conftest-setup")
19+
"https://github.com/jeancochrane/pytest-flask-sqlalchemy#conftest-setup")
2020

2121
raise NotImplementedError(msg)
2222

File renamed without changes.

setup.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
'''
2-
pytest-flask-sqlalchemy-transactions
3-
====================================
4-
5-
Run tests in transactions using pytest, Flask, and SQLAlchemy.
6-
'''
71
from setuptools import setup
82

93

@@ -12,16 +6,16 @@ def readme():
126
return f.read()
137

148
setup(
15-
name='pytest-flask-sqlalchemy-transactions',
9+
name='pytest-flask-sqlalchemy',
1610
author='Jean Cochrane',
1711
author_email='[email protected]',
18-
url='https://github.com/jeancochrane/pytest-flask-sqlalchemy-transactions',
19-
description='Run tests in transactions using pytest, Flask, and SQLalchemy.',
12+
url='https://github.com/jeancochrane/pytest-flask-sqlalchemy',
13+
description='A pytest plugin for preserving test isolation in Flask-SQlAlchemy using database transactions.',
2014
long_description=readme(),
2115
long_description_content_type='text/markdown',
2216
license='MIT',
23-
version='1.0.1',
24-
packages=['transactions'],
17+
version='1.0.0',
18+
packages=['pytest_flask_sqlalchemy'],
2519
install_requires=['pytest>=3.2.1',
2620
'pytest-mock>=1.6.2',
2721
'SQLAlchemy>=1.2.2',
@@ -42,7 +36,7 @@ def readme():
4236
# Make the package available to pytest
4337
entry_points={
4438
'pytest11': [
45-
'pytest-flask-sqlalchemy-transactions = transactions.plugin',
39+
'pytest-flask-sqlalchemy = pytest_flask_sqlalchemy.plugin',
4640
]
4741
},
4842
)

tests/_conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
else:
2020
DB_OPTS = sa.engine.url.make_url(DB_CONN).translate_connect_args()
2121

22-
pytest_plugins = ['pytest-flask-sqlalchemy-transactions']
22+
pytest_plugins = ['pytest-flask-sqlalchemy']
2323

2424

2525
@pytest.fixture(scope='session')

tests/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
import pytest
24

35
# This import prevents SQLAlchemy from throwing an AttributeError
@@ -14,7 +16,7 @@ def conftest():
1416
Load configuration file for the tests to a string, in order to run it in
1517
its own temporary directory.
1618
'''
17-
with open('tests/_conftest.py', 'r') as conf:
19+
with open(os.path.join('tests', '_conftest.py'), 'r') as conf:
1820
conftest = conf.read()
1921

2022
return conftest

tests/test_configs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ def test_mocked_sessionmakers(db_testdir):
5353
db_testdir.makepyfile("""
5454
def test_mocked_sessionmakers(db_session):
5555
from collections import namedtuple, Counter
56-
assert str(namedtuple).startswith("<transactions.fixtures._session.<locals>.FakeSessionMaker")
57-
assert str(Counter).startswith("<transactions.fixtures._session.<locals>.FakeSessionMaker")
56+
assert str(namedtuple).startswith("<pytest_flask_sqlalchemy.fixtures._session.<locals>.FakeSessionMaker")
57+
assert str(Counter).startswith("<pytest_flask_sqlalchemy.fixtures._session.<locals>.FakeSessionMaker")
5858
""")
5959

6060
result = db_testdir.runpytest()
@@ -88,7 +88,7 @@ def test_missing_db_fixture(testdir):
8888
else:
8989
DB_OPTS = sa.engine.url.make_url(DB_CONN).translate_connect_args()
9090
91-
pytest_plugins = ['pytest-flask-sqlalchemy-transactions']
91+
pytest_plugins = ['pytest-flask-sqlalchemy']
9292
9393
9494
@pytest.fixture(scope='session')

0 commit comments

Comments
 (0)