From commits-noreply at bitbucket.org Thu Feb 3 15:16:32 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Thu, 03 Feb 2011 14:16:32 -0000 Subject: [py-svn] commit/pytest: 2 new changesets Message-ID: <20110203141632.8145.6239@bitbucket03.managed.contegix.com> 2 new changesets in pytest: http://bitbucket.org/hpk42/pytest/changeset/f513690e76d0/ changeset: r2146:f513690e76d0 user: hpk42 date: 2011-01-27 21:11:21 summary: fix error reporting issue when a "pyc" file has no relating "py" affected #: 4 files (241 bytes) --- a/_pytest/main.py Thu Jan 27 11:36:12 2011 +0100 +++ b/_pytest/main.py Thu Jan 27 21:11:21 2011 +0100 @@ -449,7 +449,7 @@ p = p.dirpath() else: p = p.new(basename=p.purebasename+".py") - return p + return str(p) def _parsearg(self, arg): """ return (fspath, names) tuple after checking the file exists. """ --- a/pytest.py Thu Jan 27 11:36:12 2011 +0100 +++ b/pytest.py Thu Jan 27 21:11:21 2011 +0100 @@ -1,7 +1,7 @@ """ unit and functional testing with Python. """ -__version__ = '2.0.1.dev9' +__version__ = '2.0.1.dev10' __all__ = ['main'] from _pytest.core import main, UsageError, _preloadplugins --- a/setup.py Thu Jan 27 11:36:12 2011 +0100 +++ b/setup.py Thu Jan 27 21:11:21 2011 +0100 @@ -22,7 +22,7 @@ name='pytest', description='py.test: simple powerful testing with Python', long_description = long_description, - version='2.0.1.dev9', + version='2.0.1.dev10', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], @@ -67,4 +67,4 @@ return {'console_scripts': l} if __name__ == '__main__': - main() + main() \ No newline at end of file --- a/testing/acceptance_test.py Thu Jan 27 11:36:12 2011 +0100 +++ b/testing/acceptance_test.py Thu Jan 27 21:11:21 2011 +0100 @@ -346,6 +346,12 @@ result.stdout.fnmatch_lines([ "*2 passed*" ]) + path.join('test_hello.py').remove() + result = testdir.runpytest("--pyargs", "tpkg.test_hello") + assert result.ret != 0 + result.stderr.fnmatch_lines([ + "*file*not*found*test_hello.py", + ]) def test_cmdline_python_package_not_exists(self, testdir): result = testdir.runpytest("--pyargs", "tpkgwhatv") http://bitbucket.org/hpk42/pytest/changeset/5c8abd0a8c3a/ changeset: r2147:5c8abd0a8c3a user: hpk42 date: 2011-02-03 15:14:50 summary: bumping version to pytest-2.0.1, regen docs and examples affected #: 18 files (2.8 KB) --- a/CHANGELOG Thu Jan 27 21:11:21 2011 +0100 +++ b/CHANGELOG Thu Feb 03 15:14:50 2011 +0100 @@ -1,7 +1,7 @@ -Changes between 2.0.0 and 2.0.1.devX +Changes between 2.0.0 and 2.0.1 ---------------------------------------------- -- refine and unify initial capturing so that it works nicely +- refine and unify initial capturing so that it works nicely even if the logging module is used on an early-loaded conftest.py file or plugin. - fix issue12 - show plugin versions with "--version" and --- a/doc/assert.txt Thu Jan 27 21:11:21 2011 +0100 +++ b/doc/assert.txt Thu Feb 03 15:14:50 2011 +0100 @@ -23,7 +23,7 @@ $ py.test test_assert1.py =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.0 + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 collecting ... collected 1 items test_assert1.py F @@ -105,7 +105,7 @@ $ py.test test_assert2.py =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.0 + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 collecting ... collected 1 items test_assert2.py F --- a/doc/capture.txt Thu Jan 27 21:11:21 2011 +0100 +++ b/doc/capture.txt Thu Feb 03 15:14:50 2011 +0100 @@ -36,7 +36,7 @@ $ py.test =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.1.dev1 + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 collecting ... collected 2 items test_module.py .F @@ -50,8 +50,8 @@ test_module.py:9: AssertionError ----------------------------- Captured stdout ------------------------------ - setting up - ==================== 1 failed, 1 passed in 0.04 seconds ==================== + setting up + ==================== 1 failed, 1 passed in 0.02 seconds ==================== Setting capturing methods or disabling capturing ------------------------------------------------- --- a/doc/doctest.txt Thu Jan 27 21:11:21 2011 +0100 +++ b/doc/doctest.txt Thu Feb 03 15:14:50 2011 +0100 @@ -44,9 +44,9 @@ $ py.test =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.0 + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 collecting ... collected 1 items mymodule.py . - ========================= 1 passed in 0.03 seconds ========================= + ========================= 1 passed in 0.01 seconds ========================= --- a/doc/example/mysetup.txt Thu Jan 27 21:11:21 2011 +0100 +++ b/doc/example/mysetup.txt Thu Feb 03 15:14:50 2011 +0100 @@ -49,7 +49,7 @@ $ py.test test_sample.py =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.0 + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 collecting ... collected 1 items test_sample.py F @@ -57,7 +57,7 @@ ================================= FAILURES ================================= _______________________________ test_answer ________________________________ - mysetup = + mysetup = def test_answer(mysetup): app = mysetup.myapp() @@ -122,12 +122,12 @@ $ py.test test_ssh.py -rs =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.0 + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 collecting ... collected 1 items test_ssh.py s ========================= short test summary info ========================== - SKIP [1] /tmp/doc-exec-474/conftest.py:22: specify ssh host with --ssh + SKIP [1] /tmp/doc-exec-77/conftest.py:22: specify ssh host with --ssh ======================== 1 skipped in 0.02 seconds ========================= --- a/doc/example/nonpython.txt Thu Jan 27 21:11:21 2011 +0100 +++ b/doc/example/nonpython.txt Thu Feb 03 15:14:50 2011 +0100 @@ -27,7 +27,7 @@ nonpython $ py.test test_simple.yml =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.0 + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 collecting ... collected 2 items test_simple.yml .F @@ -37,7 +37,7 @@ usecase execution failed spec failed: 'some': 'other' no further details known at this point. - ==================== 1 failed, 1 passed in 0.03 seconds ==================== + ==================== 1 failed, 1 passed in 0.15 seconds ==================== You get one dot for the passing ``sub1: sub1`` check and one failure. Obviously in the above ``conftest.py`` you'll want to implement a more @@ -56,7 +56,7 @@ nonpython $ py.test -v =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.0 -- /home/hpk/venv/0/bin/python + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 -- /home/hpk/venv/0/bin/python collecting ... collected 2 items test_simple.yml:1: usecase: ok PASSED @@ -67,7 +67,7 @@ usecase execution failed spec failed: 'some': 'other' no further details known at this point. - ==================== 1 failed, 1 passed in 0.03 seconds ==================== + ==================== 1 failed, 1 passed in 0.06 seconds ==================== While developing your custom test collection and execution it's also interesting to just look at the collection tree:: --- a/doc/example/parametrize.txt Thu Jan 27 21:11:21 2011 +0100 +++ b/doc/example/parametrize.txt Thu Feb 03 15:14:50 2011 +0100 @@ -46,7 +46,7 @@ ================================= FAILURES ================================= _________________________ TestClass.test_equals[0] _________________________ - self = , a = 1, b = 2 + self = , a = 1, b = 2 def test_equals(self, a, b): > assert a == b @@ -55,7 +55,7 @@ test_parametrize.py:17: AssertionError ______________________ TestClass.test_zerodivision[1] ______________________ - self = , a = 3, b = 2 + self = , a = 3, b = 2 def test_zerodivision(self, a, b): > pytest.raises(ZeroDivisionError, "a/b") @@ -103,7 +103,7 @@ ================================= FAILURES ================================= _________________________ TestClass.test_equals[0] _________________________ - self = , a = 1, b = 2 + self = , a = 1, b = 2 @params([dict(a=1, b=2), dict(a=3, b=3), ]) def test_equals(self, a, b): @@ -113,7 +113,7 @@ test_parametrize2.py:19: AssertionError ______________________ TestClass.test_zerodivision[1] ______________________ - self = , a = 3, b = 2 + self = , a = 3, b = 2 @params([dict(a=1, b=0), dict(a=3, b=2)]) def test_zerodivision(self, a, b): @@ -142,4 +142,4 @@ . $ py.test -q multipython.py collecting ... collected 75 items ....s....s....s....ssssss....s....s....s....ssssss....s....s....s....ssssss - 48 passed, 27 skipped in 2.74 seconds + 48 passed, 27 skipped in 2.08 seconds --- a/doc/example/reportingdemo.txt Thu Jan 27 21:11:21 2011 +0100 +++ b/doc/example/reportingdemo.txt Thu Feb 03 15:14:50 2011 +0100 @@ -13,10 +13,10 @@ assertion $ py.test failure_demo.py =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.0 - collecting ... collected 35 items + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 + collecting ... collected 39 items - failure_demo.py FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + failure_demo.py FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ================================= FAILURES ================================= ____________________________ test_generative[0] ____________________________ @@ -30,7 +30,7 @@ failure_demo.py:15: AssertionError _________________________ TestFailing.test_simple __________________________ - self = + self = def test_simple(self): def f(): @@ -40,13 +40,13 @@ > assert f() == g() E assert 42 == 43 - E + where 42 = () - E + and 43 = () + E + where 42 = () + E + and 43 = () failure_demo.py:28: AssertionError ____________________ TestFailing.test_simple_multiline _____________________ - self = + self = def test_simple_multiline(self): otherfunc_multi( @@ -66,19 +66,19 @@ failure_demo.py:12: AssertionError ___________________________ TestFailing.test_not ___________________________ - self = + self = def test_not(self): def f(): return 42 > assert not f() E assert not 42 - E + where 42 = () + E + where 42 = () failure_demo.py:38: AssertionError _________________ TestSpecialisedExplanations.test_eq_text _________________ - self = + self = def test_eq_text(self): > assert 'spam' == 'eggs' @@ -89,7 +89,7 @@ failure_demo.py:42: AssertionError _____________ TestSpecialisedExplanations.test_eq_similar_text _____________ - self = + self = def test_eq_similar_text(self): > assert 'foo 1 bar' == 'foo 2 bar' @@ -102,7 +102,7 @@ failure_demo.py:45: AssertionError ____________ TestSpecialisedExplanations.test_eq_multiline_text ____________ - self = + self = def test_eq_multiline_text(self): > assert 'foo\nspam\nbar' == 'foo\neggs\nbar' @@ -115,13 +115,13 @@ failure_demo.py:48: AssertionError ______________ TestSpecialisedExplanations.test_eq_long_text _______________ - self = + self = def test_eq_long_text(self): a = '1'*100 + 'a' + '2'*100 b = '1'*100 + 'b' + '2'*100 > assert a == b - E assert '111111111111...2222222222222' == '111111111111...2222222222222' + E assert '111111111111...2222222222222' == '1111111111111...2222222222222' E Skipping 90 identical leading characters in diff E Skipping 91 identical trailing characters in diff E - 1111111111a222222222 @@ -132,13 +132,13 @@ failure_demo.py:53: AssertionError _________ TestSpecialisedExplanations.test_eq_long_text_multiline __________ - self = + self = def test_eq_long_text_multiline(self): a = '1\n'*100 + 'a' + '2\n'*100 b = '1\n'*100 + 'b' + '2\n'*100 > assert a == b - E assert '1\n1\n1\n1\n...n2\n2\n2\n2\n' == '1\n1\n1\n1\n...n2\n2\n2\n2\n' + E assert '1\n1\n1\n1\n...n2\n2\n2\n2\n' == '1\n1\n1\n1\n1...n2\n2\n2\n2\n' E Skipping 190 identical leading characters in diff E Skipping 191 identical trailing characters in diff E 1 @@ -156,7 +156,7 @@ failure_demo.py:58: AssertionError _________________ TestSpecialisedExplanations.test_eq_list _________________ - self = + self = def test_eq_list(self): > assert [0, 1, 2] == [0, 1, 3] @@ -166,7 +166,7 @@ failure_demo.py:61: AssertionError ______________ TestSpecialisedExplanations.test_eq_list_long _______________ - self = + self = def test_eq_list_long(self): a = [0]*100 + [1] + [3]*100 @@ -178,7 +178,7 @@ failure_demo.py:66: AssertionError _________________ TestSpecialisedExplanations.test_eq_dict _________________ - self = + self = def test_eq_dict(self): > assert {'a': 0, 'b': 1} == {'a': 0, 'b': 2} @@ -191,7 +191,7 @@ failure_demo.py:69: AssertionError _________________ TestSpecialisedExplanations.test_eq_set __________________ - self = + self = def test_eq_set(self): > assert set([0, 10, 11, 12]) == set([0, 20, 21]) @@ -207,7 +207,7 @@ failure_demo.py:72: AssertionError _____________ TestSpecialisedExplanations.test_eq_longer_list ______________ - self = + self = def test_eq_longer_list(self): > assert [1,2] == [1,2,3] @@ -217,13 +217,70 @@ failure_demo.py:75: AssertionError _________________ TestSpecialisedExplanations.test_in_list _________________ - self = + self = def test_in_list(self): > assert 1 in [0, 2, 3, 4, 5] E assert 1 in [0, 2, 3, 4, 5] failure_demo.py:78: AssertionError + __________ TestSpecialisedExplanations.test_not_in_text_multiline __________ + + self = + + def test_not_in_text_multiline(self): + text = 'some multiline\ntext\nwhich\nincludes foo\nand a\ntail' + > assert 'foo' not in text + E assert 'foo' not in 'some multiline\ntext\nw...ncludes foo\nand a\ntail' + E 'foo' is contained here: + E some multiline + E text + E which + E includes foo + E ? +++ + E and a + E tail + + failure_demo.py:82: AssertionError + ___________ TestSpecialisedExplanations.test_not_in_text_single ____________ + + self = + + def test_not_in_text_single(self): + text = 'single foo line' + > assert 'foo' not in text + E assert 'foo' not in 'single foo line' + E 'foo' is contained here: + E single foo line + E ? +++ + + failure_demo.py:86: AssertionError + _________ TestSpecialisedExplanations.test_not_in_text_single_long _________ + + self = + + def test_not_in_text_single_long(self): + text = 'head ' * 50 + 'foo ' + 'tail ' * 20 + > assert 'foo' not in text + E assert 'foo' not in 'head head head head hea...ail tail tail tail tail ' + E 'foo' is contained here: + E head head foo tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail + E ? +++ + + failure_demo.py:90: AssertionError + ______ TestSpecialisedExplanations.test_not_in_text_single_long_term _______ + + self = + + def test_not_in_text_single_long_term(self): + text = 'head ' * 50 + 'f'*70 + 'tail ' * 20 + > assert 'f'*70 not in text + E assert 'fffffffffff...ffffffffffff' not in 'head head he...l tail tail ' + E 'ffffffffffffffffff...fffffffffffffffffff' is contained here: + E head head fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffftail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail tail + E ? ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + failure_demo.py:94: AssertionError ______________________________ test_attribute ______________________________ def test_attribute(): @@ -232,9 +289,9 @@ i = Foo() > assert i.b == 2 E assert 1 == 2 - E + where 1 = .b + E + where 1 = .b - failure_demo.py:85: AssertionError + failure_demo.py:101: AssertionError _________________________ test_attribute_instance __________________________ def test_attribute_instance(): @@ -242,10 +299,10 @@ b = 1 > assert Foo().b == 2 E assert 1 == 2 - E + where 1 = .b - E + where = () + E + where 1 = .b + E + where = () - failure_demo.py:91: AssertionError + failure_demo.py:107: AssertionError __________________________ test_attribute_failure __________________________ def test_attribute_failure(): @@ -256,16 +313,16 @@ i = Foo() > assert i.b == 2 - failure_demo.py:100: + failure_demo.py:116: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - self = + self = def _get_b(self): > raise Exception('Failed to get attrib') E Exception: Failed to get attrib - failure_demo.py:97: Exception + failure_demo.py:113: Exception _________________________ test_attribute_multiple __________________________ def test_attribute_multiple(): @@ -275,57 +332,57 @@ b = 2 > assert Foo().b == Bar().b E assert 1 == 2 - E + where 1 = .b - E + where = () - E + and 2 = .b - E + where = () + E + where 1 = .b + E + where = () + E + and 2 = .b + E + where = () - failure_demo.py:108: AssertionError + failure_demo.py:124: AssertionError __________________________ TestRaises.test_raises __________________________ - self = + self = def test_raises(self): s = 'qwe' > raises(TypeError, "int(s)") - failure_demo.py:117: + failure_demo.py:133: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > int(s) E ValueError: invalid literal for int() with base 10: 'qwe' - <0-codegen /home/hpk/p/pytest/_pytest/python.py:819>:1: ValueError + <0-codegen /home/hpk/p/pytest/_pytest/python.py:822>:1: ValueError ______________________ TestRaises.test_raises_doesnt _______________________ - self = + self = def test_raises_doesnt(self): > raises(IOError, "int('3')") E Failed: DID NOT RAISE - failure_demo.py:120: Failed + failure_demo.py:136: Failed __________________________ TestRaises.test_raise ___________________________ - self = + self = def test_raise(self): > raise ValueError("demo error") E ValueError: demo error - failure_demo.py:123: ValueError + failure_demo.py:139: ValueError ________________________ TestRaises.test_tupleerror ________________________ - self = + self = def test_tupleerror(self): > a,b = [1] E ValueError: need more than 1 value to unpack - failure_demo.py:126: ValueError + failure_demo.py:142: ValueError ______ TestRaises.test_reinterpret_fails_with_print_for_the_fun_of_it ______ - self = + self = def test_reinterpret_fails_with_print_for_the_fun_of_it(self): l = [1,2,3] @@ -333,18 +390,18 @@ > a,b = l.pop() E TypeError: 'int' object is not iterable - failure_demo.py:131: TypeError + failure_demo.py:147: TypeError ----------------------------- Captured stdout ------------------------------ l is [1, 2, 3] ________________________ TestRaises.test_some_error ________________________ - self = + self = def test_some_error(self): > if namenotexi: E NameError: global name 'namenotexi' is not defined - failure_demo.py:134: NameError + failure_demo.py:150: NameError ____________________ test_dynamic_compile_shows_nicely _____________________ def test_dynamic_compile_shows_nicely(): @@ -356,17 +413,17 @@ py.std.sys.modules[name] = module > module.foo() - failure_demo.py:149: + failure_demo.py:165: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def foo(): > assert 1 == 0 E assert 1 == 0 - <2-codegen 'abc-123' /home/hpk/p/pytest/doc/example/assertion/failure_demo.py:146>:2: AssertionError + <2-codegen 'abc-123' /home/hpk/p/pytest/doc/example/assertion/failure_demo.py:162>:2: AssertionError ____________________ TestMoreErrors.test_complex_error _____________________ - self = + self = def test_complex_error(self): def f(): @@ -375,7 +432,7 @@ return 43 > somefunc(f(), g()) - failure_demo.py:159: + failure_demo.py:175: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ x = 44, y = 43 @@ -395,39 +452,39 @@ failure_demo.py:5: AssertionError ___________________ TestMoreErrors.test_z1_unpack_error ____________________ - self = + self = def test_z1_unpack_error(self): l = [] > a,b = l E ValueError: need more than 0 values to unpack - failure_demo.py:163: ValueError + failure_demo.py:179: ValueError ____________________ TestMoreErrors.test_z2_type_error _____________________ - self = + self = def test_z2_type_error(self): l = 3 > a,b = l E TypeError: 'int' object is not iterable - failure_demo.py:167: TypeError + failure_demo.py:183: TypeError ______________________ TestMoreErrors.test_startswith ______________________ - self = + self = def test_startswith(self): s = "123" g = "456" > assert s.startswith(g) - E assert ('456') - E + where = '123'.startswith + E assert ('456') + E + where = '123'.startswith - failure_demo.py:172: AssertionError + failure_demo.py:188: AssertionError __________________ TestMoreErrors.test_startswith_nested ___________________ - self = + self = def test_startswith_nested(self): def f(): @@ -435,47 +492,47 @@ def g(): return "456" > assert f().startswith(g()) - E assert ('456') - E + where = '123'.startswith - E + where '123' = () - E + and '456' = () + E assert ('456') + E + where = '123'.startswith + E + where '123' = () + E + and '456' = () - failure_demo.py:179: AssertionError + failure_demo.py:195: AssertionError _____________________ TestMoreErrors.test_global_func ______________________ - self = + self = def test_global_func(self): > assert isinstance(globf(42), float) E assert isinstance(43, float) E + where 43 = globf(42) - failure_demo.py:182: AssertionError + failure_demo.py:198: AssertionError _______________________ TestMoreErrors.test_instance _______________________ - self = + self = def test_instance(self): self.x = 6*7 > assert self.x != 42 E assert 42 != 42 E + where 42 = 42 - E + where 42 = .x + E + where 42 = .x - failure_demo.py:186: AssertionError + failure_demo.py:202: AssertionError _______________________ TestMoreErrors.test_compare ________________________ - self = + self = def test_compare(self): > assert globf(10) < 5 E assert 11 < 5 E + where 11 = globf(10) - failure_demo.py:189: AssertionError + failure_demo.py:205: AssertionError _____________________ TestMoreErrors.test_try_finally ______________________ - self = + self = def test_try_finally(self): x = 1 @@ -483,5 +540,5 @@ > assert x == 0 E assert 1 == 0 - failure_demo.py:194: AssertionError - ======================== 35 failed in 0.19 seconds ========================= + failure_demo.py:210: AssertionError + ======================== 39 failed in 0.22 seconds ========================= --- a/doc/example/simple.txt Thu Jan 27 21:11:21 2011 +0100 +++ b/doc/example/simple.txt Thu Feb 03 15:14:50 2011 +0100 @@ -138,7 +138,7 @@ E assert 4 < 4 test_compute.py:3: AssertionError - 1 failed, 4 passed in 0.03 seconds + 1 failed, 4 passed in 0.02 seconds As expected when running the full range of ``param1`` values we'll get an error on the last one. @@ -167,13 +167,13 @@ $ py.test =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.1.dev8 + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 gw0 I / gw1 I / gw2 I / gw3 I gw0 [0] / gw1 [0] / gw2 [0] / gw3 [0] scheduling tests via LoadScheduling - ============================= in 0.43 seconds ============================= + ============================= in 0.31 seconds ============================= .. _`retrieved by hooks as item keywords`: @@ -214,12 +214,12 @@ $ py.test -rs # "-rs" means report details on the little 's' =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.1.dev8 + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 collecting ... collected 2 items test_module.py .s ========================= short test summary info ========================== - SKIP [1] /tmp/doc-exec-46/conftest.py:9: need --runslow option to run + SKIP [1] /tmp/doc-exec-82/conftest.py:9: need --runslow option to run =================== 1 passed, 1 skipped in 0.02 seconds ==================== @@ -227,7 +227,7 @@ $ py.test --runslow =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.1.dev8 + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 collecting ... collected 2 items test_module.py .. @@ -319,7 +319,7 @@ $ py.test =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.1.dev8 + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 project deps: mylib-1.1 collecting ... collected 0 items @@ -342,7 +342,7 @@ $ py.test -v =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.1.dev8 -- /home/hpk/venv/0/bin/python + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 -- /home/hpk/venv/0/bin/python info1: did you know that ... did you? collecting ... collected 0 items @@ -353,7 +353,7 @@ $ py.test =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.1.dev8 + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 collecting ... collected 0 items ============================= in 0.00 seconds ============================= --- a/doc/funcargs.txt Thu Jan 27 21:11:21 2011 +0100 +++ b/doc/funcargs.txt Thu Feb 03 15:14:50 2011 +0100 @@ -45,7 +45,7 @@ $ py.test test_simplefactory.py =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.0 + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 collecting ... collected 1 items test_simplefactory.py F @@ -150,7 +150,7 @@ $ py.test test_example.py =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.0 + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 collecting ... collected 10 items test_example.py .........F @@ -188,7 +188,7 @@ $ py.test -v -k 7 test_example.py # or -k test_func[7] =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.0 -- /home/hpk/venv/0/bin/python + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 -- /home/hpk/venv/0/bin/python collecting ... collected 10 items test_example.py:6: test_func[7] PASSED --- a/doc/getting-started.txt Thu Jan 27 21:11:21 2011 +0100 +++ b/doc/getting-started.txt Thu Feb 03 15:14:50 2011 +0100 @@ -16,7 +16,10 @@ To check your installation has installed the correct version:: $ py.test --version - This is py.test version 2.0.0, imported from /home/hpk/p/pytest/pytest.pyc + This is py.test version 2.0.1, imported from /home/hpk/p/pytest/pytest.py + setuptools registered plugins: + pytest-xdist-1.6.dev2 at /home/hpk/p/pytest-xdist/xdist/plugin.pyc + pytest-pep8-0.7 at /home/hpk/p/pytest-pep8/pytest_pep8.pyc If you get an error checkout :ref:`installation issues`. @@ -38,7 +41,7 @@ $ py.test =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.0 + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 collecting ... collected 1 items test_sample.py F @@ -128,7 +131,7 @@ ================================= FAILURES ================================= ____________________________ TestClass.test_two ____________________________ - self = + self = def test_two(self): x = "hello" @@ -165,7 +168,7 @@ ================================= FAILURES ================================= _____________________________ test_needsfiles ______________________________ - tmpdir = local('/tmp/pytest-7/test_needsfiles0') + tmpdir = local('/tmp/pytest-9/test_needsfiles0') def test_needsfiles(tmpdir): print tmpdir @@ -174,8 +177,8 @@ test_tmpdir.py:3: AssertionError ----------------------------- Captured stdout ------------------------------ - /tmp/pytest-7/test_needsfiles0 - 1 failed in 0.04 seconds + /tmp/pytest-9/test_needsfiles0 + 1 failed in 0.02 seconds Before the test runs, a unique-per-test-invocation temporary directory was created. More info at :ref:`tmpdir handling`. --- a/doc/mark.txt Thu Jan 27 21:11:21 2011 +0100 +++ b/doc/mark.txt Thu Feb 03 15:14:50 2011 +0100 @@ -88,19 +88,19 @@ $ py.test -k webtest # running with the above defined examples yields =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.0 + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 collecting ... collected 4 items test_mark.py .. test_mark_classlevel.py .. - ========================= 4 passed in 0.01 seconds ========================= + ========================= 4 passed in 0.02 seconds ========================= And you can also run all tests except the ones that match the keyword:: $ py.test -k-webtest =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.0 + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 collecting ... collected 4 items ===================== 4 tests deselected by '-webtest' ===================== @@ -110,7 +110,7 @@ $ py.test -kTestClass =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.0 + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 collecting ... collected 4 items test_mark_classlevel.py .. --- a/doc/monkeypatch.txt Thu Jan 27 21:11:21 2011 +0100 +++ b/doc/monkeypatch.txt Thu Feb 03 15:14:50 2011 +0100 @@ -39,7 +39,7 @@ .. background check: $ py.test =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.0 + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 collecting ... collected 0 items ============================= in 0.00 seconds ============================= --- a/doc/skipping.txt Thu Jan 27 21:11:21 2011 +0100 +++ b/doc/skipping.txt Thu Feb 03 15:14:50 2011 +0100 @@ -121,7 +121,7 @@ example $ py.test -rx xfail_demo.py =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.0 + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 collecting ... collected 5 items xfail_demo.py xxxxx @@ -136,7 +136,7 @@ XFAIL xfail_demo.py::test_hello5 reason: reason - ======================== 5 xfailed in 0.04 seconds ========================= + ======================== 5 xfailed in 0.05 seconds ========================= imperative xfail from within a test or setup function ------------------------------------------------------ --- a/doc/tmpdir.txt Thu Jan 27 21:11:21 2011 +0100 +++ b/doc/tmpdir.txt Thu Feb 03 15:14:50 2011 +0100 @@ -28,7 +28,7 @@ $ py.test test_tmpdir.py =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.0 + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 collecting ... collected 1 items test_tmpdir.py F @@ -36,7 +36,7 @@ ================================= FAILURES ================================= _____________________________ test_create_file _____________________________ - tmpdir = local('/tmp/pytest-8/test_create_file0') + tmpdir = local('/tmp/pytest-10/test_create_file0') def test_create_file(tmpdir): p = tmpdir.mkdir("sub").join("hello.txt") @@ -47,7 +47,7 @@ E assert 0 test_tmpdir.py:7: AssertionError - ========================= 1 failed in 0.04 seconds ========================= + ========================= 1 failed in 0.02 seconds ========================= .. _`base temporary directory`: --- a/doc/unittest.txt Thu Jan 27 21:11:21 2011 +0100 +++ b/doc/unittest.txt Thu Feb 03 15:14:50 2011 +0100 @@ -24,7 +24,7 @@ $ py.test test_unittest.py =========================== test session starts ============================ - platform linux2 -- Python 2.6.5 -- pytest-2.0.0 + platform linux2 -- Python 2.6.6 -- pytest-2.0.1 collecting ... collected 1 items test_unittest.py F @@ -56,7 +56,7 @@ /usr/lib/python2.6/unittest.py:350: AssertionError ----------------------------- Captured stdout ------------------------------ hello - ========================= 1 failed in 0.03 seconds ========================= + ========================= 1 failed in 0.02 seconds ========================= .. _`unittest.py style`: http://docs.python.org/library/unittest.html --- a/pytest.py Thu Jan 27 21:11:21 2011 +0100 +++ b/pytest.py Thu Feb 03 15:14:50 2011 +0100 @@ -1,7 +1,7 @@ """ unit and functional testing with Python. """ -__version__ = '2.0.1.dev10' +__version__ = '2.0.1' __all__ = ['main'] from _pytest.core import main, UsageError, _preloadplugins --- a/setup.py Thu Jan 27 21:11:21 2011 +0100 +++ b/setup.py Thu Feb 03 15:14:50 2011 +0100 @@ -22,7 +22,7 @@ name='pytest', description='py.test: simple powerful testing with Python', long_description = long_description, - version='2.0.1.dev10', + version='2.0.1', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], @@ -67,4 +67,4 @@ return {'console_scripts': l} if __name__ == '__main__': - main() \ No newline at end of file + main() 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. From commits-noreply at bitbucket.org Thu Feb 3 15:16:38 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Thu, 03 Feb 2011 14:16:38 -0000 Subject: [py-svn] commit/py: hpk42: bumping version to py-1.4.1 Message-ID: <20110203141638.4303.58812@bitbucket02.managed.contegix.com> 1 new changeset in py: http://bitbucket.org/hpk42/py/changeset/5707fc2a122d/ changeset: r2002:5707fc2a122d user: hpk42 date: 2011-02-03 15:16:18 summary: bumping version to py-1.4.1 affected #: 2 files (10 bytes) --- a/py/__init__.py Thu Jan 27 16:03:31 2011 +0100 +++ b/py/__init__.py Thu Feb 03 15:16:18 2011 +0100 @@ -8,7 +8,7 @@ (c) Holger Krekel and others, 2004-2010 """ -__version__ = '1.4.1.dev4' +__version__ = '1.4.1' from py import _apipkg --- a/setup.py Thu Jan 27 16:03:31 2011 +0100 +++ b/setup.py Thu Feb 03 15:16:18 2011 +0100 @@ -9,7 +9,7 @@ name='py', description='library with cross-python path, ini-parsing, io, code, log facilities', long_description = open('README.txt').read(), - version='1.4.1.dev4', + version='1.4.1', url='http://pylib.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], Repository URL: https://bitbucket.org/hpk42/py/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Thu Feb 3 15:58:32 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Thu, 03 Feb 2011 14:58:32 -0000 Subject: [py-svn] commit/pytest: hpk42: add release announcement Message-ID: <20110203145832.4305.12310@bitbucket02.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/1a01ed069c76/ changeset: r2148:1a01ed069c76 user: hpk42 date: 2011-02-03 15:58:22 summary: add release announcement affected #: 2 files (17 bytes) --- a/doc/announce/index.txt Thu Feb 03 15:14:50 2011 +0100 +++ b/doc/announce/index.txt Thu Feb 03 15:58:22 2011 +0100 @@ -5,5 +5,6 @@ .. toctree:: :maxdepth: 2 + release-2.0.1 release-2.0.0 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. From commits-noreply at bitbucket.org Thu Feb 3 16:40:34 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Thu, 03 Feb 2011 15:40:34 -0000 Subject: [py-svn] commit/py: flub: Don't hide values of builtins (issue8) Message-ID: <20110203154034.4303.95975@bitbucket02.managed.contegix.com> 1 new changeset in py: http://bitbucket.org/hpk42/py/changeset/71dfb239aa60/ changeset: r2003:71dfb239aa60 user: flub date: 2011-02-03 16:38:15 summary: Don't hide values of builtins (issue8) When a statement gets reinterpreted the current implementation goes out of it's way to to not show the result of the call but rather the call itself. This means things like "len(l) == 42" will be shown as "len([0, ...]) == 42" instead of the more desirable "666 == 42". So this patch reverts that behaviour to show the actual results of builtins again. affected #: 3 files (807 bytes) --- a/CHANGELOG Thu Feb 03 15:16:18 2011 +0100 +++ b/CHANGELOG Thu Feb 03 15:38:15 2011 +0000 @@ -18,6 +18,8 @@ - fix (pytest-) issue20 path.samefile(relpath) works as expected now +- fix (pytest-) issue8 len(long_list) now shows the lenght of the list + Changes between 1.3.4 and 1.4.0 ================================================== --- a/py/_code/_assertionnew.py Thu Feb 03 15:16:18 2011 +0100 +++ b/py/_code/_assertionnew.py Thu Feb 03 15:38:15 2011 +0000 @@ -267,20 +267,9 @@ result = self.frame.eval(co, **ns) except Exception: raise Failure(explanation) - # Only show result explanation if it's not a builtin call or returns a - # bool. - if not isinstance(call.func, ast.Name) or \ - not self._is_builtin_name(call.func): - source = "isinstance(__exprinfo_value, bool)" - co = self._compile(source) - try: - is_bool = self.frame.eval(co, __exprinfo_value=result) - except Exception: - is_bool = False - if not is_bool: - pattern = "%s\n{%s = %s\n}" - rep = self.frame.repr(result) - explanation = pattern % (rep, rep, explanation) + pattern = "%s\n{%s = %s\n}" + rep = self.frame.repr(result) + explanation = pattern % (rep, rep, explanation) return explanation, result def _is_builtin_name(self, name): --- a/testing/code/test_assertion.py Thu Feb 03 15:16:18 2011 +0100 +++ b/testing/code/test_assertion.py Thu Feb 03 15:38:15 2011 +0000 @@ -105,6 +105,16 @@ s = str(e) assert s.startswith("assert 1 == 2") +def test_len(): + l = list(xrange(42)) + try: + assert len(l) == 100 + except AssertionError: + e = exvalue() + s = str(e) + assert s.startswith("assert 42 == 100") + assert "where 42 = len([" in s + def test_assert_non_string_message(): class A: def __str__(self): Repository URL: https://bitbucket.org/hpk42/py/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Thu Feb 3 16:56:53 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Thu, 03 Feb 2011 15:56:53 -0000 Subject: [py-svn] commit/py: hpk42: fix for py31 Message-ID: <20110203155653.8146.17131@bitbucket03.managed.contegix.com> 1 new changeset in py: http://bitbucket.org/hpk42/py/changeset/6328d8ee1d40/ changeset: r2004:6328d8ee1d40 user: hpk42 date: 2011-02-03 16:56:33 summary: fix for py31 affected #: 1 file (1 byte) --- a/testing/code/test_assertion.py Thu Feb 03 15:38:15 2011 +0000 +++ b/testing/code/test_assertion.py Thu Feb 03 16:56:33 2011 +0100 @@ -106,7 +106,7 @@ assert s.startswith("assert 1 == 2") def test_len(): - l = list(xrange(42)) + l = list(range(42)) try: assert len(l) == 100 except AssertionError: Repository URL: https://bitbucket.org/hpk42/py/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Fri Feb 4 22:51:28 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Fri, 04 Feb 2011 21:51:28 -0000 Subject: [py-svn] commit/pytest: hpk42: laxer test for also passing it with pypy Message-ID: <20110204215128.4303.10915@bitbucket02.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/8aba9078949b/ changeset: r2149:8aba9078949b user: hpk42 date: 2011-02-04 22:51:05 summary: laxer test for also passing it with pypy affected #: 1 file (3 bytes) --- a/testing/acceptance_test.py Thu Feb 03 15:58:22 2011 +0100 +++ b/testing/acceptance_test.py Fri Feb 04 22:51:05 2011 +0100 @@ -350,7 +350,7 @@ result = testdir.runpytest("--pyargs", "tpkg.test_hello") assert result.ret != 0 result.stderr.fnmatch_lines([ - "*file*not*found*test_hello.py", + "*file*not*found*test_hello", ]) def test_cmdline_python_package_not_exists(self, testdir): 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. From commits-noreply at bitbucket.org Fri Feb 4 23:20:50 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Fri, 04 Feb 2011 22:20:50 -0000 Subject: [py-svn] commit/pytest: hpk42: fix the last committed laxation of a test Message-ID: <20110204222050.17580.32864@bitbucket01.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/9ebb83f594ad/ changeset: r2150:9ebb83f594ad user: hpk42 date: 2011-02-04 23:20:27 summary: fix the last committed laxation of a test affected #: 1 file (1 byte) --- a/testing/acceptance_test.py Fri Feb 04 22:51:05 2011 +0100 +++ b/testing/acceptance_test.py Fri Feb 04 23:20:27 2011 +0100 @@ -350,7 +350,7 @@ result = testdir.runpytest("--pyargs", "tpkg.test_hello") assert result.ret != 0 result.stderr.fnmatch_lines([ - "*file*not*found*test_hello", + "*file*not*found*test_hello*", ]) def test_cmdline_python_package_not_exists(self, testdir): 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. From commits-noreply at bitbucket.org Mon Feb 7 11:13:00 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Mon, 07 Feb 2011 10:13:00 -0000 Subject: [py-svn] commit/pytest: hpk42: accept a left out "()" for ids on command line for better compatibility with pytest.vim Message-ID: <20110207101300.17578.65337@bitbucket01.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/bc0e2169d120/ changeset: r2151:bc0e2169d120 user: hpk42 date: 2011-02-07 11:09:42 summary: accept a left out "()" for ids on command line for better compatibility with pytest.vim affected #: 3 files (977 bytes) --- a/CHANGELOG Fri Feb 04 23:20:27 2011 +0100 +++ b/CHANGELOG Mon Feb 07 11:09:42 2011 +0100 @@ -4,6 +4,8 @@ - refine and unify initial capturing so that it works nicely even if the logging module is used on an early-loaded conftest.py file or plugin. +- allow to omit "()" in test ids to allow for uniform test ids + as produced by Alfredo's nice pytest.vim plugin. - fix issue12 - show plugin versions with "--version" and "--traceconfig" and also document how to add extra information to reporting test header --- a/_pytest/main.py Fri Feb 04 23:20:27 2011 +0100 +++ b/_pytest/main.py Mon Feb 07 11:09:42 2011 +0100 @@ -495,9 +495,15 @@ node.ihook.pytest_collectstart(collector=node) rep = node.ihook.pytest_make_collect_report(collector=node) if rep.passed: + has_matched = False for x in rep.result: if x.name == name: resultnodes.extend(self.matchnodes([x], nextnames)) + has_matched = True + # XXX accept IDs that don't have "()" for class instances + if not has_matched and len(rep.result) == 1 and x.name == "()": + nextnames.insert(0, name) + resultnodes.extend(self.matchnodes([x], nextnames)) node.ihook.pytest_collectreport(report=rep) return resultnodes --- a/testing/test_collection.py Fri Feb 04 23:20:27 2011 +0100 +++ b/testing/test_collection.py Mon Feb 07 11:09:42 2011 +0100 @@ -472,6 +472,21 @@ item2b, = newcol.perform_collect([item.nodeid], genitems=False) assert item2b == item2 + def test_find_byid_without_instance_parents(self, testdir): + p = testdir.makepyfile(""" + class TestClass: + def test_method(self): + pass + """) + arg = p.basename + ("::TestClass::test_method") + config = testdir.parseconfig(arg) + rcol = Session(config) + rcol.perform_collect() + items = rcol.items + assert len(items) == 1 + item, = items + assert item.nodeid.endswith("TestClass::()::test_method") + class Test_getinitialnodes: def test_global_file(self, testdir, tmpdir): x = tmpdir.ensure("x.py") 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. From commits-noreply at bitbucket.org Mon Feb 7 11:47:48 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Mon, 07 Feb 2011 10:47:48 -0000 Subject: [py-svn] commit/pytest: 3 new changesets Message-ID: <20110207104748.17577.15661@bitbucket01.managed.contegix.com> 3 new changesets in pytest: http://bitbucket.org/hpk42/pytest/changeset/7e9d1e8936e8/ changeset: r2152:7e9d1e8936e8 user: hpk42 date: 2011-02-07 11:39:05 summary: doc fixes affected #: 3 files (10 bytes) --- a/doc/Makefile Mon Feb 07 11:09:42 2011 +0100 +++ b/doc/Makefile Mon Feb 07 11:39:05 2011 +0100 @@ -40,7 +40,7 @@ -rm -rf $(BUILDDIR)/* install: clean html - rsync -avz _build/html/ code:www-pytest/2.0.1dev + rsync -avz _build/html/ code:www-pytest/ html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html --- a/doc/_templates/indexsidebar.html Mon Feb 07 11:09:42 2011 +0100 +++ b/doc/_templates/indexsidebar.html Mon Feb 07 11:39:05 2011 +0100 @@ -7,7 +7,7 @@ released versions in the Python Package Index.

