Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
sudo: false
language: python
python:
- '2.7'
install:
- pip install tox
env:
- TOX_ENV=py27-test
- TOX_ENV=py33-test
- TOX_ENV=py34-test
script:
- tox -e $TOX_ENV
deploy:
provider: pypi
user: mattbennett
password:
secure: nS/snIn4e/AWu3yrpzDLPXB+wHXXVU0qLdf07ldUxBx3lJ5K4ggqM1o6huP+ny2lZM6Q+jlRaYj0L6Tb/pppC7Pimx+dni9EFHXvLVO5sLD80+qV/AQPf7tbdWY6FWBV8kMGpXPwdnbKRGnQ17nerBJUfvL0dxigGoAqpOgwxppw/qNk0J3ay2AUnKUnWUKUXgATBLH72MSW6/iT84asIV6jOlfmRLpFKiO42emyBmYTo/TwM6lkjLG465gI2oWc/2sVTR6rkq00Yz5AC3Ry/pUZYfg55M3hTgHSQ54qtd/7IlbsP9inYTiZGsYkDaHlKsM1DdXreApVIo7LzRfCblMGrGvQfZm3BVMmmOWGSzM9dqBOXxjVcG9xHoG4/jzxGJ40gXX4cRS0AgkAWak2Q34QKj30FIBeLrZNzpDUmyPrKFBkfLi8CR8pW06m0Kxs3XWoUvP7ajVocbGnQHXQpz4q7FoKmnXhg0u9XyJTdtZAMt/h7aN9Bb2N0Zfasex025dB93Z2qLmwMVYkwQhIxjfw4vCstq9t+q67JKDMP4O6T7ektJ1Qt2TNR2BEr0/V/r5uplH5qyNH8PKL5YV9afyI+f1Dbdk+8wsRBGFJOm+rHg/JLtkzpTjNeAy4VYsYb8R+1rRe9IyBR7ti0mpW22lemhAHUUdaaol7mZm5yTI=
on:
tags: true
repo: Overseas-Student-Living/sqlalchemy-diff
18 changes: 6 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
.PHONY: test

HTMLCOV_DIR ?= htmlcov
test: flake8 pylint pytest

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just curious why you use both flake8 and pylint? the other projects just seem to use flake8?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They pick up different errors. Flake8 is pyflakes + pep8 checking, whereas pylint has its own set of rules. There is some overlap but it's nicer to use both.


test: flake8 test_lib
pylint:
pylint sqlalchemydiff -E

flake8:
flake8 sqlalchemydiff test

test_lib:
coverage run --source=sqlalchemydiff -m pytest test $(ARGS)

coverage-html: test
coverage html -d $(HTMLCOV_DIR)

coverage-report: test
coverage report -m

coverage: coverage-html coverage-report test
pytest:
coverage run --source=sqlalchemydiff --branch -m pytest test $(ARGS)
coverage report --show-missing --fail-under=100
25 changes: 18 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,37 @@ SQLAlchemy Diff
inspection API.


Documentation
-------------

See `<http://sqlalchemy-diff.readthedocs.org>`_.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super nice! 🌮



Running tests
-------------

Makefile targets that can be used to run the tests.
Tests are written with pytest. Makefile targets to invoke tests are also provided for convenience.

Test databases will be created, used during the tests and destroyed afterwards.

Example of usage:
Example:

.. code-block:: shell
$ # using default settings
$ pytest test
$ make test
$ make coverage
$ # or overridding the database URI
$ pytest test --test-db-url=mysql+mysqlconnector://root:password@localhost:3306/sqlalchemydiff
# or
$ py.test test
$ # overridding the database URI
$ py.test test --test-db-url=mysql+mysqlconnector://root:password@localhost:3306/sqlalchemydiff
# or
$ make test ARGS="--test-db-url=mysql+mysqlconnector://root:password@localhost:3306/sqlalchemydiff"
$ make coverage ARGS="--lf -x -vv --test-db-url=mysql+mysqlconnector://root:password@localhost:3306/sqlalchemydiff"
# providing other pytest args via Make
$ make test ARGS="--lf -x -vv"
License
Expand Down
6 changes: 5 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@
"six>=1.10.0",
"sqlalchemy-utils>=0.32.4",
],
dependency_links=[
'https://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.1.4.zip'
],
extras_require={
'dev': [
"mock==2.0.0",
"mysql-connector-python==2.0.4",
"mysql-connector-python==2.1.4",
"pytest==3.0.3",
"pylint==1.5.1",
"flake8==3.0.4",
"coverage==4.2",
],
Expand Down
4 changes: 2 additions & 2 deletions test/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ def pytest_addoption(parser):
action='store',
dest='TEST_DB_URL',
default=(
'mysql+mysqlconnector://root:password@localhost:3306/'
'mysql+mysqlconnector://root:@localhost:3306/'
'sqlalchemydiff'
),
help=(
'DB url for testing (e.g. '
'"mysql+mysqlconnector://root:password@localhost:3306/'
'"mysql+mysqlconnector://root:@localhost:3306/'
'sqlalchemydiff''")'
)
)
7 changes: 7 additions & 0 deletions test/unit/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ def test_dump_errors(self):

os.unlink(filename)

def test_dump_with_null_filename(self):
errors = {'some': 'errors'}
result = CompareResult({}, errors)

expected_dump = json.dumps(errors, indent=4, sort_keys=True)
assert result.dump_errors(filename=None) == expected_dump


class TestInspectorFactory(object):

Expand Down
9 changes: 5 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
[tox]
envlist = py27,py33,py34
envlist = {py27,py33,py34}-test
skipdist=True
skip_missing_interpreters=True

[testenv]
whitelist_externals = make

commands =
pip install -e ".[dev]" --process-dependency-links
py.test
pip install --editable .[dev] --process-dependency-links
make test