fix issue572 - python3 compat of tmpdir example in docs.

This commit is contained in:
holger krekel 2014-09-02 12:20:16 +02:00
parent c0f091d540
commit e3cea41dcd
3 changed files with 12 additions and 10 deletions

View File

@ -10,6 +10,8 @@ NEXT
- Fix example in monkeypatch documentation, thanks t-8ch. - Fix example in monkeypatch documentation, thanks t-8ch.
- fix issue572: correct tmpdir doc example for python3.
- Do not mark as universal wheel because Python 2.6 is different from - Do not mark as universal wheel because Python 2.6 is different from
other builds due to the extra argparse dependency. Fixes issue566. other builds due to the extra argparse dependency. Fixes issue566.
Thanks sontek. Thanks sontek.

View File

@ -51,17 +51,17 @@ That's it. You can execute the test function now::
=========================== test session starts ============================ =========================== test session starts ============================
platform linux -- Python 3.4.0 -- py-1.4.23 -- pytest-2.6.1 platform linux -- Python 3.4.0 -- py-1.4.23 -- pytest-2.6.1
collected 1 items collected 1 items
test_sample.py F test_sample.py F
================================= FAILURES ================================= ================================= FAILURES =================================
_______________________________ test_answer ________________________________ _______________________________ test_answer ________________________________
def test_answer(): def test_answer():
> assert func(3) == 5 > assert func(3) == 5
E assert 4 == 5 E assert 4 == 5
E + where 4 = func(3) E + where 4 = func(3)
test_sample.py:5: AssertionError test_sample.py:5: AssertionError
========================= 1 failed in 0.01 seconds ========================= ========================= 1 failed in 0.01 seconds =========================
@ -126,14 +126,14 @@ run the module by passing its filename::
.F .F
================================= FAILURES ================================= ================================= FAILURES =================================
____________________________ TestClass.test_two ____________________________ ____________________________ TestClass.test_two ____________________________
self = <test_class.TestClass object at 0x2ad4b005b710> self = <test_class.TestClass object at 0x2ad4b005b710>
def test_two(self): def test_two(self):
x = "hello" x = "hello"
> assert hasattr(x, 'check') > assert hasattr(x, 'check')
E assert hasattr('hello', 'check') E assert hasattr('hello', 'check')
test_class.py:8: AssertionError test_class.py:8: AssertionError
1 failed, 1 passed in 0.01 seconds 1 failed, 1 passed in 0.01 seconds
@ -151,7 +151,7 @@ resources, for example a unique temporary directory::
# content of test_tmpdir.py # content of test_tmpdir.py
def test_needsfiles(tmpdir): def test_needsfiles(tmpdir):
print tmpdir print (tmpdir)
assert 0 assert 0
We list the name ``tmpdir`` in the test function signature and We list the name ``tmpdir`` in the test function signature and
@ -159,7 +159,7 @@ We list the name ``tmpdir`` in the test function signature and
before performing the test function call. Let's just run it:: before performing the test function call. Let's just run it::
$ py.test -q test_tmpdir.py $ py.test -q test_tmpdir.py
================================== ERRORS ================================== ================================== ERRORS ==================================
_____________________ ERROR collecting test_tmpdir.py ______________________ _____________________ ERROR collecting test_tmpdir.py ______________________
/home/hpk/p/pytest/.tox/regen/lib/python3.4/site-packages/_pytest/python.py:463: in _importtestmodule /home/hpk/p/pytest/.tox/regen/lib/python3.4/site-packages/_pytest/python.py:463: in _importtestmodule

View File

@ -11,7 +11,7 @@ pytest: helps you write better programs
**a mature full-featured Python testing tool** **a mature full-featured Python testing tool**
- runs on Posix/Windows, Python 2.5-3.4, PyPy and Jython-2.5.1 - runs on Posix/Windows, Python 2.6-3.4, PyPy and (possibly still) Jython-2.5.1
- **well tested** with more than a thousand tests against itself - **well tested** with more than a thousand tests against itself
- **strict backward compatibility policy** for safe pytest upgrades - **strict backward compatibility policy** for safe pytest upgrades
- :ref:`comprehensive online <toc>` and `PDF documentation <pytest.pdf>`_ - :ref:`comprehensive online <toc>` and `PDF documentation <pytest.pdf>`_