{% else %} -

{{ version }} release +

{{ release }} release [Changelog]

pytest on PyPI --- a/doc/projects.txt Mon Feb 07 11:09:42 2011 +0100 +++ b/doc/projects.txt Mon Feb 07 11:39:05 2011 +0100 @@ -45,7 +45,7 @@ * `Tandberg `_ * `Shootq `_ * `Stups department of Heinrich Heine University D?sseldorf `_ -* `cellzome`_ `_ +* `cellzome `_ * `Open End, Gotenborg `_ * `Laboraratory of Bioinformatics, Warsaw `_ * `merlinux, Germany `_ http://bitbucket.org/hpk42/pytest/changeset/e4497c2aed35/ changeset: r2153:e4497c2aed35 user: hpk42 date: 2011-02-07 11:45:37 summary: regen docs with examples affected #: 11 files (161 bytes) --- a/doc/capture.txt Mon Feb 07 11:39:05 2011 +0100 +++ b/doc/capture.txt Mon Feb 07 11:45:37 2011 +0100 @@ -50,7 +50,7 @@ test_module.py:9: AssertionError ----------------------------- Captured stdout ------------------------------ - setting up + setting up ==================== 1 failed, 1 passed in 0.02 seconds ==================== Setting capturing methods or disabling capturing --- a/doc/doctest.txt Mon Feb 07 11:39:05 2011 +0100 +++ b/doc/doctest.txt Mon Feb 07 11:45:37 2011 +0100 @@ -49,4 +49,4 @@ mymodule.py . - ========================= 1 passed in 0.01 seconds ========================= + ========================= 1 passed in 0.02 seconds ========================= --- a/doc/example/mysetup.txt Mon Feb 07 11:39:05 2011 +0100 +++ b/doc/example/mysetup.txt Mon Feb 07 11:45:37 2011 +0100 @@ -57,7 +57,7 @@ ================================= FAILURES ================================= _______________________________ test_answer ________________________________ - mysetup = + mysetup = def test_answer(mysetup): app = mysetup.myapp() @@ -127,7 +127,7 @@ test_ssh.py s ========================= short test summary info ========================== - SKIP [1] /tmp/doc-exec-77/conftest.py:22: specify ssh host with --ssh + SKIP [1] /tmp/doc-exec-166/conftest.py:22: specify ssh host with --ssh ======================== 1 skipped in 0.02 seconds ========================= --- a/doc/example/nonpython.txt Mon Feb 07 11:39:05 2011 +0100 +++ b/doc/example/nonpython.txt Mon Feb 07 11:45:37 2011 +0100 @@ -37,7 +37,7 @@ usecase execution failed spec failed: 'some': 'other' no further details known at this point. - ==================== 1 failed, 1 passed in 0.15 seconds ==================== + ==================== 1 failed, 1 passed in 0.06 seconds ==================== You get one dot for the passing ``sub1: sub1`` check and one failure. Obviously in the above ``conftest.py`` you'll want to implement a more --- a/doc/example/parametrize.txt Mon Feb 07 11:39:05 2011 +0100 +++ b/doc/example/parametrize.txt Mon Feb 07 11:45:37 2011 +0100 @@ -46,7 +46,7 @@ ================================= FAILURES ================================= _________________________ TestClass.test_equals[0] _________________________ - self = , a = 1, b = 2 + self = , a = 1, b = 2 def test_equals(self, a, b): > assert a == b @@ -55,7 +55,7 @@ test_parametrize.py:17: AssertionError ______________________ TestClass.test_zerodivision[1] ______________________ - self = , a = 3, b = 2 + self = , a = 3, b = 2 def test_zerodivision(self, a, b): > pytest.raises(ZeroDivisionError, "a/b") @@ -103,7 +103,7 @@ ================================= FAILURES ================================= _________________________ TestClass.test_equals[0] _________________________ - self = , a = 1, b = 2 + self = , a = 1, b = 2 @params([dict(a=1, b=2), dict(a=3, b=3), ]) def test_equals(self, a, b): @@ -113,7 +113,7 @@ test_parametrize2.py:19: AssertionError ______________________ TestClass.test_zerodivision[1] ______________________ - self = , a = 3, b = 2 + self = , a = 3, b = 2 @params([dict(a=1, b=0), dict(a=3, b=2)]) def test_zerodivision(self, a, b): @@ -142,4 +142,4 @@ . $ py.test -q multipython.py collecting ... collected 75 items ....s....s....s....ssssss....s....s....s....ssssss....s....s....s....ssssss - 48 passed, 27 skipped in 2.08 seconds + 48 passed, 27 skipped in 2.09 seconds --- a/doc/example/reportingdemo.txt Mon Feb 07 11:39:05 2011 +0100 +++ b/doc/example/reportingdemo.txt Mon Feb 07 11:45:37 2011 +0100 @@ -30,7 +30,7 @@ failure_demo.py:15: AssertionError _________________________ TestFailing.test_simple __________________________ - self = + self = def test_simple(self): def f(): @@ -40,13 +40,13 @@ > assert f() == g() E assert 42 == 43 - E + where 42 = () - E + and 43 = () + E + where 42 = () + E + and 43 = () failure_demo.py:28: AssertionError ____________________ TestFailing.test_simple_multiline _____________________ - self = + self = def test_simple_multiline(self): otherfunc_multi( @@ -66,19 +66,19 @@ failure_demo.py:12: AssertionError ___________________________ TestFailing.test_not ___________________________ - self = + self = def test_not(self): def f(): return 42 > assert not f() E assert not 42 - E + where 42 = () + E + where 42 = () failure_demo.py:38: AssertionError _________________ TestSpecialisedExplanations.test_eq_text _________________ - self = + self = def test_eq_text(self): > assert 'spam' == 'eggs' @@ -89,7 +89,7 @@ failure_demo.py:42: AssertionError _____________ TestSpecialisedExplanations.test_eq_similar_text _____________ - self = + self = def test_eq_similar_text(self): > assert 'foo 1 bar' == 'foo 2 bar' @@ -102,7 +102,7 @@ failure_demo.py:45: AssertionError ____________ TestSpecialisedExplanations.test_eq_multiline_text ____________ - self = + self = def test_eq_multiline_text(self): > assert 'foo\nspam\nbar' == 'foo\neggs\nbar' @@ -115,7 +115,7 @@ failure_demo.py:48: AssertionError ______________ TestSpecialisedExplanations.test_eq_long_text _______________ - self = + self = def test_eq_long_text(self): a = '1'*100 + 'a' + '2'*100 @@ -132,7 +132,7 @@ failure_demo.py:53: AssertionError _________ TestSpecialisedExplanations.test_eq_long_text_multiline __________ - self = + self = def test_eq_long_text_multiline(self): a = '1\n'*100 + 'a' + '2\n'*100 @@ -156,7 +156,7 @@ failure_demo.py:58: AssertionError _________________ TestSpecialisedExplanations.test_eq_list _________________ - self = + self = def test_eq_list(self): > assert [0, 1, 2] == [0, 1, 3] @@ -166,7 +166,7 @@ failure_demo.py:61: AssertionError ______________ TestSpecialisedExplanations.test_eq_list_long _______________ - self = + self = def test_eq_list_long(self): a = [0]*100 + [1] + [3]*100 @@ -178,7 +178,7 @@ failure_demo.py:66: AssertionError _________________ TestSpecialisedExplanations.test_eq_dict _________________ - self = + self = def test_eq_dict(self): > assert {'a': 0, 'b': 1} == {'a': 0, 'b': 2} @@ -191,7 +191,7 @@ failure_demo.py:69: AssertionError _________________ TestSpecialisedExplanations.test_eq_set __________________ - self = + self = def test_eq_set(self): > assert set([0, 10, 11, 12]) == set([0, 20, 21]) @@ -207,7 +207,7 @@ failure_demo.py:72: AssertionError _____________ TestSpecialisedExplanations.test_eq_longer_list ______________ - self = + self = def test_eq_longer_list(self): > assert [1,2] == [1,2,3] @@ -217,7 +217,7 @@ failure_demo.py:75: AssertionError _________________ TestSpecialisedExplanations.test_in_list _________________ - self = + self = def test_in_list(self): > assert 1 in [0, 2, 3, 4, 5] @@ -226,7 +226,7 @@ failure_demo.py:78: AssertionError __________ TestSpecialisedExplanations.test_not_in_text_multiline __________ - self = + self = def test_not_in_text_multiline(self): text = 'some multiline\ntext\nwhich\nincludes foo\nand a\ntail' @@ -244,7 +244,7 @@ failure_demo.py:82: AssertionError ___________ TestSpecialisedExplanations.test_not_in_text_single ____________ - self = + self = def test_not_in_text_single(self): text = 'single foo line' @@ -257,7 +257,7 @@ failure_demo.py:86: AssertionError _________ TestSpecialisedExplanations.test_not_in_text_single_long _________ - self = + self = def test_not_in_text_single_long(self): text = 'head ' * 50 + 'foo ' + 'tail ' * 20 @@ -270,7 +270,7 @@ failure_demo.py:90: AssertionError ______ TestSpecialisedExplanations.test_not_in_text_single_long_term _______ - self = + self = def test_not_in_text_single_long_term(self): text = 'head ' * 50 + 'f'*70 + 'tail ' * 20 @@ -289,7 +289,7 @@ i = Foo() > assert i.b == 2 E assert 1 == 2 - E + where 1 = .b + E + where 1 = .b failure_demo.py:101: AssertionError _________________________ test_attribute_instance __________________________ @@ -299,8 +299,8 @@ b = 1 > assert Foo().b == 2 E assert 1 == 2 - E + where 1 = .b - E + where = () + E + where 1 = .b + E + where = () failure_demo.py:107: AssertionError __________________________ test_attribute_failure __________________________ @@ -316,7 +316,7 @@ failure_demo.py:116: _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ - self = + self = def _get_b(self): > raise Exception('Failed to get attrib') @@ -332,15 +332,15 @@ b = 2 > assert Foo().b == Bar().b E assert 1 == 2 - E + where 1 = .b - E + where = () - E + and 2 = .b - E + where = () + E + where 1 = .b + E + where = () + E + and 2 = .b + E + where = () failure_demo.py:124: AssertionError __________________________ TestRaises.test_raises __________________________ - self = + self = def test_raises(self): s = 'qwe' @@ -355,7 +355,7 @@ <0-codegen /home/hpk/p/pytest/_pytest/python.py:822>:1: ValueError ______________________ TestRaises.test_raises_doesnt _______________________ - self = + self = def test_raises_doesnt(self): > raises(IOError, "int('3')") @@ -364,7 +364,7 @@ failure_demo.py:136: Failed __________________________ TestRaises.test_raise ___________________________ - self = + self = def test_raise(self): > raise ValueError("demo error") @@ -373,7 +373,7 @@ failure_demo.py:139: ValueError ________________________ TestRaises.test_tupleerror ________________________ - self = + self = def test_tupleerror(self): > a,b = [1] @@ -382,7 +382,7 @@ failure_demo.py:142: ValueError ______ TestRaises.test_reinterpret_fails_with_print_for_the_fun_of_it ______ - self = + self = def test_reinterpret_fails_with_print_for_the_fun_of_it(self): l = [1,2,3] @@ -395,7 +395,7 @@ l is [1, 2, 3] ________________________ TestRaises.test_some_error ________________________ - self = + self = def test_some_error(self): > if namenotexi: @@ -423,7 +423,7 @@ <2-codegen 'abc-123' /home/hpk/p/pytest/doc/example/assertion/failure_demo.py:162>:2: AssertionError ____________________ TestMoreErrors.test_complex_error _____________________ - self = + self = def test_complex_error(self): def f(): @@ -452,7 +452,7 @@ failure_demo.py:5: AssertionError ___________________ TestMoreErrors.test_z1_unpack_error ____________________ - self = + self = def test_z1_unpack_error(self): l = [] @@ -462,7 +462,7 @@ failure_demo.py:179: ValueError ____________________ TestMoreErrors.test_z2_type_error _____________________ - self = + self = def test_z2_type_error(self): l = 3 @@ -472,19 +472,20 @@ failure_demo.py:183: TypeError ______________________ TestMoreErrors.test_startswith ______________________ - self = + self = def test_startswith(self): s = "123" g = "456" > assert s.startswith(g) - E assert ('456') - E + where = '123'.startswith + E assert False + E + where False = ('456') + E + where = '123'.startswith failure_demo.py:188: AssertionError __________________ TestMoreErrors.test_startswith_nested ___________________ - self = + self = def test_startswith_nested(self): def f(): @@ -492,37 +493,39 @@ def g(): return "456" > assert f().startswith(g()) - E assert ('456') - E + where = '123'.startswith - E + where '123' = () - E + and '456' = () + E assert False + E + where False = ('456') + E + where = '123'.startswith + E + where '123' = () + E + and '456' = () failure_demo.py:195: AssertionError _____________________ TestMoreErrors.test_global_func ______________________ - self = + self = def test_global_func(self): > assert isinstance(globf(42), float) - E assert isinstance(43, float) - E + where 43 = globf(42) + E assert False + E + where False = isinstance(43, float) + E + where 43 = globf(42) failure_demo.py:198: AssertionError _______________________ TestMoreErrors.test_instance _______________________ - self = + self = def test_instance(self): self.x = 6*7 > assert self.x != 42 E assert 42 != 42 E + where 42 = 42 - E + where 42 = .x + E + where 42 = .x failure_demo.py:202: AssertionError _______________________ TestMoreErrors.test_compare ________________________ - self = + self = def test_compare(self): > assert globf(10) < 5 @@ -532,7 +535,7 @@ failure_demo.py:205: AssertionError _____________________ TestMoreErrors.test_try_finally ______________________ - self = + self = def test_try_finally(self): x = 1 --- a/doc/example/simple.txt Mon Feb 07 11:39:05 2011 +0100 +++ b/doc/example/simple.txt Mon Feb 07 11:45:37 2011 +0100 @@ -138,7 +138,7 @@ E assert 4 < 4 test_compute.py:3: AssertionError - 1 failed, 4 passed in 0.02 seconds + 1 failed, 4 passed in 0.03 seconds As expected when running the full range of ``param1`` values we'll get an error on the last one. @@ -173,7 +173,7 @@ scheduling tests via LoadScheduling - ============================= in 0.31 seconds ============================= + ============================= in 0.29 seconds ============================= .. _`retrieved by hooks as item keywords`: @@ -219,7 +219,7 @@ test_module.py .s ========================= short test summary info ========================== - SKIP [1] /tmp/doc-exec-82/conftest.py:9: need --runslow option to run + SKIP [1] /tmp/doc-exec-171/conftest.py:9: need --runslow option to run =================== 1 passed, 1 skipped in 0.02 seconds ==================== --- a/doc/getting-started.txt Mon Feb 07 11:39:05 2011 +0100 +++ b/doc/getting-started.txt Mon Feb 07 11:45:37 2011 +0100 @@ -100,7 +100,7 @@ $ py.test -q test_sysexit.py collecting ... collected 1 items . - 1 passed in 0.00 seconds + 1 passed in 0.01 seconds .. todo:: For further ways to assert exceptions see the `raises` @@ -131,12 +131,13 @@ ================================= FAILURES ================================= ____________________________ TestClass.test_two ____________________________ - self = + self = def test_two(self): x = "hello" > assert hasattr(x, 'check') - E assert hasattr('hello', 'check') + E assert False + E + where False = hasattr('hello', 'check') test_class.py:8: AssertionError 1 failed, 1 passed in 0.02 seconds @@ -168,7 +169,7 @@ ================================= FAILURES ================================= _____________________________ test_needsfiles ______________________________ - tmpdir = local('/tmp/pytest-9/test_needsfiles0') + tmpdir = local('/tmp/pytest-101/test_needsfiles0') def test_needsfiles(tmpdir): print tmpdir @@ -177,8 +178,8 @@ test_tmpdir.py:3: AssertionError ----------------------------- Captured stdout ------------------------------ - /tmp/pytest-9/test_needsfiles0 - 1 failed in 0.02 seconds + /tmp/pytest-101/test_needsfiles0 + 1 failed in 0.03 seconds Before the test runs, a unique-per-test-invocation temporary directory was created. More info at :ref:`tmpdir handling`. --- a/doc/skipping.txt Mon Feb 07 11:39:05 2011 +0100 +++ b/doc/skipping.txt Mon Feb 07 11:45:37 2011 +0100 @@ -136,7 +136,7 @@ XFAIL xfail_demo.py::test_hello5 reason: reason - ======================== 5 xfailed in 0.05 seconds ========================= + ======================== 5 xfailed in 0.04 seconds ========================= imperative xfail from within a test or setup function ------------------------------------------------------ --- a/doc/tmpdir.txt Mon Feb 07 11:39:05 2011 +0100 +++ b/doc/tmpdir.txt Mon Feb 07 11:45:37 2011 +0100 @@ -36,7 +36,7 @@ ================================= FAILURES ================================= _____________________________ test_create_file _____________________________ - tmpdir = local('/tmp/pytest-10/test_create_file0') + tmpdir = local('/tmp/pytest-102/test_create_file0') def test_create_file(tmpdir): p = tmpdir.mkdir("sub").join("hello.txt") @@ -47,7 +47,7 @@ E assert 0 test_tmpdir.py:7: AssertionError - ========================= 1 failed in 0.02 seconds ========================= + ========================= 1 failed in 0.03 seconds ========================= .. _`base temporary directory`: --- a/doc/unittest.txt Mon Feb 07 11:39:05 2011 +0100 +++ b/doc/unittest.txt Mon Feb 07 11:45:37 2011 +0100 @@ -56,7 +56,7 @@ /usr/lib/python2.6/unittest.py:350: AssertionError ----------------------------- Captured stdout ------------------------------ hello - ========================= 1 failed in 0.02 seconds ========================= + ========================= 1 failed in 0.03 seconds ========================= .. _`unittest.py style`: http://docs.python.org/library/unittest.html http://bitbucket.org/hpk42/pytest/changeset/4e305504c13e/ changeset: r2154:4e305504c13e user: hpk42 date: 2011-02-07 11:45:47 summary: Added tag 2.0.1 for changeset e4497c2aed35 affected #: 1 file (47 bytes) --- a/.hgtags Mon Feb 07 11:45:37 2011 +0100 +++ b/.hgtags Mon Feb 07 11:45:47 2011 +0100 @@ -32,3 +32,4 @@ 79ef6377705184c55633d456832eea318fedcf61 1.3.4 90fffd35373e9f125af233f78b19416f0938d841 1.3.4 e9e127acd6f0497324ef7f40cfb997cad4c4cd17 2.0.0 +e4497c2aed358c1988cf7be83ca9394c3c707fa2 2.0.1 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. From commits-noreply at bitbucket.org Mon Feb 7 11:54:17 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Mon, 07 Feb 2011 10:54:17 -0000 Subject: [py-svn] commit/pytest: hpk42: up version, commit 2.0.1 annoucnement as sent out Message-ID: <20110207105417.17578.97375@bitbucket01.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/0447ba0ab8e3/ changeset: r2155:0447ba0ab8e3 user: hpk42 date: 2011-02-07 11:54:08 summary: up version, commit 2.0.1 annoucnement as sent out affected #: 4 files (280 bytes) --- a/doc/Makefile Mon Feb 07 11:45:47 2011 +0100 +++ b/doc/Makefile Mon Feb 07 11:54:08 2011 +0100 @@ -40,7 +40,7 @@ -rm -rf $(BUILDDIR)/* install: clean html - rsync -avz _build/html/ code:www-pytest/ + rsync -avz _build/html/ code:www-pytest/2.0.2dev html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html --- a/doc/announce/release-2.0.1.txt Mon Feb 07 11:45:47 2011 +0100 +++ b/doc/announce/release-2.0.1.txt Mon Feb 07 11:54:08 2011 +0100 @@ -1,19 +1,15 @@ py.test 2.0.1: bug fixes =========================================================================== -Welcome to pytest-2.0.1, a maintenance and bug fix release. For detailed -changes see below. pytest is a mature testing tool for Python, -supporting CPython 2.4-3.2, Jython and latest PyPy interpreters. See -docs here implementation. See docs with examples here: +Welcome to pytest-2.0.1, a maintenance and bug fix release of pytest, +a mature testing tool for Python, supporting CPython 2.4-3.2, Jython +and latest PyPy interpreters. See extensive docs with tested examples here: http://pytest.org/ -A note on packaging: pytest used to part of the "py" distribution up -until version py-1.3.4 but this has changed now: pytest-2.0.X only -contains py.test related code and is expected to be backward-compatible -to existing test code. If you want to install pytest, just type one of:: +If you want to install or upgrade pytest, just type one of:: - pip install -U pytest + pip install -U pytest # or easy_install -U pytest Many thanks to all issue reporters and people asking questions or @@ -23,7 +19,6 @@ best, holger krekel - Changes between 2.0.0 and 2.0.1 ---------------------------------------------- --- a/pytest.py Mon Feb 07 11:45:47 2011 +0100 +++ b/pytest.py Mon Feb 07 11:54:08 2011 +0100 @@ -1,7 +1,7 @@ """ unit and functional testing with Python. """ -__version__ = '2.0.1' +__version__ = '2.0.2.dev0' __all__ = ['main'] from _pytest.core import main, UsageError, _preloadplugins --- a/setup.py Mon Feb 07 11:45:47 2011 +0100 +++ b/setup.py Mon Feb 07 11:54:08 2011 +0100 @@ -22,7 +22,7 @@ name='pytest', description='py.test: simple powerful testing with Python', long_description = long_description, - version='2.0.1', + version='2.0.2.dev0', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], @@ -67,4 +67,4 @@ return {'console_scripts': l} if __name__ == '__main__': - main() + main() \ No newline at end of file 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. From commits-noreply at bitbucket.org Wed Feb 9 19:53:17 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Wed, 09 Feb 2011 18:53:17 -0000 Subject: [py-svn] commit/pytest: hpk42: some doc fixes and improvements to parametrized test examples, thanks ccxCZ for review and suggestions. Message-ID: <20110209185317.5725.11325@bitbucket03.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/48581fdf5bfc/ changeset: r2156:48581fdf5bfc user: hpk42 date: 2011-02-09 14:55:21 summary: some doc fixes and improvements to parametrized test examples, thanks ccxCZ for review and suggestions. affected #: 6 files (6.2 KB) --- a/_pytest/mark.py Mon Feb 07 11:54:08 2011 +0100 +++ b/_pytest/mark.py Wed Feb 09 14:55:21 2011 +0100 @@ -89,8 +89,8 @@ class MarkDecorator: """ A decorator for test functions and test classes. When applied it will create :class:`MarkInfo` objects which may be - :ref:`retrieved by hooks as item keywords` MarkDecorator instances - are usually created by writing:: + :ref:`retrieved by hooks as item keywords `. + MarkDecorator instances are often created like this:: mark1 = py.test.mark.NAME # simple MarkDecorator mark2 = py.test.mark.NAME(name1=value) # parametrized MarkDecorator --- a/_pytest/python.py Mon Feb 07 11:54:08 2011 +0100 +++ b/_pytest/python.py Wed Feb 09 14:55:21 2011 +0100 @@ -537,12 +537,10 @@ list of calls to the test function will be used. :arg param: will be exposed to a later funcarg factory invocation - through the ``request.param`` attribute. Setting it (instead of - directly providing a ``funcargs`` ditionary) is called - *indirect parametrization*. Indirect parametrization is - preferable if test values are expensive to setup or can - only be created after certain fixtures or test-run related - initialization code has been run. + through the ``request.param`` attribute. It allows to + defer test fixture setup activities to when an actual + test is run. Note that request.addcall() is called during + the collection phase of a test run. """ assert funcargs is None or isinstance(funcargs, dict) if id is None: @@ -556,7 +554,13 @@ self._calls.append(CallSpec(funcargs, id, param)) class FuncargRequest: - """ A request for function arguments from a test function. """ + """ A request for function arguments from a test function. + + Note that there is an optional ``param`` attribute in case + there was an invocation to metafunc.addcall(param=...). + If no such call was done in a ``pytest_generate_tests`` + hook, the attribute will not be present. + """ _argprefix = "pytest_funcarg__" _argname = None --- a/doc/example/index.txt Mon Feb 07 11:54:08 2011 +0100 +++ b/doc/example/index.txt Wed Feb 09 14:55:21 2011 +0100 @@ -12,7 +12,7 @@ reportingdemo.txt simple.txt - pythoncollection.txt mysetup.txt parametrize.txt + pythoncollection.txt nonpython.txt --- a/doc/example/parametrize.txt Mon Feb 07 11:54:08 2011 +0100 +++ b/doc/example/parametrize.txt Wed Feb 09 14:55:21 2011 +0100 @@ -1,3 +1,5 @@ + +.. _paramexamples: parametrizing tests ================================================= @@ -6,6 +8,137 @@ parametrization scheme for tests. Here we provide some examples for inspiration and re-use. +generating parameters combinations, depending on command line +---------------------------------------------------------------------------- + +.. regendoc:wipe + +Let's say we want to execute a test with different parameters +and the parameter range shall be determined by a command +line argument. Let's first write a simple computation test:: + + # content of test_compute.py + + def test_compute(param1): + assert param1 < 4 + +Now we add a test configuration like this:: + + # content of conftest.py + + def pytest_addoption(parser): + parser.addoption("--all", action="store_true", + help="run all combinations") + + def pytest_generate_tests(metafunc): + if 'param1' in metafunc.funcargnames: + if metafunc.config.option.all: + end = 5 + else: + end = 2 + for i in range(end): + metafunc.addcall(funcargs={'param1': i}) + +This means that we only run 2 tests if we do not pass ``--all``:: + + $ py.test -q test_compute.py + collecting ... collected 2 items + .. + 2 passed in 0.01 seconds + +We run only two computations, so we see two dots. +let's run the full monty:: + + $ py.test -q --all + collecting ... collected 5 items + ....F + ================================= FAILURES ================================= + _____________________________ test_compute[4] ______________________________ + + param1 = 4 + + def test_compute(param1): + > assert param1 < 4 + E assert 4 < 4 + + test_compute.py:3: AssertionError + 1 failed, 4 passed in 0.03 seconds + +As expected when running the full range of ``param1`` values +we'll get an error on the last one. + +Defering the setup of parametrizing resources +--------------------------------------------------- + +.. regendoc:wipe + +The parametrization of test functions happens at collection +time. It is often a good idea to setup possibly expensive +resources only when the actual test is run. Here is a simple +example how you can achieve that:: + + # content of test_backends.py + + import pytest + def test_db_initialized(db): + # a dummy test + if db.__class__.__name__ == "DB2": + pytest.fail("deliberately failing for demo purposes") + +Now we add a test configuration that takes care to generate +two invocations of the ``test_db_initialized`` function and +furthermore a factory that creates a database object when +each test is actually run:: + + # content of conftest.py + + def pytest_generate_tests(metafunc): + if 'db' in metafunc.funcargnames: + metafunc.addcall(param="d1") + metafunc.addcall(param="d2") + + class DB1: + "one database object" + class DB2: + "alternative database object" + + def pytest_funcarg__db(request): + if request.param == "d1": + return DB1() + elif request.param == "d2": + return DB2() + else: + raise ValueError("invalid internal test config") + +Let's first see how it looks like at collection time:: + + $ py.test test_backends.py --collectonly + + + + +And then when we run the test:: + + $ py.test -q test_backends.py + collecting ... collected 2 items + .F + ================================= FAILURES ================================= + __________________________ test_db_initialized[1] __________________________ + + db = + + def test_db_initialized(db): + # a dummy test + if db.__class__.__name__ == "DB2": + > pytest.fail("deliberately failing for demo purposes") + E Failed: deliberately failing for demo purposes + + test_backends.py:6: Failed + 1 failed, 1 passed in 0.02 seconds + +Now you see that one invocation of the test passes and another fails, +as it to be expected. + Parametrizing test methods through per-class configuration -------------------------------------------------------------- @@ -41,12 +174,23 @@ the respective settings:: $ py.test -q - collecting ... collected 4 items - F..F + collecting ... collected 6 items + .FF..F ================================= FAILURES ================================= + __________________________ test_db_initialized[1] __________________________ + + db = + + def test_db_initialized(db): + # a dummy test + if db.__class__.__name__ == "DB2": + > pytest.fail("deliberately failing for demo purposes") + E Failed: deliberately failing for demo purposes + + test_backends.py:6: Failed _________________________ TestClass.test_equals[0] _________________________ - self = , a = 1, b = 2 + self = , a = 1, b = 2 def test_equals(self, a, b): > assert a == b @@ -55,14 +199,14 @@ test_parametrize.py:17: AssertionError ______________________ TestClass.test_zerodivision[1] ______________________ - self = , a = 3, b = 2 + self = , a = 3, b = 2 def test_zerodivision(self, a, b): > pytest.raises(ZeroDivisionError, "a/b") E Failed: DID NOT RAISE test_parametrize.py:20: Failed - 2 failed, 2 passed in 0.03 seconds + 3 failed, 3 passed in 0.04 seconds Parametrizing test methods through a decorator -------------------------------------------------------------- @@ -103,7 +247,7 @@ ================================= FAILURES ================================= _________________________ TestClass.test_equals[0] _________________________ - self = , a = 1, b = 2 + self = , a = 1, b = 2 @params([dict(a=1, b=2), dict(a=3, b=3), ]) def test_equals(self, a, b): @@ -113,7 +257,7 @@ test_parametrize2.py:19: AssertionError ______________________ TestClass.test_zerodivision[1] ______________________ - self = , a = 3, b = 2 + self = , a = 3, b = 2 @params([dict(a=1, b=0), dict(a=3, b=2)]) def test_zerodivision(self, a, b): @@ -142,4 +286,4 @@ . $ py.test -q multipython.py collecting ... collected 75 items ....s....s....s....ssssss....s....s....s....ssssss....s....s....s....ssssss - 48 passed, 27 skipped in 2.09 seconds + 48 passed, 27 skipped in 1.59 seconds --- a/doc/example/simple.txt Mon Feb 07 11:54:08 2011 +0100 +++ b/doc/example/simple.txt Wed Feb 09 14:55:21 2011 +0100 @@ -84,64 +84,6 @@ next example or refer to :ref:`mysetup` for more information on real-life examples. -generating parameters combinations, depending on command line ----------------------------------------------------------------------------- - -.. regendoc:wipe - -Let's say we want to execute a test with different parameters -and the parameter range shall be determined by a command -line argument. Let's first write a simple computation test:: - - # content of test_compute.py - - def test_compute(param1): - assert param1 < 4 - -Now we add a test configuration like this:: - - # content of conftest.py - - def pytest_addoption(parser): - parser.addoption("--all", action="store_true", - help="run all combinations") - - def pytest_generate_tests(metafunc): - if 'param1' in metafunc.funcargnames: - if metafunc.config.option.all: - end = 5 - else: - end = 2 - for i in range(end): - metafunc.addcall(funcargs={'param1': i}) - -This means that we only run 2 tests if we do not pass ``--all``:: - - $ py.test -q test_compute.py - collecting ... collected 2 items - .. - 2 passed in 0.01 seconds - -We run only two computations, so we see two dots. -let's run the full monty:: - - $ py.test -q --all - collecting ... collected 5 items - ....F - ================================= FAILURES ================================= - _____________________________ test_compute[4] ______________________________ - - param1 = 4 - - def test_compute(param1): - > assert param1 < 4 - E assert 4 < 4 - - test_compute.py:3: AssertionError - 1 failed, 4 passed in 0.03 seconds - -As expected when running the full range of ``param1`` values -we'll get an error on the last one. dynamically adding command line options -------------------------------------------------------------- @@ -167,15 +109,15 @@ $ py.test =========================== test session starts ============================ - platform linux2 -- Python 2.6.6 -- pytest-2.0.1 + platform linux2 -- Python 2.6.6 -- pytest-2.0.2.dev0 gw0 I / gw1 I / gw2 I / gw3 I gw0 [0] / gw1 [0] / gw2 [0] / gw3 [0] scheduling tests via LoadScheduling - ============================= in 0.29 seconds ============================= + ============================= in 0.37 seconds ============================= -.. _`retrieved by hooks as item keywords`: +.. _`excontrolskip`: control skipping of tests according to command line option -------------------------------------------------------------- @@ -214,12 +156,12 @@ $ py.test -rs # "-rs" means report details on the little 's' =========================== test session starts ============================ - platform linux2 -- Python 2.6.6 -- pytest-2.0.1 + platform linux2 -- Python 2.6.6 -- pytest-2.0.2.dev0 collecting ... collected 2 items test_module.py .s ========================= short test summary info ========================== - SKIP [1] /tmp/doc-exec-171/conftest.py:9: need --runslow option to run + SKIP [1] /tmp/doc-exec-275/conftest.py:9: need --runslow option to run =================== 1 passed, 1 skipped in 0.02 seconds ==================== @@ -227,7 +169,7 @@ $ py.test --runslow =========================== test session starts ============================ - platform linux2 -- Python 2.6.6 -- pytest-2.0.1 + platform linux2 -- Python 2.6.6 -- pytest-2.0.2.dev0 collecting ... collected 2 items test_module.py .. @@ -319,7 +261,7 @@ $ py.test =========================== test session starts ============================ - platform linux2 -- Python 2.6.6 -- pytest-2.0.1 + platform linux2 -- Python 2.6.6 -- pytest-2.0.2.dev0 project deps: mylib-1.1 collecting ... collected 0 items @@ -342,7 +284,7 @@ $ py.test -v =========================== test session starts ============================ - platform linux2 -- Python 2.6.6 -- pytest-2.0.1 -- /home/hpk/venv/0/bin/python + platform linux2 -- Python 2.6.6 -- pytest-2.0.2.dev0 -- /home/hpk/venv/0/bin/python info1: did you know that ... did you? collecting ... collected 0 items @@ -353,7 +295,7 @@ $ py.test =========================== test session starts ============================ - platform linux2 -- Python 2.6.6 -- pytest-2.0.1 + platform linux2 -- Python 2.6.6 -- pytest-2.0.2.dev0 collecting ... collected 0 items ============================= in 0.00 seconds ============================= --- a/doc/funcargs.txt Mon Feb 07 11:54:08 2011 +0100 +++ b/doc/funcargs.txt Wed Feb 09 14:55:21 2011 +0100 @@ -28,6 +28,8 @@ or with multiple numerical arguments sets and want to reuse the same set of test functions. +.. _funcarg: + Basic funcarg example ----------------------- @@ -196,6 +198,8 @@ ======================== 9 tests deselected by '7' ========================= ================== 1 passed, 9 deselected in 0.01 seconds ================== +You might want to look at :ref:`more parametrization examples `. + .. _`metafunc object`: The **metafunc** object 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. From commits-noreply at bitbucket.org Mon Feb 14 18:49:35 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Mon, 14 Feb 2011 17:49:35 -0000 Subject: [py-svn] commit/pytest: hpk42: fix typo, thanks antocuni Message-ID: <20110214174935.17321.12326@bitbucket01.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/7edf8ece114d/ changeset: r2157:7edf8ece114d user: hpk42 date: 2011-02-14 18:49:16 summary: fix typo, thanks antocuni affected #: 1 file (12 bytes) --- a/doc/conf.py Wed Feb 09 14:55:21 2011 +0100 +++ b/doc/conf.py Mon Feb 14 18:49:16 2011 +0100 @@ -42,7 +42,7 @@ # General information about the project. project = u'pytest' -copyright = u'2010, holger krekel et aliter' +copyright = u'2011, holger krekel et alii' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -185,7 +185,7 @@ # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'pytest.tex', u'pytest Documentation', - u'holger krekel et aliter', 'manual'), + u'holger krekel et alii', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -218,7 +218,7 @@ # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'pytest', u'pytest Documentation', - [u'holger krekel et aliter'], 1) + [u'holger krekel et alii'], 1) ] @@ -226,9 +226,9 @@ # Bibliographic Dublin Core info. epub_title = u'pytest' -epub_author = u'holger krekel et aliter' -epub_publisher = u'holger krekel et aliter' -epub_copyright = u'2010, holger krekel et aliter' +epub_author = u'holger krekel et alii' +epub_publisher = u'holger krekel et alii' +epub_copyright = u'2010, holger krekel et alii' # The language of the text. It defaults to the language option # or en if the language is not set. 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. From commits-noreply at bitbucket.org Tue Feb 15 13:52:57 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Tue, 15 Feb 2011 12:52:57 -0000 Subject: [py-svn] commit/py: 3 new changesets Message-ID: <20110215125257.1325.49362@bitbucket01.managed.contegix.com> 3 new changesets in py: http://bitbucket.org/hpk42/py/changeset/1f3125cba797/ changeset: r2005:1f3125cba797 user: hpk42 date: 2011-02-07 11:27:20 summary: finalize 1.4.1 affected #: 2 files (1.8 KB) --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/announce/release-1.4.1.txt Mon Feb 07 11:27:20 2011 +0100 @@ -0,0 +1,47 @@ + +.. _`release-1.4.1`: + +py-1.4.1: cross-python lib for fs path, code, io, ... manipulations +=========================================================================== + +This is a bug fix release of the "py" lib, see below for detailed changes. +The py lib is a small library comprising APIs for filesystem and svn path +manipulations, dynamic code construction and introspection, a Py2/Py3 +compatibility namespace ("py.builtin"), IO capturing, terminal colored printing +(on windows and linux), ini-file parsing and a lazy import mechanism. +It runs unmodified on all Python interpreters compatible to Python2.4 up +until Python 3.2, PyPy and Jython. The general goal with "py" is to +provide stable APIs for some common tasks that are continously tested +against many Python interpreters and thus also to help transition. Here +are some docs: + + http://pylib.org + +NOTE: The prior py-1.3.X versions contained "py.test" which since py-1.4.0 +comes as its own separate "pytest" distribution, see: + + http://pytest.org + +Also, the "py.cleanup|py.lookup|py.countloc" helpers are now part of +the pycmd distribution, see http://pypi.python.org/pypi/pycmd + + +Changes between 1.4.0 and 1.4.1 +================================================== + +- fix issue1 - py.error.* classes to be pickleable + +- fix issue2 - on windows32 use PATHEXT as the list of potential + extensions to find find binaries with py.path.local.sysfind(commandname) + +- fix (pytest-) issue10 and refine assertion reinterpretation + to avoid breaking if the __nonzero__ of an object fails + +- fix (pytest-) issue17 where python3 does not like star-imports, + leading to misrepresentation of import-errors in test modules + +- fix ``py.error.*`` attribute pypy access + +- allow path.samefile(arg) to succeed when arg is a relative filename + +- fix (pytest-) issue20 path.samefile(relpath) works as expected now --- a/doc/index.txt Thu Feb 03 16:56:33 2011 +0100 +++ b/doc/index.txt Mon Feb 07 11:27:20 2011 +0100 @@ -6,7 +6,7 @@ Welcome to py's documentation! ================================= -:ref:`1.4.0 release announcement ` and :ref:`CHANGELOG ` +:ref:`1.4.1 release announcement ` and :ref:`CHANGELOG ` .. note:: http://bitbucket.org/hpk42/py/changeset/20e2ce010a65/ changeset: r2006:20e2ce010a65 user: hpk42 date: 2011-02-07 11:27:23 summary: Added tag 1.4.1 for changeset 1f3125cba797 affected #: 1 file (47 bytes) --- a/.hgtags Mon Feb 07 11:27:20 2011 +0100 +++ b/.hgtags Mon Feb 07 11:27:23 2011 +0100 @@ -32,3 +32,4 @@ 79ef6377705184c55633d456832eea318fedcf61 1.3.4 90fffd35373e9f125af233f78b19416f0938d841 1.3.4 5346ab41b059c95a48cbe1e8a7bae96ce6e0da27 1.4.0 +1f3125cba7976538952be268f107c1d0c36c5ce8 1.4.1 http://bitbucket.org/hpk42/py/changeset/0f5a580bf1ff/ changeset: r2007:0f5a580bf1ff user: hpk42 date: 2011-02-15 13:50:54 summary: fix issue23 (reported on pytest issue tracker) by catching NotImplementedError which is apparently raised on some windows machines affected #: 4 files (350 bytes) --- a/py/__init__.py Mon Feb 07 11:27:23 2011 +0100 +++ b/py/__init__.py Tue Feb 15 13:50:54 2011 +0100 @@ -8,7 +8,7 @@ (c) Holger Krekel and others, 2004-2010 """ -__version__ = '1.4.1' +__version__ = '1.4.2.dev0' from py import _apipkg --- a/py/_path/local.py Mon Feb 07 11:27:23 2011 +0100 +++ b/py/_path/local.py Tue Feb 15 13:50:54 2011 +0100 @@ -749,7 +749,7 @@ pass try: os.symlink(src, dest) - except (OSError, AttributeError): # AttributeError on win32 + except (OSError, AttributeError, NotImplementedError): pass return udir --- a/setup.py Mon Feb 07 11:27:23 2011 +0100 +++ b/setup.py Tue Feb 15 13:50:54 2011 +0100 @@ -9,7 +9,7 @@ name='py', description='library with cross-python path, ini-parsing, io, code, log facilities', long_description = open('README.txt').read(), - version='1.4.1', + version='1.4.2.dev0', url='http://pylib.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], @@ -37,4 +37,4 @@ ) if __name__ == '__main__': - main() \ No newline at end of file + main() --- a/testing/path/test_local.py Mon Feb 07 11:27:23 2011 +0100 +++ b/testing/path/test_local.py Tue Feb 15 13:50:54 2011 +0100 @@ -280,6 +280,14 @@ if i>=3: assert not numdir.new(ext=str(i-3)).check() + def test_make_numbered_dir_NotImplemented_Error(self, tmpdir, monkeypatch): + def notimpl(x, y): + raise NotImplementedError(42) + monkeypatch.setattr(py.std.os, 'symlink', notimpl) + x = tmpdir.make_numbered_dir(rootdir=tmpdir, lock_timeout=0) + assert x.relto(tmpdir) + assert x.check() + def test_locked_make_numbered_dir(self, tmpdir): for i in range(10): numdir = local.make_numbered_dir(prefix='base2.', rootdir=tmpdir, Repository URL: https://bitbucket.org/hpk42/py/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Wed Feb 16 00:24:55 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Tue, 15 Feb 2011 23:24:55 -0000 Subject: [py-svn] commit/pytest: flub: Fix pytest_assertrepr_compare on python3 (issue24) Message-ID: <20110215232455.1328.35949@bitbucket01.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/340ee1b66e17/ changeset: r2158:340ee1b66e17 user: flub date: 2011-02-16 00:24:18 summary: Fix pytest_assertrepr_compare on python3 (issue24) The maxsize argument must be an integer and the devision syntax changed between python2 and python3. affected #: 3 files (300 bytes) --- a/CHANGELOG Mon Feb 14 18:49:16 2011 +0100 +++ b/CHANGELOG Tue Feb 15 23:24:18 2011 +0000 @@ -1,3 +1,9 @@ +Changes between 2.0.1 and 2.0.2 +---------------------------------------------- + +- fix issue24 - pytest_assertrepr_compare produces an in-line + exception on python3 + Changes between 2.0.0 and 2.0.1 ---------------------------------------------- --- a/_pytest/assertion.py Mon Feb 14 18:49:16 2011 +0100 +++ b/_pytest/assertion.py Tue Feb 15 23:24:18 2011 +0000 @@ -12,7 +12,7 @@ help="disable python assert expression reinterpretation."), def pytest_configure(config): - # The _pytesthook attribute on the AssertionError is used by + # The _reprcompare attribute on the py.code module is used by # py._code._assertionnew to detect this plugin was loaded and in # turn call the hooks defined here as part of the # DebugInterpreter. @@ -51,7 +51,7 @@ def pytest_assertrepr_compare(op, left, right): """return specialised explanations for some operators/operands""" width = 80 - 15 - len(op) - 2 # 15 chars indentation, 1 space around op - left_repr = py.io.saferepr(left, maxsize=width/2) + left_repr = py.io.saferepr(left, maxsize=int(width/2)) right_repr = py.io.saferepr(right, maxsize=width-len(left_repr)) summary = '%s %s %s' % (left_repr, op, right_repr) --- a/testing/test_assertion.py Mon Feb 14 18:49:16 2011 +0100 +++ b/testing/test_assertion.py Tue Feb 15 23:24:18 2011 +0000 @@ -114,6 +114,10 @@ expl = callequal(A(), '') assert not expl + def test_repr_no_exc(self): + expl = ' '.join(callequal('foo', 'bar')) + assert 'raised in repr()' not in expl + def test_reprcompare_notin(): detail = plugin.pytest_assertrepr_compare('not in', 'foo', 'aaafoobbb')[1:] assert detail == ["'foo' is contained here:", ' aaafoobbb', '? +++'] 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. From commits-noreply at bitbucket.org Thu Feb 17 14:47:44 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Thu, 17 Feb 2011 13:47:44 -0000 Subject: [py-svn] commit/pytest: hpk42: doc typo fixes from Victor Garcia, thanks! Message-ID: <20110217134744.6191.14442@bitbucket01.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/29d58eeb5cd9/ changeset: r2159:29d58eeb5cd9 user: hpk42 date: 2011-02-17 14:46:40 summary: doc typo fixes from Victor Garcia, thanks! affected #: 21 files (74 bytes) --- a/CHANGELOG Tue Feb 15 23:24:18 2011 +0000 +++ b/CHANGELOG Thu Feb 17 14:46:40 2011 +0100 @@ -4,6 +4,8 @@ - fix issue24 - pytest_assertrepr_compare produces an in-line exception on python3 +- fixed some typos in the docs (thanks Victor) + Changes between 2.0.0 and 2.0.1 ---------------------------------------------- --- a/doc/announce/release-2.0.0.txt Tue Feb 15 23:24:18 2011 +0000 +++ b/doc/announce/release-2.0.0.txt Thu Feb 17 14:46:40 2011 +0100 @@ -117,7 +117,7 @@ - py.test.collect.Directory does not exist anymore and it is not possible to provide an own "Directory" object. If you have used this and don't know what to do, get - in contact. We'll figure someting out. + in contact. We'll figure something out. Note that pytest_collect_directory() is still called but any return value will be ignored. This allows to keep --- a/doc/announce/release-2.0.1.txt Tue Feb 15 23:24:18 2011 +0000 +++ b/doc/announce/release-2.0.1.txt Thu Feb 17 14:46:40 2011 +0100 @@ -63,5 +63,5 @@ collection-before-running semantics were not setup as with pytest 1.3.4. Note, however, that the recommended and much cleaner way to do test - parametraization remains the "pytest_generate_tests" + parametrization remains the "pytest_generate_tests" mechanism, see the docs. --- a/doc/assert.txt Tue Feb 15 23:24:18 2011 +0000 +++ b/doc/assert.txt Thu Feb 17 14:46:40 2011 +0100 @@ -91,7 +91,7 @@ .. versionadded:: 2.0 -py.test has rich support for providing context-sensitive informations +py.test has rich support for providing context-sensitive information when it encounters comparisons. For example:: # content of test_assert2.py --- a/doc/customize.txt Tue Feb 15 23:24:18 2011 +0000 +++ b/doc/customize.txt Thu Feb 17 14:46:40 2011 +0100 @@ -58,7 +58,7 @@ [pytest] addopts = -rsxX -q -From now on, running ``py.test`` will implicitely add +From now on, running ``py.test`` will implicitly add the specified options. builtin configuration file options --- a/doc/example/attic.txt Tue Feb 15 23:24:18 2011 +0000 +++ b/doc/example/attic.txt Thu Feb 17 14:46:40 2011 +0100 @@ -48,7 +48,7 @@ example: decorating a funcarg in a test module -------------------------------------------------------------- -For larger scale setups it's sometimes useful to decorare +For larger scale setups it's sometimes useful to decorate a funcarg just for a particular test module. We can extend the `accept example`_ by putting this in our test module: --- a/doc/example/parametrize.txt Tue Feb 15 23:24:18 2011 +0000 +++ b/doc/example/parametrize.txt Thu Feb 17 14:46:40 2011 +0100 @@ -67,7 +67,7 @@ As expected when running the full range of ``param1`` values we'll get an error on the last one. -Defering the setup of parametrizing resources +Deferring the setup of parametrizing resources --------------------------------------------------- .. regendoc:wipe @@ -271,7 +271,7 @@ -------------------------------------------------------------- Here is a stripped down real-life example of using parametrized -testing for testing serialization betwee different interpreters. +testing for testing serialization between different interpreters. We define a ``test_basic_objects`` function which is to be run with different sets of arguments for its three arguments:: --- a/doc/faq.txt Tue Feb 15 23:24:18 2011 +0000 +++ b/doc/faq.txt Thu Feb 17 14:46:40 2011 +0100 @@ -13,7 +13,7 @@ ++++++++++++++++++++++++++++++++++++++++++++++++++ Some historic, some practical reasons: ``py.test`` used to be part of -the ``py`` package which provided several developer utitilities, +the ``py`` package which provided several developer utilities, all starting with ``py.``, providing nice TAB-completion. If you install ``pip install pycmd`` you get these tools from a separate package. These days the command line tool could be called ``pytest`` @@ -53,7 +53,7 @@ to show intermediate values if a test fails. If your expression has side effects the intermediate values may not be the same, obfuscating the initial error (this is also explained at the command line if it happens). -``py.test --no-assert`` turns off assert re-intepretation. +``py.test --no-assert`` turns off assert re-interpretation. Sidenote: it is good practise to avoid asserts with side effects. .. _`py namespaces`: index.html @@ -125,8 +125,8 @@ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ On windows the multiprocess package will instantiate sub processes -by pickling and thus implicitely re-import a lot of local modules. -Unfortuantely, setuptools-0.6.11 does not ``if __name__=='__main__'`` +by pickling and thus implicitly re-import a lot of local modules. +Unfortunately, setuptools-0.6.11 does not ``if __name__=='__main__'`` protect its generated command line script. This leads to infinite recursion when running a test that instantiates Processes. --- a/doc/goodpractises.txt Tue Feb 15 23:24:18 2011 +0000 +++ b/doc/goodpractises.txt Thu Feb 17 14:46:40 2011 +0100 @@ -14,20 +14,20 @@ environment. A good tool to help you automate test runs against multiple dependency configurations or Python interpreters is `tox`_, independently created by the main py.test author. The latter -is also useful for integration with the continous integration +is also useful for integration with the continuous integration server Hudson_. .. _`virtualenv`: http://pypi.python.org/pypi/virtualenv .. _`buildout`: http://www.buildout.org/ .. _pip: http://pypi.python.org/pypi/pip -Use tox and Continous Integration servers +Use tox and Continuous Integration servers ------------------------------------------------- If you are (often) releasing code to the public you may want to look into `tox`_, the virtualenv test automation tool and its `pytest support `_. -The basic idea is to generate a JUnitXML file through the ``--junitxml=PATH`` option and have a continous integration server like Hudson_ pick it up. +The basic idea is to generate a JUnitXML file through the ``--junitxml=PATH`` option and have a continuous integration server like Hudson_ pick it up. .. _standalone: .. _`genscript method`: --- a/doc/index.txt Tue Feb 15 23:24:18 2011 +0000 +++ b/doc/index.txt Thu Feb 17 14:46:40 2011 +0100 @@ -7,7 +7,7 @@ - **a mature fully featured testing tool** - runs on Posix/Windows, Python 2.4-3.2, PyPy and Jython - - continously `tested on many Python interpreters `_ + - continuously `tested on many Python interpreters `_ - used in :ref:`many projects and organisations `, ranging from 10 to 10000 tests - has :ref:`comprehensive documentation ` - comes with :ref:`tested examples ` @@ -27,7 +27,7 @@ - advanced :ref:`skip and xfail` - generic :ref:`marking and test selection ` - can :ref:`distribute tests to multiple CPUs ` through :ref:`xdist plugin ` - - can :ref:`continously re-run failing tests ` + - can :ref:`continuously re-run failing tests ` - many :ref:`builtin helpers ` - flexible :ref:`Python test discovery` - unique :ref:`dependency injection through funcargs ` @@ -40,7 +40,7 @@ - supports extended :ref:`xUnit style setup ` - supports domain-specific :ref:`non-python tests` - supports generating testing coverage reports - - `Javasript unit- and functional testing`_ + - `Javascript unit- and functional testing`_ - **extensive plugin and customization system** @@ -48,7 +48,7 @@ - customizations can be per-directory, per-project or per PyPI released plugins - it is easy to add command line options or do other kind of add-ons and customizations. -.. _`Javasript unit- and functional testing`: http://pypi.python.org/pypi/oejskit +.. _`Javascript unit- and functional testing`: http://pypi.python.org/pypi/oejskit .. _`easy`: http://bruynooghe.blogspot.com/2009/12/skipping-slow-test-by-default-in-pytest.html --- a/doc/plugins.txt Tue Feb 15 23:24:18 2011 +0000 +++ b/doc/plugins.txt Thu Feb 17 14:46:40 2011 +0100 @@ -47,7 +47,7 @@ .. Note:: If you have ``conftest.py`` files which do not reside in a python package directory (i.e. one containing an ``__init__.py``) then - "import conftest" can be ambigous because there might be other + "import conftest" can be ambiguous because there might be other ``conftest.py`` files as well on your PYTHONPATH or ``sys.path``. It is thus good practise for projects to either put ``conftest.py`` under a package scope or to never import anything from a @@ -79,7 +79,7 @@ coverage reporting, compatible with distributed testing * `pytest-pep8 `_: - a ``--pep8`` option to enable PEP8 compliancy checking. + a ``--pep8`` option to enable PEP8 compliance checking. * `oejskit `_: a plugin to run javascript unittests in life browsers --- a/doc/skipping.txt Tue Feb 15 23:24:18 2011 +0000 +++ b/doc/skipping.txt Thu Feb 17 14:46:40 2011 +0100 @@ -147,7 +147,7 @@ def test_function(): if not valid_config(): - pytest.xfail("unsuppored configuration") + pytest.xfail("unsupported configuration") skipping on a missing import dependency @@ -159,7 +159,7 @@ docutils = pytest.importorskip("docutils") If ``docutils`` cannot be imported here, this will lead to a -skip outcome of the test. You can also skip dependeing if +skip outcome of the test. You can also skip depending if if a library does not come with a high enough version:: docutils = pytest.importorskip("docutils", minversion="0.3") @@ -175,5 +175,5 @@ def test_function(): if not valid_config(): - pytest.skip("unsuppored configuration") + pytest.skip("unsupported configuration") --- a/doc/talks.txt Tue Feb 15 23:24:18 2011 +0000 +++ b/doc/talks.txt Thu Feb 17 14:46:40 2011 +0100 @@ -30,7 +30,7 @@ distributed testing: -- `simultanously test your code on all platforms`_ (blog entry) +- `simultaneously test your code on all platforms`_ (blog entry) plugin specific examples: @@ -42,7 +42,7 @@ .. _`many examples in the docs for plugins`: plugin/index.html .. _`monkeypatch plugin`: plugin/monkeypatch.html .. _`application setup in test functions with funcargs`: funcargs.html#appsetup -.. _`simultanously test your code on all platforms`: http://tetamap.wordpress.com/2009/03/23/new-simultanously-test-your-code-on-all-platforms/ +.. _`simultaneously test your code on all platforms`: http://tetamap.wordpress.com/2009/03/23/new-simultanously-test-your-code-on-all-platforms/ .. _`monkey patching done right`: http://tetamap.wordpress.com/2009/03/03/monkeypatching-in-unit-tests-done-right/ .. _`putting test-hooks into local or global plugins`: http://tetamap.wordpress.com/2009/05/14/putting-test-hooks-into-local-and-global-plugins/ .. _`parametrizing tests, generalized`: http://tetamap.wordpress.com/2009/05/13/parametrizing-python-tests-generalized/ --- a/doc/test/index.txt Tue Feb 15 23:24:18 2011 +0000 +++ b/doc/test/index.txt Thu Feb 17 14:46:40 2011 +0100 @@ -17,7 +17,7 @@ changelog_: history of changes covering last releases -**Continous Integration of py.test's own tests and plugins with Hudson**: +**Continuous Integration of py.test's own tests and plugins with Hudson**: `http://hudson.testrun.org/view/pytest`_ --- a/doc/test/mission.txt Tue Feb 15 23:24:18 2011 +0000 +++ b/doc/test/mission.txt Thu Feb 17 14:46:40 2011 +0100 @@ -5,7 +5,7 @@ py.test strives to make testing a fun and no-boilerplate effort. The tool is distributed as part of the `py` package which contains supporting APIs that -are also useable independently. The project independent ``py.test`` command line tool helps you to: +are also usable independently. The project independent ``py.test`` command line tool helps you to: * rapidly collect and run tests * run unit- or doctests, functional or integration tests --- a/doc/test/plugin/cov.txt Tue Feb 15 23:24:18 2011 +0000 +++ b/doc/test/plugin/cov.txt Thu Feb 17 14:46:40 2011 +0100 @@ -202,7 +202,7 @@ started. -Acknowledgements +Acknowledgments ---------------- Holger Krekel for pytest with its distributed testing support. --- a/doc/test/plugin/oejskit.txt Tue Feb 15 23:24:18 2011 +0000 +++ b/doc/test/plugin/oejskit.txt Thu Feb 17 14:46:40 2011 +0100 @@ -1,7 +1,7 @@ pytest_oejskit plugin (EXTERNAL) ========================================== -The `oejskit`_ offers a py.test plugin for running Javascript tests in life browers. Running inside the browsers comes with some speed cost, on the other hand it means for example the code is tested against the real-word DOM implementations. +The `oejskit`_ offers a py.test plugin for running Javascript tests in life browsers. Running inside the browsers comes with some speed cost, on the other hand it means for example the code is tested against the real-word DOM implementations. The approach enables to write integration tests such that the JavaScript code is tested against server-side Python code mocked as necessary. Any server-side framework that can already be exposed through WSGI (or for which a subset of WSGI can be written to accommodate the jskit own needs) can play along. For more info and download please visit the `oejskit PyPI`_ page. --- a/doc/test/plugin/xdist.txt Tue Feb 15 23:24:18 2011 +0000 +++ b/doc/test/plugin/xdist.txt Thu Feb 17 14:46:40 2011 +0100 @@ -129,7 +129,7 @@ option_tx = ['ssh=myhost//python=python2.5', 'popen//python=python2.5'] option_dist = True -Any commandline ``--tx`` specifictions will add to the list of +Any commandline ``--tx`` specifications will add to the list of available execution environments. Specifying "rsync" dirs in a conftest.py --- a/doc/tmpdir.txt Tue Feb 15 23:24:18 2011 +0000 +++ b/doc/tmpdir.txt Thu Feb 17 14:46:40 2011 +0100 @@ -56,7 +56,7 @@ Temporary directories are by default created as sub directories of the system temporary directory. The base name will be ``pytest-NUM`` where -``NUM`` will be incremenated with each test run. Moreover, entries older +``NUM`` will be incremented with each test run. Moreover, entries older than 3 temporary directories will be removed. You can override the default temporary directory setting like this:: --- a/doc/usage.txt Tue Feb 15 23:24:18 2011 +0000 +++ b/doc/usage.txt Thu Feb 17 14:46:40 2011 +0100 @@ -101,7 +101,7 @@ creating JUnitXML format files ---------------------------------------------------- -To create result files which can be read by Hudson_ or other Continous +To create result files which can be read by Hudson_ or other Continuous integration servers, use this invocation:: py.test --junitxml=path --- a/doc/xdist.txt Tue Feb 15 23:24:18 2011 +0000 +++ b/doc/xdist.txt Thu Feb 17 14:46:40 2011 +0100 @@ -36,7 +36,7 @@ pip install pytest-xdist -or use the package in develope/in-place mode with +or use the package in develop/in-place mode with a checkout of the `pytest-xdist repository`_ :: python setup.py develop @@ -157,7 +157,7 @@ Specifying test exec environments in an ini file +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -pytest (since version 2.0) supports ini-style cofiguration. +pytest (since version 2.0) supports ini-style configuration. You can for example make running with three subprocesses your default like this:: 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. From commits-noreply at bitbucket.org Sat Feb 19 00:39:51 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Fri, 18 Feb 2011 23:39:51 -0000 Subject: [py-svn] commit/pytest: Brianna Laugher: Fix mistakes in monkeypatch doc example Message-ID: <20110218233951.30478.86841@bitbucket02.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/1d393679919d/ changeset: r2160:1d393679919d user: Brianna Laugher date: 2011-02-18 06:52:18 summary: Fix mistakes in monkeypatch doc example affected #: 1 file (10 bytes) --- a/doc/monkeypatch.txt Thu Feb 17 14:46:40 2011 +0100 +++ b/doc/monkeypatch.txt Fri Feb 18 16:52:18 2011 +1100 @@ -24,14 +24,14 @@ import os.path def getssh(): # pseudo application code - return os.path.join(os.expanduser("~admin"), '.ssh') + return os.path.join(os.path.expanduser("~admin"), '.ssh') def test_mytest(monkeypatch): def mockreturn(path): return '/abc' monkeypatch.setattr(os.path, 'expanduser', mockreturn) x = getssh() - assert x == '/abc' + assert x == '/abc/.ssh' After the test function finishes the ``os.path.expanduser`` modification will be undone. 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. From commits-noreply at bitbucket.org Sat Feb 26 15:03:40 2011 From: commits-noreply at bitbucket.org (Bitbucket) Date: Sat, 26 Feb 2011 14:03:40 -0000 Subject: [py-svn] commit/pytest: hpk42: add "issues" to layout of web page Message-ID: <20110226140340.15199.46783@bitbucket01.managed.contegix.com> 1 new changeset in pytest: http://bitbucket.org/hpk42/pytest/changeset/411fc17bac9a/ changeset: r2161:411fc17bac9a user: hpk42 date: 2011-02-16 00:32:57 summary: add "issues" to layout of web page affected #: 1 file (112 bytes) --- a/doc/_templates/layout.html Fri Feb 18 16:52:18 2011 +1100 +++ b/doc/_templates/layout.html Wed Feb 16 00:32:57 2011 +0100 @@ -19,6 +19,7 @@ install |  examples |  customize |  + issuescontact  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.