Skip to content

Commit f159544

Browse files
Update Travis config, add lint and format checks to tests
1 parent 707d56e commit f159544

27 files changed

+696
-704
lines changed

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ ignore-mixin-members=yes
263263
# (useful for modules/projects where namespaces are manipulated during runtime
264264
# and thus existing member attributes cannot be deduced by static analysis. It
265265
# supports qualified module names, as well as Unix pattern matching.
266-
ignored-modules=tensorflow.core.framework,tensorflow.python.framework,tensorflow.python.ops.gen_linalg_ops
266+
ignored-modules=tensorflow.core.framework,tensorflow.python.framework,tensorflow.python.ops.gen_linalg_ops,tensorflow.python.eager.context,tensorflow.compat.v1
267267

268268
# List of classes names for which member attributes should not be checked
269269
# (useful for classes with attributes dynamically set). This supports can work

.travis.yml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
dist: xenial
22
language: python
33

4-
matrix:
5-
include:
6-
- name: "Python 3.6 Lint"
7-
python: 3.6
8-
env: PYTHON_VERSION=3.6 NAME="LINT"
9-
- name: "Python 3.6 Unit Test"
10-
python: 3.6
11-
env: PYTHON_VERSION=3.6 NAME="UNIT"
4+
python:
5+
- "3.6"
6+
- "3.7"
7+
# No tf-nightly for this version
8+
# - "3.8"
9+
# Cython and/or Numpy fails with permission errors
10+
# - "pypy3"
1211

1312
install:
1413
- pip install -r requirements.txt
15-
- pip freeze
1614

1715
script:
18-
- if [[ $NAME == UNIT ]]; then pytest -v tests/ --cov=symbolic_pymc/; fi
19-
- if [[ $NAME == LINT ]]; then make lint; fi
16+
- pylint symbolic_pymc/ tests/
17+
- if [[ `command -v black` ]]; then
18+
black --check symbolic_pymc tests;
19+
fi
20+
- pytest -v tests/ --cov=symbolic_pymc/
2021

2122
after_success:
22-
- echo $(pwd)
23-
- ls -la
24-
- if [[ $NAME == UNIT ]]; then sed -i 's/\/opt\/symbolic-pymc/\/home\/travis\/build\/pymc-devs\/symbolic-pymc/g' .coverage; fi
25-
- if [[ $NAME == UNIT ]]; then coveralls; fi
23+
- coveralls

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ format:
5151

5252
style:
5353
@printf "Checking code style with pylint...\n"
54-
pylint symbolic_pymc/
54+
pylint symbolic_pymc/ tests/
5555
@printf "\033[1;34mPylint passes!\033[0m\n\n"
5656

5757
black: # Format code in-place using black.
58-
black symbolic_pymc/
58+
black symbolic_pymc/ tests/
5959

6060
test: # Test code using pytest.
6161
pytest -v tests/ --cov=symbolic_pymc/ --cov-report=xml --html=testing-report.html --self-contained-html

tests/tensorflow/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ def run_in_graph_mode(f):
77
def _f(*args, **kwargs):
88
with graph_mode():
99
return f()
10+
1011
return _f

tests/tensorflow/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def setup_module():
1414

1515
# Let's make sure we have a clean graph slate
1616
from tensorflow.compat.v1 import reset_default_graph
17+
1718
reset_default_graph()
1819

1920
yield

tests/tensorflow/test_kanren.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@
1111

1212
@run_in_graph_mode
1313
def test_commutativity():
14-
with enable_lvar_defaults('names'):
14+
with enable_lvar_defaults("names"):
1515
add_1_mt = mt(1) + mt(2)
1616
add_2_mt = mt(2) + mt(1)
1717

18-
res = run(0, var('q'), commutative(add_1_mt.base_operator))
18+
res = run(0, var("q"), commutative(add_1_mt.base_operator))
1919
assert res is not False
2020

21-
res = run(0, var('q'), eq_comm(add_1_mt, add_2_mt))
21+
res = run(0, var("q"), eq_comm(add_1_mt, add_2_mt))
2222
assert res is not False
2323

24-
with enable_lvar_defaults('names'):
25-
add_pattern_mt = mt(2) + var('q')
24+
with enable_lvar_defaults("names"):
25+
add_pattern_mt = mt(2) + var("q")
2626

27-
res = run(0, var('q'), eq_comm(add_1_mt, add_pattern_mt))
27+
res = run(0, var("q"), eq_comm(add_1_mt, add_pattern_mt))
2828
assert res[0] == add_1_mt.base_arguments[0]

0 commit comments

Comments
 (0)