Skip to content

Commit

Permalink
Use py.test for everything :-)
Browse files Browse the repository at this point in the history
  • Loading branch information
ask committed Aug 22, 2016
1 parent 3eb34cb commit 29df527
Show file tree
Hide file tree
Showing 157 changed files with 6,727 additions and 7,207 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ celery/tests/cover/
.ve*
cover/
.vagrant/
.cache/
htmlcov/
coverage.xml
test.db
22 changes: 12 additions & 10 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -464,12 +464,12 @@ dependencies, so install these next:
$ pip install -U -r requirements/default.txt

After installing the dependencies required, you can now execute
the test suite by calling ``nosetests <nose>``:
the test suite by calling ``py.test <pytest``:
::

$ nosetests
$ py.test

Some useful options to ``nosetests`` are:
Some useful options to ``py.test`` are:

* ``-x``

Expand All @@ -479,10 +479,6 @@ Some useful options to ``nosetests`` are:

Don't capture output

* ``-nologcapture``

Don't capture log output.

* ``-v``

Run with verbose output.
Expand All @@ -491,7 +487,7 @@ If you want to run the tests for a single test file only
you can do so like this:
::

$ nosetests celery.tests.test_worker.test_worker_job
$ py.test t/unit/worker/test_worker_job.py

.. _contributing-pull-requests:

Expand Down Expand Up @@ -525,15 +521,15 @@ Installing the ``coverage`` module:
Code coverage in HTML:
::

$ nosetests --with-coverage --cover-html
$ py.test --cov=celery --cov-report=html

The coverage output will then be located at
``celery/tests/cover/index.html``.

Code coverage in XML (Cobertura-style):
::

$ nosetests --with-coverage --cover-xml --cover-xml-file=coverage.xml
$ py.test --cov=celery --cov-report=xml

The coverage XML output will then be located at ``coverage.xml``

Expand Down Expand Up @@ -857,6 +853,12 @@ Ask Solem
:github: https://github.com/ask
:twitter: http://twitter.com/#!/asksol

Asif Saif Uddin
~~~~~~~~~~~~~~~

:github: https://github.com/auvipy
:twitter: https://twitter.com/#!/auvipy

Dmitry Malinovsky
~~~~~~~~~~~~~~~~~

Expand Down
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ FLAKE8=flake8
FLAKEPLUS=flakeplus
SPHINX2RST=sphinx2rst

TESTDIR=t

SPHINX_DIR=docs/
SPHINX_BUILDDIR="${SPHINX_DIR}/_build"
README=README.rst
Expand Down Expand Up @@ -84,13 +86,13 @@ configcheck:

flakecheck:
# the only way to enable all-1 errors is to ignore one of them.
$(FLAKE8) --ignore=X999 "$(PROJ)"
$(FLAKE8) --ignore=X999 "$(PROJ)" "$(TESTDIR)"

flakediag:
-$(MAKE) flakecheck

flakepluscheck:
$(FLAKEPLUS) --$(FLAKEPLUSTARGET) "$(PROJ)"
$(FLAKEPLUS) --$(FLAKEPLUSTARGET) "$(PROJ)" "$(TESTDIR)"

flakeplusdiag:
-$(MAKE) flakepluscheck
Expand Down Expand Up @@ -138,7 +140,7 @@ test:
$(PYTHON) setup.py test

cov:
$(NOSETESTS) -xv --with-coverage --cover-html --cover-branch
py.test -x --cov="$(PROJ)" --cov-report=html

build:
$(PYTHON) setup.py sdist bdist_wheel
Expand All @@ -158,4 +160,3 @@ graph: clean-graph $(WORKER_GRAPH)

authorcheck:
git shortlog -se | cut -f2 | extra/release/attribution.py

4 changes: 2 additions & 2 deletions celery/app/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,13 +418,13 @@ def trace_task(uuid, args, kwargs, request=None):
except EncodeError as exc:
I, R, state, retval = on_error(task_request, exc, uuid)
else:
Rstr = saferepr(R, resultrepr_maxsize)
T = monotonic() - time_start
if task_on_success:
task_on_success(retval, uuid, args, kwargs)
if success_receivers:
send_success(sender=task, result=retval)
if _does_info:
T = monotonic() - time_start
Rstr = saferepr(R, resultrepr_maxsize)
info(LOG_SUCCESS, {
'id': uuid, 'name': name,
'return_value': Rstr, 'runtime': T,
Expand Down
96 changes: 0 additions & 96 deletions celery/tests/__init__.py

This file was deleted.

Loading

0 comments on commit 29df527

Please sign in to comment.