[Pytest-commit] commit/pytest: hpk42: actually regen fixture docs with python3.4 instead of python2.7 (doh)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Fri Aug 8 15:25:24 CEST 2014
1 new commit in pytest:
https://bitbucket.org/hpk42/pytest/commits/f0d4a70ab98a/
Changeset: f0d4a70ab98a
User: hpk42
Date: 2014-08-08 15:25:16
Summary: actually regen fixture docs with python3.4 instead of python2.7 (doh)
Affected #: 1 file
diff -r 4651a2651cc3a663519e2484fb6d0df4bd8d38a3 -r f0d4a70ab98a3f1e82f25531ed7e1c9979c12b13 doc/en/fixture.txt
--- a/doc/en/fixture.txt
+++ b/doc/en/fixture.txt
@@ -75,26 +75,25 @@
marked ``smtp`` fixture function. Running the test looks like this::
$ py.test test_smtpsimple.py
- ============================= test session starts ==============================
- platform linux2 -- Python 2.7.6 -- py-1.4.23 -- pytest-2.6.1
+ =========================== test session starts ============================
+ platform linux -- Python 3.4.0 -- py-1.4.23 -- pytest-2.6.2.dev1
collected 1 items
test_smtpsimple.py F
- =================================== FAILURES ===================================
- __________________________________ test_ehlo ___________________________________
+ ================================= FAILURES =================================
+ ________________________________ test_ehlo _________________________________
- smtp = <smtplib.SMTP instance at 0x7ff89e00d7e8>
+ smtp = <smtplib.SMTP object at 0x2ade77b37e48>
def test_ehlo(smtp):
response, msg = smtp.ehlo()
assert response == 250
- assert "merlinux" in msg
- > assert 0 # for demo purposes
- E assert 0
+ > assert "merlinux" in msg
+ E TypeError: Type str doesn't support the buffer API
- test_smtpsimple.py:12: AssertionError
- =========================== 1 failed in 0.17 seconds ===========================
+ test_smtpsimple.py:11: TypeError
+ ========================= 1 failed in 0.18 seconds =========================
In the failure traceback we see that the test function was called with a
``smtp`` argument, the ``smtplib.SMTP()`` instance created by the fixture
@@ -193,28 +192,27 @@
inspect what is going on and can now run the tests::
$ py.test test_module.py
- ============================= test session starts ==============================
- platform linux2 -- Python 2.7.6 -- py-1.4.23 -- pytest-2.6.1
+ =========================== test session starts ============================
+ platform linux -- Python 3.4.0 -- py-1.4.23 -- pytest-2.6.2.dev1
collected 2 items
test_module.py FF
- =================================== FAILURES ===================================
- __________________________________ test_ehlo ___________________________________
+ ================================= FAILURES =================================
+ ________________________________ test_ehlo _________________________________
- smtp = <smtplib.SMTP instance at 0x7f36c67e3ab8>
+ smtp = <smtplib.SMTP object at 0x2b4b07e38e48>
def test_ehlo(smtp):
response = smtp.ehlo()
assert response[0] == 250
- assert "merlinux" in response[1]
- > assert 0 # for demo purposes
- E assert 0
+ > assert "merlinux" in response[1]
+ E TypeError: Type str doesn't support the buffer API
- test_module.py:6: AssertionError
- __________________________________ test_noop ___________________________________
+ test_module.py:5: TypeError
+ ________________________________ test_noop _________________________________
- smtp = <smtplib.SMTP instance at 0x7f36c67e3ab8>
+ smtp = <smtplib.SMTP object at 0x2b4b07e38e48>
def test_noop(smtp):
response = smtp.noop()
@@ -223,7 +221,7 @@
E assert 0
test_module.py:11: AssertionError
- =========================== 2 failed in 0.17 seconds ===========================
+ ========================= 2 failed in 0.18 seconds =========================
You see the two ``assert 0`` failing and more importantly you can also see
that the same (module-scoped) ``smtp`` object was passed into the two
@@ -311,8 +309,7 @@
again, nothing much has changed::
$ py.test -s -q --tb=no
- FFteardown smtp
-
+ FF
2 failed in 0.17 seconds
Let's quickly create another test module that actually sets the
@@ -329,11 +326,11 @@
$ py.test -qq --tb=short test_anothersmtp.py
F
- =================================== FAILURES ===================================
- ________________________________ test_showhelo _________________________________
+ ================================= FAILURES =================================
+ ______________________________ test_showhelo _______________________________
test_anothersmtp.py:5: in test_showhelo
assert 0, smtp.helo()
- E AssertionError: (250, 'hq.merlinux.eu')
+ E AssertionError: (250, b'mail.python.org')
voila! The ``smtp`` fixture function picked up our mail server name
from the module namespace.
@@ -377,22 +374,21 @@
$ py.test -q test_module.py
FFFF
- =================================== FAILURES ===================================
- ____________________________ test_ehlo[merlinux.eu] ____________________________
+ ================================= FAILURES =================================
+ __________________________ test_ehlo[merlinux.eu] __________________________
- smtp = <smtplib.SMTP instance at 0x7f4fdf04cea8>
+ smtp = <smtplib.SMTP object at 0x2b824acf3e80>
def test_ehlo(smtp):
response = smtp.ehlo()
assert response[0] == 250
- assert "merlinux" in response[1]
- > assert 0 # for demo purposes
- E assert 0
+ > assert "merlinux" in response[1]
+ E TypeError: Type str doesn't support the buffer API
- test_module.py:6: AssertionError
- ____________________________ test_noop[merlinux.eu] ____________________________
+ test_module.py:5: TypeError
+ __________________________ test_noop[merlinux.eu] __________________________
- smtp = <smtplib.SMTP instance at 0x7f4fdf04cea8>
+ smtp = <smtplib.SMTP object at 0x2b824acf3e80>
def test_noop(smtp):
response = smtp.noop()
@@ -401,22 +397,22 @@
E assert 0
test_module.py:11: AssertionError
- __________________________ test_ehlo[mail.python.org] __________________________
+ ________________________ test_ehlo[mail.python.org] ________________________
- smtp = <smtplib.SMTP instance at 0x7f4fdf07c290>
+ smtp = <smtplib.SMTP object at 0x2b824b19fb38>
def test_ehlo(smtp):
response = smtp.ehlo()
assert response[0] == 250
> assert "merlinux" in response[1]
- E assert 'merlinux' in 'mail.python.org\nSIZE 25600000\nETRN\nSTARTTLS\nENHANCEDSTATUSCODES\n8BITMIME\nDSN\nSMTPUTF8'
+ E TypeError: Type str doesn't support the buffer API
- test_module.py:5: AssertionError
- ---------------------------- Captured stdout setup -----------------------------
- finalizing <smtplib.SMTP instance at 0x7f4fdf04cea8>
- __________________________ test_noop[mail.python.org] __________________________
+ test_module.py:5: TypeError
+ -------------------------- Captured stdout setup ---------------------------
+ finalizing <smtplib.SMTP object at 0x2b824acf3e80>
+ ________________________ test_noop[mail.python.org] ________________________
- smtp = <smtplib.SMTP instance at 0x7f4fdf07c290>
+ smtp = <smtplib.SMTP object at 0x2b824b19fb38>
def test_noop(smtp):
response = smtp.noop()
@@ -425,7 +421,7 @@
E assert 0
test_module.py:11: AssertionError
- 4 failed in 6.26 seconds
+ 4 failed in 6.37 seconds
We see that our two test functions each ran twice, against the different
``smtp`` instances. Note also, that with the ``mail.python.org``
@@ -464,14 +460,14 @@
``smtp`` fixture and instantiates an ``App`` object with it. Let's run it::
$ py.test -v test_appsetup.py
- ============================= test session starts ==============================
- platform linux2 -- Python 2.7.6 -- py-1.4.23 -- pytest-2.6.1 -- /home/hpk/venv/0/bin/python
+ =========================== test session starts ============================
+ platform linux -- Python 3.4.0 -- py-1.4.23 -- pytest-2.6.2.dev1 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
collecting ... collected 2 items
test_appsetup.py::test_smtp_exists[merlinux.eu] PASSED
test_appsetup.py::test_smtp_exists[mail.python.org] PASSED
- =========================== 2 passed in 5.46 seconds ===========================
+ ========================= 2 passed in 6.11 seconds =========================
Due to the parametrization of ``smtp`` the test will run twice with two
different ``App`` instances and respective smtp servers. There is no
@@ -528,30 +524,30 @@
Let's run the tests in verbose mode and with looking at the print-output::
$ py.test -v -s test_module.py
- ============================= test session starts ==============================
- platform linux2 -- Python 2.7.6 -- py-1.4.23 -- pytest-2.6.1 -- /home/hpk/venv/0/bin/python
+ =========================== test session starts ============================
+ platform linux -- Python 3.4.0 -- py-1.4.23 -- pytest-2.6.2.dev1 -- /home/hpk/p/pytest/.tox/regen/bin/python3.4
collecting ... collected 8 items
- test_module.py::test_0[1] (' test0', 1)
+ test_module.py::test_0[1] test0 1
PASSED
- test_module.py::test_0[2] (' test0', 2)
+ test_module.py::test_0[2] test0 2
PASSED
- test_module.py::test_1[mod1] ('create', 'mod1')
- (' test1', 'mod1')
+ test_module.py::test_1[mod1] create mod1
+ test1 mod1
PASSED
- test_module.py::test_2[1-mod1] (' test2', 1, 'mod1')
+ test_module.py::test_2[1-mod1] test2 1 mod1
PASSED
- test_module.py::test_2[2-mod1] (' test2', 2, 'mod1')
+ test_module.py::test_2[2-mod1] test2 2 mod1
PASSED
- test_module.py::test_1[mod2] ('create', 'mod2')
- (' test1', 'mod2')
+ test_module.py::test_1[mod2] create mod2
+ test1 mod2
PASSED
- test_module.py::test_2[1-mod2] (' test2', 1, 'mod2')
+ test_module.py::test_2[1-mod2] test2 1 mod2
PASSED
- test_module.py::test_2[2-mod2] (' test2', 2, 'mod2')
+ test_module.py::test_2[2-mod2] test2 2 mod2
PASSED
- =========================== 8 passed in 0.01 seconds ===========================
+ ========================= 8 passed in 0.01 seconds =========================
You can see that the parametrized module-scoped ``modarg`` resource caused
an ordering of test execution that lead to the fewest possible "active" resources. The finalizer for the ``mod1`` parametrized resource was executed
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