From 5ff75a41ea92d7ce3c41034e433ccfb44cddd85e Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Tue, 22 Sep 2015 15:05:56 +0200 Subject: [PATCH] fix erroring doc example --- doc/en/example/simple.rst | 2 +- doc/en/fixture.rst | 24 +++++++++++++----------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/doc/en/example/simple.rst b/doc/en/example/simple.rst index 7febc1279..87d1acfa6 100644 --- a/doc/en/example/simple.rst +++ b/doc/en/example/simple.rst @@ -476,7 +476,7 @@ We can run this:: file $REGENDOC_TMPDIR/b/test_error.py, line 1 def test_root(db): # no db here, will error out fixture 'db' not found - available fixtures: record_xml_property, tmpdir_factory, tmpdir, monkeypatch, pytestconfig, cache, capsys, capfd, recwarn + available fixtures: recwarn, monkeypatch, cache, tmpdir_factory, tmpdir, record_xml_property, capfd, capsys, pytestconfig use 'py.test --fixtures [testpath]' for help on them. $REGENDOC_TMPDIR/b/test_error.py:1 diff --git a/doc/en/fixture.rst b/doc/en/fixture.rst index df7972a4c..b585539a4 100644 --- a/doc/en/fixture.rst +++ b/doc/en/fixture.rst @@ -180,8 +180,8 @@ function (in or below the directory where ``conftest.py`` is located):: def test_ehlo(smtp): response, msg = smtp.ehlo() assert response == 250 - assert "smtp.gmail.com" in str(msg, 'ascii') - assert 0 # for demo purposes + assert "smtp.gmail.com" in msg + assert 0 # for demo purposes def test_noop(smtp): response, msg = smtp.noop() @@ -207,10 +207,11 @@ inspect what is going on and can now run the tests:: def test_ehlo(smtp): response, msg = smtp.ehlo() assert response == 250 - > assert "smtp.gmail.com" in str(msg, 'ascii') - E TypeError: str() takes at most 1 argument (2 given) + assert "smtp.gmail.com" in msg + > assert 0 # for demo purposes + E assert 0 - test_module.py:5: TypeError + test_module.py:6: AssertionError _______ test_noop ________ smtp = @@ -387,10 +388,11 @@ So let's just do another run:: def test_ehlo(smtp): response, msg = smtp.ehlo() assert response == 250 - > assert "smtp.gmail.com" in str(msg, 'ascii') - E TypeError: str() takes at most 1 argument (2 given) + assert "smtp.gmail.com" in msg + > assert 0 # for demo purposes + E assert 0 - test_module.py:5: TypeError + test_module.py:6: AssertionError _______ test_noop[smtp.gmail.com] ________ smtp = @@ -409,10 +411,10 @@ So let's just do another run:: def test_ehlo(smtp): response, msg = smtp.ehlo() assert response == 250 - > assert "smtp.gmail.com" in str(msg, 'ascii') - E TypeError: str() takes at most 1 argument (2 given) + > assert "smtp.gmail.com" in msg + E assert 'smtp.gmail.com' in 'mail.python.org\nSIZE 51200000\nETRN\nSTARTTLS\nENHANCEDSTATUSCODES\n8BITMIME\nDSN\nSMTPUTF8' - test_module.py:5: TypeError + test_module.py:5: AssertionError -------------------------- Captured stdout setup --------------------------- finalizing _______ test_noop[mail.python.org] ________