Skip to content

TST: Use pytest #13856

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 11 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
NOSE_ARGS -> TEST_ARGS
  • Loading branch information
TomAugspurger committed Feb 10, 2017
commit 59e2be94b60ee13fee06bd84a44df0ac679ac0ba
38 changes: 19 additions & 19 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ matrix:
env:
- PYTHON_VERSION=3.5
- JOB_NAME: "35_osx"
- NOSE_ARGS="--skip-slow --skip-network"
- TEST_ARGS="--skip-slow --skip-network"
- BUILD_TYPE=conda
- JOB_TAG=_OSX
- TRAVIS_PYTHON_VERSION=3.5
Expand All @@ -42,7 +42,7 @@ matrix:
env:
- PYTHON_VERSION=2.7
- JOB_NAME: "27_slow_nnet_LOCALE"
- NOSE_ARGS="--only-slow --skip-network"
- TEST_ARGS="--only-slow --skip-network"
- LOCALE_OVERRIDE="zh_CN.UTF-8"
- FULL_DEPS=true
- JOB_TAG=_LOCALE
Expand All @@ -56,7 +56,7 @@ matrix:
env:
- PYTHON_VERSION=2.7
- JOB_NAME: "27_nslow"
- NOSE_ARGS="--skip-slow"
- TEST_ARGS="--skip-slow"
- FULL_DEPS=true
- CLIPBOARD_GUI=gtk2
- LINT=true
Expand All @@ -70,7 +70,7 @@ matrix:
env:
- PYTHON_VERSION=3.5
- JOB_NAME: "35_nslow"
- NOSE_ARGS="--skip-slow --skip-network"
- TEST_ARGS="--skip-slow --skip-network"
- FULL_DEPS=true
- CLIPBOARD=xsel
- COVERAGE=true
Expand All @@ -84,7 +84,7 @@ matrix:
env:
- PYTHON_VERSION=3.6
- JOB_NAME: "36"
- NOSE_ARGS="--skip-slow --skip-network"
- TEST_ARGS="--skip-slow --skip-network"
- PANDAS_TESTING_MODE="deprecate"
addons:
apt:
Expand All @@ -96,7 +96,7 @@ matrix:
env:
- PYTHON_VERSION=2.7
- JOB_NAME: "27_nslow_nnet_COMPAT"
- NOSE_ARGS="--skip-slow --skip-network"
- TEST_ARGS="--skip-slow --skip-network"
- LOCALE_OVERRIDE="it_IT.UTF-8"
- INSTALL_TEST=true
- JOB_TAG=_COMPAT
Expand All @@ -112,7 +112,7 @@ matrix:
- PYTHON_VERSION=2.7
- JOB_NAME: "27_slow"
- JOB_TAG=_SLOW
- NOSE_ARGS="--only-slow --skip-network"
- TEST_ARGS="--only-slow --skip-network"
- FULL_DEPS=true
- CACHE_NAME="27_slow"
- USE_CACHE=true
Expand All @@ -122,7 +122,7 @@ matrix:
- PYTHON_VERSION=2.7
- JOB_NAME: "27_build_test_conda"
- JOB_TAG=_BUILD_TEST
- NOSE_ARGS="--skip-slow"
- TEST_ARGS="--skip-slow"
- FULL_DEPS=true
- BUILD_TEST=true
- CACHE_NAME="27_build_test_conda"
Expand All @@ -133,7 +133,7 @@ matrix:
- PYTHON_VERSION=3.4
- JOB_NAME: "34_nslow"
- LOCALE_OVERRIDE="zh_CN.UTF-8"
- NOSE_ARGS="--skip-slow"
- TEST_ARGS="--skip-slow"
- FULL_DEPS=true
- CLIPBOARD=xsel
- CACHE_NAME="34_nslow"
Expand All @@ -149,7 +149,7 @@ matrix:
- PYTHON_VERSION=3.4
- JOB_NAME: "34_slow"
- JOB_TAG=_SLOW
- NOSE_ARGS="--only-slow --skip-network"
- TEST_ARGS="--only-slow --skip-network"
- FULL_DEPS=true
- CLIPBOARD=xsel
- CACHE_NAME="34_slow"
Expand All @@ -164,7 +164,7 @@ matrix:
- PYTHON_VERSION=3.5
- JOB_NAME: "35_numpy_dev"
- JOB_TAG=_NUMPY_DEV
- NOSE_ARGS="--skip-slow --skip-network"
- TEST_ARGS="--skip-slow --skip-network"
- PANDAS_TESTING_MODE="deprecate"
- CACHE_NAME="35_numpy_dev"
- USE_CACHE=true
Expand All @@ -179,7 +179,7 @@ matrix:
- PYTHON_VERSION=3.5
- JOB_NAME: "35_ascii"
- JOB_TAG=_ASCII
- NOSE_ARGS="--skip-slow --skip-network"
- TEST_ARGS="--skip-slow --skip-network"
- LOCALE_OVERRIDE="C"
- CACHE_NAME="35_ascii"
- USE_CACHE=true
Expand All @@ -199,7 +199,7 @@ matrix:
- PYTHON_VERSION=2.7
- JOB_NAME: "27_slow"
- JOB_TAG=_SLOW
- NOSE_ARGS="--only-slow --skip-network"
- TEST_ARGS="--only-slow --skip-network"
- FULL_DEPS=true
- CACHE_NAME="27_slow"
- USE_CACHE=true
Expand All @@ -208,7 +208,7 @@ matrix:
- PYTHON_VERSION=3.4
- JOB_NAME: "34_slow"
- JOB_TAG=_SLOW
- NOSE_ARGS="--only-slow --skip-network"
- TEST_ARGS="--only-slow --skip-network"
- FULL_DEPS=true
- CLIPBOARD=xsel
- CACHE_NAME="34_slow"
Expand All @@ -222,7 +222,7 @@ matrix:
- PYTHON_VERSION=2.7
- JOB_NAME: "27_build_test_conda"
- JOB_TAG=_BUILD_TEST
- NOSE_ARGS="--skip-slow"
- TEST_ARGS="--skip-slow"
- FULL_DEPS=true
- BUILD_TEST=true
- CACHE_NAME="27_build_test_conda"
Expand All @@ -232,7 +232,7 @@ matrix:
- PYTHON_VERSION=3.4
- JOB_NAME: "34_nslow"
- LOCALE_OVERRIDE="zh_CN.UTF-8"
- NOSE_ARGS="--skip-slow"
- TEST_ARGS="--skip-slow"
- FULL_DEPS=true
- CLIPBOARD=xsel
- CACHE_NAME="34_nslow"
Expand All @@ -247,7 +247,7 @@ matrix:
- PYTHON_VERSION=3.5
- JOB_NAME: "35_numpy_dev"
- JOB_TAG=_NUMPY_DEV
- NOSE_ARGS="--skip-slow --skip-network"
- TEST_ARGS="--skip-slow --skip-network"
- PANDAS_TESTING_MODE="deprecate"
- CACHE_NAME="35_numpy_dev"
- USE_CACHE=true
Expand All @@ -260,7 +260,7 @@ matrix:
env:
- PYTHON_VERSION=2.7
- JOB_NAME: "27_nslow_nnet_COMPAT"
- NOSE_ARGS="--skip-slow --skip-network"
- TEST_ARGS="--skip-slow --skip-network"
- LOCALE_OVERRIDE="it_IT.UTF-8"
- INSTALL_TEST=true
- JOB_TAG=_COMPAT
Expand All @@ -275,7 +275,7 @@ matrix:
- PYTHON_VERSION=3.5
- JOB_NAME: "35_ascii"
- JOB_TAG=_ASCII
- NOSE_ARGS="--skip-slow --skip-network"
- TEST_ARGS="--skip-slow --skip-network"
- LOCALE_OVERRIDE="C"
- CACHE_NAME="35_ascii"
- USE_CACHE=true
Expand Down
2 changes: 1 addition & 1 deletion ci/install_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [ "$INSTALL_TEST" ]; then
conda uninstall cython || exit 1
python "$TRAVIS_BUILD_DIR"/setup.py sdist --formats=zip,gztar || exit 1
pip install "$TRAVIS_BUILD_DIR"/dist/*tar.gz || exit 1
# nosetests --exe -A "$NOSE_ARGS" pandas/tests/test_series.py --with-xunit --xunit-file=/tmp/nosetests_install.xml
# nosetests --exe -A "$TEST_ARGS" pandas/tests/test_series.py --with-xunit --xunit-file=/tmp/nosetests_install.xml
pytest pandas/tests/test_series.py --junitxml=/tmp/pytest_install.xml
else
echo "Skipping installation test."
Expand Down
8 changes: 4 additions & 4 deletions ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ fi
if [ "$BUILD_TEST" ]; then
echo "We are not running nosetests as this is simply a build test."
elif [ "$COVERAGE" ]; then
echo pytest -s --cov=pandas --cov-report xml:/tmp/nosetests.xml $NOSE_ARGS pandas
pytest -s --cov=pandas --cov-report xml:/tmp/nosetests.xml $NOSE_ARGS pandas
echo pytest -s --cov=pandas --cov-report xml:/tmp/nosetests.xml $TEST_ARGS pandas
pytest -s --cov=pandas --cov-report xml:/tmp/nosetests.xml $TEST_ARGS pandas
else
echo pytest $NOSE_ARGS pandas
pytest $NOSE_ARGS pandas # TODO: doctest
echo pytest $TEST_ARGS pandas
pytest $TEST_ARGS pandas # TODO: doctest
fi

RET="$?"
Expand Down
12 changes: 10 additions & 2 deletions doc/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -599,13 +599,21 @@ install *pandas*) by typing::

The tests suite is exhaustive and takes around 20 minutes to run. Often it is
worth running only a subset of tests first around your changes before running the
entire suite. This is done using one of the following constructs::
entire suite.

The easiest way to do this is with::

pytest pandas/path/to/test.py -k regex_matching_test_name

Or with one of the following constructs::

pytest pandas/tests/[test-module].py
pytest pandas/tests/[test-module].py::[TestClass]
Copy link
Contributor

Choose a reason for hiding this comment

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

I would instead recommend using -k, in fact this is one of the main reasons I really like pytest, e.g.

pytest pandas/[tests-module].py -k cool_test IMHO is much easiest then finding class names and the exact names of the methods.

pytest pandas/tests/[test-module].py::[TestClass]::[test_method]

.. versionadded:: 0.18.0
For more, see the `pytest<http://doc.pytest.org/en/latest/>`_ documentation.

.. versionadded:: 0.18.0
Copy link
Contributor

Choose a reason for hiding this comment

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

prob should take out this tag


Furthermore one can run

Expand Down