diff --git a/.coveragerc b/.coveragerc index 2546cda..e651aae 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,8 +1,6 @@ [run] -branch = True -include = TexSoup/* -omit = - *__init__.py +include = */TexSoup/* +omit = tests/* [report] # Regexes for lines to exclude from consideration @@ -12,11 +10,11 @@ exclude_lines = # Don't complain about missing debug-only code: def __repr__ + if self\.debug # Don't complain if tests don't hit defensive assertion code: raise AssertionError raise NotImplementedError - pass # Don't complain if non-runnable code isn't run: if 0: diff --git a/.travis.yml b/.travis.yml index f953834..a958f51 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,10 +6,10 @@ python: - "3.4.2" install: - - python3 setup.py install + - python setup.py install script: - - coverage run setup.py test + - py.test --cov after_success: - - coveralls + - CI=true TRAVIS=true coveralls diff --git a/pytest.ini b/pytest.ini index ae1ad4f..5686d3b 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,2 +1,2 @@ [pytest] -addopts = tests TexSoup --doctest-modules +addopts = tests TexSoup --doctest-modules --cov=TexSoup -p no:cacheprovider diff --git a/setup.py b/setup.py index 130a93d..50f099e 100644 --- a/setup.py +++ b/setup.py @@ -2,10 +2,9 @@ from setuptools import setup from setuptools.command.test import test as TestCommand -tests_require = ['pytest', 'coverage == 3.7.1', 'coveralls == 1.1'] +tests_require = ['pytest', 'pytest-cov==2.5.1', 'coverage == 3.7.1', 'coveralls == 1.1'] install_requires = [] - class PyTest(TestCommand): user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")] diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/test_api.py b/tests/test_api.py index 82b4f3d..4fd2803 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -1,4 +1,4 @@ -from config import * +from .config import * from TexSoup.utils import TokenWithPosition ############## @@ -98,4 +98,4 @@ def test_replace_multiple(chikin): def test_add_children(chikin): """Add a child to the parse tree""" chikin.section.add_children('asdfghjkl') - assert 'asdfghjkl' in str(chikin.section) \ No newline at end of file + assert 'asdfghjkl' in str(chikin.section)