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
24 changes: 13 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ env:
- PYTHON_VERSION=2.7
- COVERALLS=false
- NOSE_FLAGS="--processes=2 --process-timeout=400 --no-open-files --with-timer --timer-top-n 50"
- NOSE_TEST_LIST1="analysis auxiliary coordinates core formats topology utils"
- NOSE_TEST_LIST2="lib"
- NOSE_COVERAGE1="coverage1"
- NOSE_COVERAGE2="coverage2"
- MAIN_CMD="python ./testsuite/MDAnalysisTests/mda_nosetests ${NOSE_TEST_LIST1} ${NOSE_FLAGS}; python ./testsuite/MDAnalysisTests/mda_nosetests ${NOSE_TEST_LIST2} ${NOSE_FLAGS}"
- NOSE_TEST_LIST="analysis auxiliary coordinates core formats topology utils"
- PYTEST_FLAGS="--disable-pytest-warnings"
- PYTEST_LIST="testsuite/MDAnalysisTests/lib"
- NOSE_COVERAGE_FILE="nose_coverage"
- PYTEST_COVERAGE_FILE="pytest_coverage"
- MAIN_CMD="pytest ${PYTEST_LIST} ${PYTEST_FLAGS}; python ./testsuite/MDAnalysisTests/mda_nosetests ${NOSE_TEST_LIST} ${NOSE_FLAGS}"
- SETUP_CMD=""
- BUILD_CMD="pip install -v package/ && pip install testsuite/"
- CONDA_DEPENDENCIES="mmtf-python nose=1.3.7 mock six biopython networkx cython joblib nose-timer"
- CONDA_ALL_DEPENDENCIES="mmtf-python nose=1.3.7 mock six biopython networkx cython joblib nose-timer matplotlib netcdf4 scikit-learn scipy seaborn coveralls clustalw=2.1"
- CONDA_DEPENDENCIES="mmtf-python nose=1.3.7 mock six biopython networkx cython joblib nose-timer pytest=3.1.2 pytest-cov=2.5.1"
- CONDA_ALL_DEPENDENCIES="mmtf-python nose=1.3.7 mock six biopython networkx cython joblib nose-timer matplotlib netcdf4 scikit-learn scipy seaborn coveralls clustalw=2.1 pytest=3.1.2 pytest-cov=2.5.1"
Copy link
Member

Choose a reason for hiding this comment

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

why the version pinning?

Copy link
Member Author

@utkbansal utkbansal Jun 21, 2017

Choose a reason for hiding this comment

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

Conda already says that it has pytest installed and still it did not work. Also, the version it has is 2.7, so there has been a major release after that.

Copy link
Member

Choose a reason for hiding this comment

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

should be able to do conda upgrade pytest?

Copy link
Member Author

Choose a reason for hiding this comment

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

@richardjgowers after the source ci-helpers/travis/setup_conda.sh step?

Copy link
Member

Choose a reason for hiding this comment

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

the older version comes from astropy. They specifically install an older version of pytest for themselves. Leave the pinning for now. I'm asking what they use as a preferred way to use a newer pytest version.

# Install griddataformats from PIP so that scipy is only installed in the full build (#1147)
- PIP_DEPENDENCIES='griddataformats'
- CONDA_CHANNELS='biobuilds conda-forge'
Expand All @@ -47,7 +48,7 @@ matrix:
env: NAME='minimal'
PYTHON_VERSION=2.7
MEMLEAK='--with-memleak'
MAIN_CMD='python ./testsuite/MDAnalysisTests/mda_nosetests ${NOSE_TEST_LIST1} ${NOSE_FLAGS} ${MEMLEAK}; python ./testsuite/MDAnalysisTests/mda_nosetests ${NOSE_TEST_LIST2} ${NOSE_FLAGS} ${MEMLEAK}'
MAIN_CMD='pytest ${PYTEST_LIST} ${PYTEST_FLAGS}; python ./testsuite/MDAnalysisTests/mda_nosetests ${NOSE_TEST_LIST} ${NOSE_FLAGS} ${MEMLEAK}'

- os: linux
env: NAME="Doc"
Expand All @@ -66,8 +67,9 @@ matrix:

