Skip to content

Commit 9d870d1

Browse files
committed
add flake8 linting to tox config, switch travis CI to use tox (with tox-travis), remove travis specified requirements.txt files
switch to use mysqlclient-python fork of MySQL-python for running tests remove dangling print statements from unit-test file, add test sub-dir as target for flake8 in tox config remove branches safelist from travis CI config add tox:travis directive to run coverage and lint targets in travis fix typo in tox:travis section to invoke coverage add flake8 config to setup.cfg, impose max line length of 120
1 parent 66f28e6 commit 9d870d1

File tree

6 files changed

+21
-44
lines changed

6 files changed

+21
-44
lines changed

.travis.yml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
# http://travis-ci.org/#!/gjhiggins/rdflib-sqlalchemy
22
language: python
3-
branches:
4-
only:
5-
- master
6-
- idkey
73
env:
84
- DB=pgsql
95
- DB=mysql
@@ -15,17 +11,9 @@ python:
1511
- 3.4
1612
- 3.5
1713
install:
18-
- if [[ ${TRAVIS_PYTHON_VERSION%%.*} == '2' ]]; then pip install -r requirements-py2.txt; fi
19-
- if [[ ${TRAVIS_PYTHON_VERSION%%.*} == '3' ]]; then pip install -r requirements-py3.txt; fi
20-
- python setup.py install
14+
- pip install -U setuptools tox tox-travis
2115
before_script:
2216
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'DROP DATABASE IF EXISTS test;' -U postgres; psql -c 'create database test;' -U postgres; export DBURI='postgresql+psycopg2://postgres@localhost/test'; fi"
23-
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'create database IF NOT EXISTS test'; export DBURI='mysql+mysqldb://test@localhost/test?charset=utf8'; fi"
17+
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE IF NOT EXISTS test'; export DBURI='mysql+mysqldb://test@localhost/test?charset=utf8'; fi"
2418
- sh -c "if [ '$DB' = 'sqlite' ]; then export DBURI='sqlite:///%(here)s/test.sqlite'; fi"
25-
script:
26-
# Must cd somewhere else so python3 doesn't get confused and run
27-
# the python2 code from the current directory instead of the installed
28-
# 2to3 version.
29-
- if [[ ${TRAVIS_PYTHON_VERSION%%.*} == '2' ]]; then PYTHONWARNINGS=default nosetests --with-coverage --cover-tests --cover-package=rdflib_sqlalchemy ; fi
30-
- if [[ ${TRAVIS_PYTHON_VERSION%%.*} == '3' ]]; then PYTHONWARNINGS=default nosetests --with-coverage --cover-tests --cover-package=build/src/rdflib_sqlalchemy --where=./build/src; fi
31-
19+
script: tox

requirements-py2.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

requirements-py3.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

setup.cfg

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ tag_build = .dev
33
tag_date = false
44

55
[nosetests]
6-
76
attr = !known_issue,!performancetest
87
verbosity = 2
9-
#with-doctest = 1
10-
11-
128

9+
[flake8]
10+
max-line-length = 120
11+
max-complexity = 15

test/test_aggregate_graphs.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ class GraphAggregates2(unittest.TestCase):
127127
def setUp(self):
128128
memStore = plugin.get('SQLAlchemy', Store)(
129129
identifier="rdflib_test", configuration=Literal("sqlite://"))
130-
print("ASDF")
131130
self.graph1 = Graph(memStore, URIRef("http://example.com/graph1"))
132131
self.graph2 = Graph(memStore, URIRef("http://example.com/graph2"))
133132
self.graph3 = Graph(memStore, URIRef("http://example.com/graph3"))
@@ -137,9 +136,7 @@ def setUp(self):
137136
(testGraph3N3, self.graph3)]:
138137
graph.parse(StringIO(n3Str), format='n3')
139138
self.graph4 = Graph(memStore, RDFS.uri)
140-
print("ASDF B")
141139
self.graph4.parse(RDFS.uri)
142-
print("ASDF C")
143140
self.G = ConjunctiveGraph(memStore)
144141

145142
def testAggregateSPARQL(self):

tox.ini

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tox]
22
envlist =
3-
py26,py27,cover,py34,py35
3+
py26,py27,py34,py35,cover,lint
44

55
[testenv]
66
passenv = DB DBURI
@@ -10,7 +10,7 @@ commands =
1010
deps =
1111
nose
1212
psycopg2
13-
MySQL-python
13+
mysqlclient
1414

1515
[testenv:py34]
1616
basepython = python3.4
@@ -22,7 +22,7 @@ deps =
2222
nose
2323
psycopg2
2424
http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.0.4.zip
25-
git+https://github.com/PyMySQL/mysqlclient-python#egg=MySQLdb
25+
mysqlclient
2626

2727
[testenv:py35]
2828
basepython = python3.5
@@ -34,7 +34,14 @@ deps =
3434
nose
3535
psycopg2
3636
http://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-2.0.4.zip
37-
git+https://github.com/PyMySQL/mysqlclient-python#egg=MySQLdb
37+
mysqlclient
38+
39+
[testenv:lint]
40+
basepython = python3
41+
commands = flake8 rdflib_sqlalchemy test
42+
deps=
43+
flake8
44+
flake8-print
3845

3946
[testenv:cover]
4047
basepython = python2.7
@@ -46,11 +53,8 @@ deps =
4653
nose
4754
coverage
4855
psycopg2
49-
MySQL-python
50-
51-
# we separate coverage into its own testenv because a) "last run wins" wrt
52-
# cobertura jenkins reporting and b) pypy and jython can't handle any
53-
# combination of versions of coverage and nosexcover that i can find.
54-
# coverage <3.4 is required by nosexcover 1.0.4.
56+
mysqlclient
5557

56-
# DB='pgsql' DBURI='postgresql+psycopg2://user:password@host/dbname' tox -e py32
58+
[tox:travis]
59+
2.7 = py27, cover, lint
60+
3.5 = py35, lint

0 commit comments

Comments
 (0)