Port lib/test_util.py to pytest#1413
Conversation
|
Looks like the original |
| # | ||
| from __future__ import absolute_import, division | ||
|
|
||
| from unittest import TestCase |
There was a problem hiding this comment.
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.)
There was a problem hiding this comment.
I missed that somehow! I'll read more about this and try to get rid of unittest. Thanks!
|
Why us Travis complaining
|
.travis.yml
Outdated
| - 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" | ||
| # Install griddataformats from PIP so that scipy is only installed in the full build (#1147) | ||
| - PIP_DEPENDENCIES='griddataformats' | ||
| - PIP_DEPENDENCIES='griddataformats pytest pytest-cov' |
There was a problem hiding this comment.
please add them do conda. They are both available on the conda-forge channel. This might also be messing up your pytest installation. But I'm not sure about that.
There was a problem hiding this comment.
I would still prefer pytest as a conda dependency.
There was a problem hiding this comment.
@kain88-de Should I add them to CONDA _DEPENDENCIES or CONDA_ALL_DEPENDENCIES?
There was a problem hiding this comment.
you need to add them to both. We can check in another PR why they aren't installed automatically.
|
|
||
|
|
||
| class TestFilename(object): | ||
| class TestFilename(TestCase): |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
No, I'm using it because only classes that inherit from TestCase get their setUp and tearDown methods executed.
There was a problem hiding this comment.
So we need this for a swift conversion and then remove it one by one again later. check
|
I have flipped the MAIN_CMD command so that |
|
@utkbansal if you could remove the yield based test that would be great. They do generate quite a lot of noise in the output. |
|
We have a lot of |
|
Suppressing the warnings for now is fine. |
|
Wohoo! Coverage increased! 😬 |
|
And the full test build is passing (likely by chance, but still!). |
| - 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" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
should be able to do conda upgrade pytest?
There was a problem hiding this comment.
@richardjgowers after the source ci-helpers/travis/setup_conda.sh step?
There was a problem hiding this comment.
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.
|
Should be ready to merge, only the full build times out. We might not need the full build to succeed for the last commit as it was only shifting requirements from pip to conda and the commit previous to this verifies that coverage works and has not dropped. |
|
@utkbansal awesome, one module down! Can you try and get the unfinished coordinates port PR up ASAP so we can see what changes are required. |
Fixes partially #884
Changes made in this Pull Request:
PR Checklist