Skip to content

Commit b374f0d

Browse files
authored
Merge pull request #8 from Overseas-Student-Living/build-on-travis
Build on travis
2 parents 86e0bd5 + c1a37ef commit b374f0d

File tree

7 files changed

+63
-26
lines changed

7 files changed

+63
-26
lines changed

.travis.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
sudo: false
2+
language: python
3+
python:
4+
- '2.7'
5+
install:
6+
- pip install tox
7+
env:
8+
- TOX_ENV=py27-test
9+
- TOX_ENV=py33-test
10+
- TOX_ENV=py34-test
11+
script:
12+
- tox -e $TOX_ENV
13+
deploy:
14+
provider: pypi
15+
user: mattbennett
16+
password:
17+
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=
18+
on:
19+
tags: true
20+
repo: Overseas-Student-Living/sqlalchemy-diff

Makefile

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
.PHONY: test
22

3-
HTMLCOV_DIR ?= htmlcov
3+
test: flake8 pylint pytest
44

5-
test: flake8 test_lib
5+
pylint:
6+
pylint sqlalchemydiff -E
67

78
flake8:
89
flake8 sqlalchemydiff test
910

10-
test_lib:
11-
coverage run --source=sqlalchemydiff -m pytest test $(ARGS)
12-
13-
coverage-html: test
14-
coverage html -d $(HTMLCOV_DIR)
15-
16-
coverage-report: test
17-
coverage report -m
18-
19-
coverage: coverage-html coverage-report test
11+
pytest:
12+
coverage run --source=sqlalchemydiff --branch -m pytest test $(ARGS)
13+
coverage report --show-missing --fail-under=100

README.rst

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,37 @@ SQLAlchemy Diff
77
inspection API.
88

99

10+
Documentation
11+
-------------
12+
13+
See `<http://sqlalchemy-diff.readthedocs.org>`_.
14+
15+
1016
Running tests
1117
-------------
1218

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

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

17-
Example of usage:
23+
Example:
1824

1925
.. code-block:: shell
2026
2127
$ # using default settings
22-
$ pytest test
2328
$ make test
24-
$ make coverage
2529
26-
$ # or overridding the database URI
27-
$ pytest test --test-db-url=mysql+mysqlconnector://root:password@localhost:3306/sqlalchemydiff
30+
# or
31+
$ py.test test
32+
33+
$ # overridding the database URI
34+
$ py.test test --test-db-url=mysql+mysqlconnector://root:password@localhost:3306/sqlalchemydiff
35+
36+
# or
2837
$ make test ARGS="--test-db-url=mysql+mysqlconnector://root:password@localhost:3306/sqlalchemydiff"
29-
$ make coverage ARGS="--lf -x -vv --test-db-url=mysql+mysqlconnector://root:password@localhost:3306/sqlalchemydiff"
38+
39+
# providing other pytest args via Make
40+
$ make test ARGS="--lf -x -vv"
3041
3142
3243
License

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@
2424
"six>=1.10.0",
2525
"sqlalchemy-utils>=0.32.4",
2626
],
27+
dependency_links=[
28+
'https://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.1.4.zip'
29+
],
2730
extras_require={
2831
'dev': [
2932
"mock==2.0.0",
30-
"mysql-connector-python==2.0.4",
33+
"mysql-connector-python==2.1.4",
3134
"pytest==3.0.3",
35+
"pylint==1.5.1",
3236
"flake8==3.0.4",
3337
"coverage==4.2",
3438
],

test/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ def pytest_addoption(parser):
1212
action='store',
1313
dest='TEST_DB_URL',
1414
default=(
15-
'mysql+mysqlconnector://root:password@localhost:3306/'
15+
'mysql+mysqlconnector://root:@localhost:3306/'
1616
'sqlalchemydiff'
1717
),
1818
help=(
1919
'DB url for testing (e.g. '
20-
'"mysql+mysqlconnector://root:password@localhost:3306/'
20+
'"mysql+mysqlconnector://root:@localhost:3306/'
2121
'sqlalchemydiff''")'
2222
)
2323
)

test/unit/test_util.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ def test_dump_errors(self):
5252

5353
os.unlink(filename)
5454

55+
def test_dump_with_null_filename(self):
56+
errors = {'some': 'errors'}
57+
result = CompareResult({}, errors)
58+
59+
expected_dump = json.dumps(errors, indent=4, sort_keys=True)
60+
assert result.dump_errors(filename=None) == expected_dump
61+
5562

5663
class TestInspectorFactory(object):
5764

tox.ini

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
[tox]
2-
envlist = py27,py33,py34
2+
envlist = {py27,py33,py34}-test
33
skipdist=True
4-
skip_missing_interpreters=True
54

65
[testenv]
6+
whitelist_externals = make
7+
78
commands =
8-
pip install -e ".[dev]" --process-dependency-links
9-
py.test
9+
pip install --editable .[dev] --process-dependency-links
10+
make test

0 commit comments

Comments
 (0)