- os: linux
env: NAME='full'
COVERAGE='--with-coverage --cover-package MDAnalysis'
MAIN_CMD='export COVERAGE_FILE=$NOSE_COVERAGE1; python ./testsuite/MDAnalysisTests/mda_nosetests ${NOSE_TEST_LIST1} ${NOSE_FLAGS} ${COVERAGE}; export COVERAGE_FILE=$NOSE_COVERAGE2; python ./testsuite/MDAnalysisTests/mda_nosetests ${NOSE_TEST_LIST2} ${NOSE_FLAGS} ${COVERAGE}'
NOSE_COVERAGE='--with-coverage --cover-package MDAnalysis'
PYTEST_COVERAGE='--cov=MDAnalysis'
MAIN_CMD='export COVERAGE_FILE=$PYTEST_COVERAGE_FILE; pytest ${PYTEST_LIST} ${PYTEST_FLAGS} ${PYTEST_COVERAGE}; export COVERAGE_FILE=$NOSE_COVERAGE_FILE; python ./testsuite/MDAnalysisTests/mda_nosetests ${NOSE_TEST_LIST} ${NOSE_FLAGS} ${NOSE_COVERAGE}'
CONDA_DEPENDENCIES=${CONDA_ALL_DEPENDENCIES}
COVERALLS='true'

Expand Down Expand Up @@ -108,7 +110,7 @@ script:
after_success:
- |
if [[ $COVERALLS == 'true' ]]; then \
coverage combine $NOSE_COVERAGE1 $NOSE_COVERAGE2; \
coverage combine $NOSE_COVERAGE_FILE $PYTEST_COVERAGE_FILE; \
coveralls; \
fi
# can't use test here since this leads to travis fails even though the build passes
Expand Down
12 changes: 7 additions & 5 deletions testsuite/MDAnalysisTests/lib/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
#
from __future__ import absolute_import, division

from unittest import TestCase
Copy link
Member

Choose a reason for hiding this comment

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

Is using unittest really necessary? I thought we can get rid of it. pytest supports setup_method()/teardown_method() (instead of setUp()) https://docs.pytest.org/en/2.7.3/xunit_setup.html

(I know that it also supports running UnitTest classes.)

Copy link
Member Author

Choose a reason for hiding this comment

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

I missed that somehow! I'll read more about this and try to get rid of unittest. Thanks!


from six.moves import range, StringIO
import six

Expand Down Expand Up @@ -124,7 +126,7 @@ def test_strings(self):
assert_equal(util.iterable(u"unicode string"), False)


class TestFilename(object):
class TestFilename(TestCase):
Copy link
Member

Choose a reason for hiding this comment

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

You are using TestCase here to make the test classes discoverable to pytest. This means this class isn't normally picked up by pytest. Please make sure the class has no init method. You can also run pytest with --collect-only to make sure all tests are picked up quickly.

Copy link
Member Author

@utkbansal utkbansal Jun 20, 2017

Choose a reason for hiding this comment

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

No, I'm using it because only classes that inherit from TestCase get their setUp and tearDown methods executed.

Copy link
Member

Choose a reason for hiding this comment

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

So we need this for a swift conversion and then remove it one by one again later. check

def setUp(self):
self.root = "foo"
self.filename = "foo.psf"
Expand Down Expand Up @@ -161,7 +163,7 @@ def testNamedStream(self):
assert_equal(ns.name, self.filename2)


class TestGeometryFunctions(object):
class TestGeometryFunctions(TestCase):
def setUp(self):
self.e1 = np.array([1., 0, 0])
self.e2 = np.array([0, 1., 0])
Expand Down Expand Up @@ -230,7 +232,7 @@ def testDihedral(self):
cd = bc + self.e3
assert_almost_equal(mdamath.dihedral(ab, bc, cd), -np.pi / 2)

class TestMakeWhole(object):
class TestMakeWhole(TestCase):
"""Set up a simple system:

+-----------+
Expand Down Expand Up @@ -442,7 +444,7 @@ def _fill_cache(self, name, value):
self._cache[name] = value


class TestCachedDecorator(object):
class TestCachedDecorator(TestCase):
def setUp(self):
self.obj = Class_with_Caches()

Expand Down Expand Up @@ -895,7 +897,7 @@ def test_blocks_of_VE(self):
assert_raises(ValueError, util.blocks_of, arr, 2, 1)


class TestNamespace(object):
class TestNamespace(TestCase):
def setUp(self):
self.ns = util.Namespace()

Expand Down