[py-svn] commit/pytest: hpk42: isolate test example run
Bitbucket
commits-noreply at bitbucket.org
Fri Nov 18 22:27:23 CET 2011
1 new commit in pytest:
https://bitbucket.org/hpk42/pytest/changeset/abf6012c985a/
changeset: abf6012c985a
user: hpk42
date: 2011-11-18 22:26:38
summary: isolate test example run
affected #: 2 files
diff -r f74e56f745e4e106b10ad66f395103d082b5f002 -r abf6012c985a9aa3940072d0804a1235c051a9ee doc/Makefile
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -40,7 +40,7 @@
-rm -rf $(BUILDDIR)/*
install: html
- @rsync -avz _build/html/ pytest.org:/www/pytest.org/2.2.0
+ -avz _build/html/ pytest.org:/www/pytest.org/latest
installpdf: latexpdf
@scp $(BUILDDIR)/latex/pytest.pdf pytest.org:/www/pytest.org/latest
diff -r f74e56f745e4e106b10ad66f395103d082b5f002 -r abf6012c985a9aa3940072d0804a1235c051a9ee doc/example/markers.txt
--- a/doc/example/markers.txt
+++ b/doc/example/markers.txt
@@ -25,26 +25,26 @@
You can then restrict a test run to only run tests marked with ``webtest``::
$ py.test -v -m webtest
- =========================== test session starts ============================
+ ============================= test session starts ==============================
platform darwin -- Python 2.7.1 -- pytest-2.2.0 -- /Users/hpk/venv/1/bin/python
collecting ... collected 2 items
test_server.py:3: test_send_http PASSED
- =================== 1 tests deselected by "-m 'webtest'" ===================
- ================== 1 passed, 1 deselected in 0.01 seconds ==================
+ ===================== 1 tests deselected by "-m 'webtest'" =====================
+ ==================== 1 passed, 1 deselected in 0.01 seconds ====================
Or the inverse, running all tests except the webtest ones::
$ py.test -v -m "not webtest"
- =========================== test session starts ============================
+ ============================= test session starts ==============================
platform darwin -- Python 2.7.1 -- pytest-2.2.0 -- /Users/hpk/venv/1/bin/python
collecting ... collected 2 items
test_server.py:6: test_something_quick PASSED
- ================= 1 tests deselected by "-m 'not webtest'" =================
- ================== 1 passed, 1 deselected in 0.01 seconds ==================
+ =================== 1 tests deselected by "-m 'not webtest'" ===================
+ ==================== 1 passed, 1 deselected in 0.02 seconds ====================
Registering markers
-------------------------------------
@@ -140,45 +140,47 @@
You can use the ``-k`` command line option to only run tests with names that match the given argument::
$ py.test -k send_http # running with the above defined examples
- =========================== test session starts ============================
+ ============================= test session starts ==============================
platform darwin -- Python 2.7.1 -- pytest-2.2.0
collecting ... collected 4 items
test_server.py .
- =================== 3 tests deselected by '-ksend_http' ====================
- ================== 1 passed, 3 deselected in 0.02 seconds ==================
+ ===================== 3 tests deselected by '-ksend_http' ======================
+ ==================== 1 passed, 3 deselected in 0.02 seconds ====================
And you can also run all tests except the ones that match the keyword::
$ py.test -k-send_http
- =========================== test session starts ============================
+ ============================= test session starts ==============================
platform darwin -- Python 2.7.1 -- pytest-2.2.0
collecting ... collected 4 items
test_mark_classlevel.py ..
test_server.py .
- =================== 1 tests deselected by '-k-send_http' ===================
- ================== 3 passed, 1 deselected in 0.03 seconds ==================
+ ===================== 1 tests deselected by '-k-send_http' =====================
+ ==================== 3 passed, 1 deselected in 0.03 seconds ====================
Or to only select the class::
$ py.test -kTestClass
- =========================== test session starts ============================
+ ============================= test session starts ==============================
platform darwin -- Python 2.7.1 -- pytest-2.2.0
collecting ... collected 4 items
test_mark_classlevel.py ..
- =================== 2 tests deselected by '-kTestClass' ====================
- ================== 2 passed, 2 deselected in 0.02 seconds ==================
+ ===================== 2 tests deselected by '-kTestClass' ======================
+ ==================== 2 passed, 2 deselected in 0.02 seconds ====================
.. _`adding a custom marker from a plugin`:
custom marker and command line option to control test runs
----------------------------------------------------------
+.. regendoc:wipe
+
Plugins can provide custom markers and implement specific behaviour
based on it. This is a self-contained example which adds a command
line option and a parametrized test function marker to run tests
@@ -218,34 +220,28 @@
the test needs::
$ py.test -E stage2
- =========================== test session starts ============================
+ ============================= test session starts ==============================
platform darwin -- Python 2.7.1 -- pytest-2.2.0
- collecting ... collected 5 items
+ collecting ... collected 1 items
- test_mark_classlevel.py ..
- test_server.py ..
test_someenv.py s
- =================== 4 passed, 1 skipped in 0.04 seconds ====================
+ ========================== 1 skipped in 0.02 seconds ===========================
and here is one that specifies exactly the environment needed::
$ py.test -E stage1
- =========================== test session starts ============================
+ ============================= test session starts ==============================
platform darwin -- Python 2.7.1 -- pytest-2.2.0
- collecting ... collected 5 items
+ collecting ... collected 1 items
- test_mark_classlevel.py ..
- test_server.py ..
test_someenv.py .
- ========================= 5 passed in 0.04 seconds =========================
+ =========================== 1 passed in 0.02 seconds ===========================
The ``--markers`` option always gives you a list of available markers::
$ py.test --markers
- @pytest.mark.webtest: mark a test as a webtest.
-
@pytest.mark.env(name): mark test to run only on named environment
@pytest.mark.skipif(*conditions): skip the given test function if evaluation of all conditions has a True value. Evaluation happens within the module global context. Example: skipif('sys.platform == "win32"') skips the test if we are on the win32 platform.
Repository URL: https://bitbucket.org/hpk42/pytest/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the pytest-commit
mailing list