1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/a5240a6c897a/ Changeset: a5240a6c897a User: hpk42 Date: 2013-08-01 17:32:19 Summary: add changelog entry for anthon's hynek-fication of options, and change the docs and tests to use the new style. Affected #: 19 files
diff -r e12f3f5b03ce7a92a06b9e4837a0c3bfa15294e1 -r a5240a6c897a70ff55dc91d05e3f756af2004881 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,12 @@ Changes between 2.3.5 and 2.4.DEV ----------------------------------- +- change to use hyphen-separated long options but keep the old spelling + backward compatible. py.test -h will only show the hyphenated version, + for example "--collect-only" but "--collectonly" will remain valid as well + (for backward-compat reasons). Many thanks to Anthon van der Neut for + the implementation and to Hynek Schlawack for pushing us. + - fix issue279: improve object comparisons on assertion failure for standard datatypes and recognise collections.abc. Thanks to Brianna Laugher and Mathieu Agopian. diff -r e12f3f5b03ce7a92a06b9e4837a0c3bfa15294e1 -r a5240a6c897a70ff55dc91d05e3f756af2004881 doc/en/example/nonpython.txt --- a/doc/en/example/nonpython.txt +++ b/doc/en/example/nonpython.txt @@ -72,7 +72,7 @@ While developing your custom test collection and execution it's also interesting to just look at the collection tree:: - nonpython $ py.test --collectonly + nonpython $ py.test --collect-only =========================== test session starts ============================ platform linux2 -- Python 2.7.3 -- pytest-2.3.5 collected 2 items diff -r e12f3f5b03ce7a92a06b9e4837a0c3bfa15294e1 -r a5240a6c897a70ff55dc91d05e3f756af2004881 doc/en/example/parametrize.txt --- a/doc/en/example/parametrize.txt +++ b/doc/en/example/parametrize.txt @@ -114,7 +114,7 @@ If you just collect tests you'll also nicely see 'advanced' and 'basic' as variants for the test function:: - $ py.test --collectonly test_scenarios.py + $ py.test --collect-only test_scenarios.py =========================== test session starts ============================ platform linux2 -- Python 2.7.3 -- pytest-2.3.5 collected 4 items @@ -178,7 +178,7 @@ Let's first see how it looks like at collection time:: - $ py.test test_backends.py --collectonly + $ py.test test_backends.py --collect-only =========================== test session starts ============================ platform linux2 -- Python 2.7.3 -- pytest-2.3.5 collected 2 items diff -r e12f3f5b03ce7a92a06b9e4837a0c3bfa15294e1 -r a5240a6c897a70ff55dc91d05e3f756af2004881 doc/en/example/pythoncollection.py --- a/doc/en/example/pythoncollection.py +++ b/doc/en/example/pythoncollection.py @@ -1,5 +1,5 @@ -# run this with $ py.test --collectonly test_collectonly.py +# run this with $ py.test --collect-only test_collectonly.py # def test_function(): pass diff -r e12f3f5b03ce7a92a06b9e4837a0c3bfa15294e1 -r a5240a6c897a70ff55dc91d05e3f756af2004881 doc/en/example/pythoncollection.txt --- a/doc/en/example/pythoncollection.txt +++ b/doc/en/example/pythoncollection.txt @@ -41,7 +41,7 @@ then the test collection looks like this:: - $ py.test --collectonly + $ py.test --collect-only =========================== test session starts ============================ platform linux2 -- Python 2.7.3 -- pytest-2.3.5 collected 2 items @@ -80,7 +80,7 @@ You can always peek at the collection tree without running tests like this:: - . $ py.test --collectonly pythoncollection.py + . $ py.test --collect-only pythoncollection.py =========================== test session starts ============================ platform linux2 -- Python 2.7.3 -- pytest-2.3.5 collected 3 items @@ -133,7 +133,7 @@ then a pytest run on python2 will find the one test when run with a python2 interpreters and will leave out the setup.py file:: - $ py.test --collectonly + $ py.test --collect-only =========================== test session starts ============================ platform linux2 -- Python 2.7.3 -- pytest-2.3.5 collected 1 items diff -r e12f3f5b03ce7a92a06b9e4837a0c3bfa15294e1 -r a5240a6c897a70ff55dc91d05e3f756af2004881 doc/en/funcarg_compare.txt --- a/doc/en/funcarg_compare.txt +++ b/doc/en/funcarg_compare.txt @@ -157,7 +157,7 @@ that are never needed because it only co-ordinates the test run activities of the slave processes. -2. if you only perform a collection (with "--collectonly") +2. if you only perform a collection (with "--collect-only") resource-setup will still be executed. 3. If a pytest_sessionstart is contained in some subdirectories @@ -182,7 +182,7 @@ pytest-2.3 takes care to discover fixture/funcarg factories at collection time. This is more efficient especially for large test suites. -Moreover, a call to "py.test --collectonly" should be able to in the future +Moreover, a call to "py.test --collect-only" should be able to in the future show a lot of setup-information and thus presents a nice method to get an overview of fixture management in your project. diff -r e12f3f5b03ce7a92a06b9e4837a0c3bfa15294e1 -r a5240a6c897a70ff55dc91d05e3f756af2004881 doc/ja/example/nonpython.txt --- a/doc/ja/example/nonpython.txt +++ b/doc/ja/example/nonpython.txt @@ -101,7 +101,7 @@ カスタムテストコレクションや実行処理の開発中、そのコレクションツリーをちょっと見るのもおもしろいです:: - nonpython $ py.test --collectonly + nonpython $ py.test --collect-only =========================== test session starts ============================ platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 2 items diff -r e12f3f5b03ce7a92a06b9e4837a0c3bfa15294e1 -r a5240a6c897a70ff55dc91d05e3f756af2004881 doc/ja/example/parametrize.txt --- a/doc/ja/example/parametrize.txt +++ b/doc/ja/example/parametrize.txt @@ -218,7 +218,7 @@ ただテストを (実行せずに) 集めるだけなら、テスト関数の変数として 'advanced' と 'basic' もうまく表示されます:: - $ py.test --collectonly test_scenarios.py + $ py.test --collect-only test_scenarios.py =========================== test session starts ============================ platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 2 items @@ -287,7 +287,7 @@ コレクション時に先ほどの設定がどうなるかを最初に見てみましょう:: - $ py.test test_backends.py --collectonly + $ py.test test_backends.py --collect-only =========================== test session starts ============================ platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 2 items diff -r e12f3f5b03ce7a92a06b9e4837a0c3bfa15294e1 -r a5240a6c897a70ff55dc91d05e3f756af2004881 doc/ja/example/pythoncollection.py --- a/doc/ja/example/pythoncollection.py +++ b/doc/ja/example/pythoncollection.py @@ -1,5 +1,5 @@ -# run this with $ py.test --collectonly test_collectonly.py +# run this with $ py.test --collect-only test_collectonly.py # def test_function(): pass diff -r e12f3f5b03ce7a92a06b9e4837a0c3bfa15294e1 -r a5240a6c897a70ff55dc91d05e3f756af2004881 doc/ja/example/pythoncollection.txt --- a/doc/ja/example/pythoncollection.txt +++ b/doc/ja/example/pythoncollection.txt @@ -68,7 +68,7 @@ テストコレクションは次のようになります:: - $ py.test --collectonly + $ py.test --collect-only =========================== test session starts ============================ platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 2 items @@ -127,7 +127,7 @@ 次のようにテストを実行せずにコレクションツリーをピークできます:: - . $ py.test --collectonly pythoncollection.py + . $ py.test --collect-only pythoncollection.py =========================== test session starts ============================ platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 3 items diff -r e12f3f5b03ce7a92a06b9e4837a0c3bfa15294e1 -r a5240a6c897a70ff55dc91d05e3f756af2004881 doc/ja/funcargs.txt --- a/doc/ja/funcargs.txt +++ b/doc/ja/funcargs.txt @@ -273,7 +273,7 @@ 分かりやすいように ``numiter`` の値が ``9`` のときのみテストが失敗します。 ``pytest_generate_tests(metafunc)`` フックは、実際にテストを実行するときとは違うフェーズの、テストコレクションで呼ばれることに注意してください。では、テストコレクションがどうなるかをちょっと見てみましょう:: - $ py.test --collectonly test_example.py + $ py.test --collect-only test_example.py =========================== test session starts ============================ platform linux2 -- Python 2.7.1 -- pytest-2.2.4 collecting ... collected 10 items diff -r e12f3f5b03ce7a92a06b9e4837a0c3bfa15294e1 -r a5240a6c897a70ff55dc91d05e3f756af2004881 testing/acceptance_test.py --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -151,7 +151,7 @@ pass """) p = testdir.makepyfile("def test_hello(): pass") - result = testdir.runpytest(p, "--collectonly") + result = testdir.runpytest(p, "--collect-only") result.stdout.fnmatch_lines([ "*MyFile*test_issue88*", "*Module*test_issue88*", diff -r e12f3f5b03ce7a92a06b9e4837a0c3bfa15294e1 -r a5240a6c897a70ff55dc91d05e3f756af2004881 testing/python/collect.py --- a/testing/python/collect.py +++ b/testing/python/collect.py @@ -414,7 +414,7 @@ """) testdir.makepyfile("def test_some(): pass") testdir.makepyfile(test_xyz="def test_func(): pass") - result = testdir.runpytest("--collectonly") + result = testdir.runpytest("--collect-only") result.stdout.fnmatch_lines([ "*<Module*test_pytest*", "*<MyModule*xyz*", @@ -467,7 +467,7 @@ return MyFunction(name, collector) """) testdir.makepyfile("def some(): pass") - result = testdir.runpytest("--collectonly") + result = testdir.runpytest("--collect-only") result.stdout.fnmatch_lines([ "*MyFunction*some*", ]) @@ -648,7 +648,7 @@ """) p2 = p.new(basename=p.basename.replace("test", "check")) p.move(p2) - result = testdir.runpytest("--collectonly", "-s") + result = testdir.runpytest("--collect-only", "-s") result.stdout.fnmatch_lines([ "*check_customized*", "*check_simple*", @@ -672,7 +672,7 @@ def _test_underscore(): pass """) - result = testdir.runpytest("--collectonly", "-s") + result = testdir.runpytest("--collect-only", "-s") result.stdout.fnmatch_lines([ "*_test_underscore*", ]) @@ -721,7 +721,7 @@ def test_hello(self): pass """) - result = testdir.runpytest("--collectonly") + result = testdir.runpytest("--collect-only") result.stdout.fnmatch_lines([ "*MyClass*", "*MyInstance*", diff -r e12f3f5b03ce7a92a06b9e4837a0c3bfa15294e1 -r a5240a6c897a70ff55dc91d05e3f756af2004881 testing/python/fixture.py --- a/testing/python/fixture.py +++ b/testing/python/fixture.py @@ -31,7 +31,7 @@ def test_func(some): pass """) - result = testdir.runpytest() # "--collectonly") + result = testdir.runpytest() # "--collect-only") assert result.ret != 0 result.stdout.fnmatch_lines([ "*def test_func(some)*", diff -r e12f3f5b03ce7a92a06b9e4837a0c3bfa15294e1 -r a5240a6c897a70ff55dc91d05e3f756af2004881 testing/python/metafunc.py --- a/testing/python/metafunc.py +++ b/testing/python/metafunc.py @@ -594,7 +594,7 @@ def test_it(foo): pass """) - reprec = testdir.inline_run("--collectonly") + reprec = testdir.inline_run("--collect-only") assert not reprec.getcalls("pytest_internalerror") def test_usefixtures_seen_in_generate_tests(self, testdir): diff -r e12f3f5b03ce7a92a06b9e4837a0c3bfa15294e1 -r a5240a6c897a70ff55dc91d05e3f756af2004881 testing/test_assertion.py --- a/testing/test_assertion.py +++ b/testing/test_assertion.py @@ -372,7 +372,7 @@ [pytest] python_files = *.py """) - result = testdir.runpytest("--collectonly") + result = testdir.runpytest("--collect-only") result.stdout.fnmatch_lines(""" <Module*> """) diff -r e12f3f5b03ce7a92a06b9e4837a0c3bfa15294e1 -r a5240a6c897a70ff55dc91d05e3f756af2004881 testing/test_collection.py --- a/testing/test_collection.py +++ b/testing/test_collection.py @@ -97,7 +97,7 @@ for x in tmpdir.visit("test_*.py"): x.write("def test_hello(): pass") - result = testdir.runpytest("--collectonly") + result = testdir.runpytest("--collect-only") s = result.stdout.str() assert "test_notfound" not in s assert "test_found" in s @@ -252,7 +252,7 @@ """) sub = testdir.mkdir("sub") p = testdir.makepyfile("def test_x(): pass") - result = testdir.runpytest("--collectonly") + result = testdir.runpytest("--collect-only") result.stdout.fnmatch_lines([ "*MyModule*", "*test_x*" @@ -282,7 +282,7 @@ p = testdir.makepyfile("def test_x(): pass") p.copy(sub1.join(p.basename)) p.copy(sub2.join(p.basename)) - result = testdir.runpytest("--collectonly") + result = testdir.runpytest("--collect-only") result.stdout.fnmatch_lines([ "*MyModule1*", "*MyModule2*", diff -r e12f3f5b03ce7a92a06b9e4837a0c3bfa15294e1 -r a5240a6c897a70ff55dc91d05e3f756af2004881 testing/test_session.py --- a/testing/test_session.py +++ b/testing/test_session.py @@ -179,7 +179,7 @@ test_three="xxxdsadsadsadsa", __init__="" ) - reprec = testdir.inline_run('--collectonly', p.dirpath()) + reprec = testdir.inline_run('--collect-only', p.dirpath()) itemstarted = reprec.getcalls("pytest_itemcollected") assert len(itemstarted) == 3 @@ -238,5 +238,5 @@ assert l[0] == os.getcwd() """) - res = testdir.runpytest("--collectonly") + res = testdir.runpytest("--collect-only") assert res.ret == 0 diff -r e12f3f5b03ce7a92a06b9e4837a0c3bfa15294e1 -r a5240a6c897a70ff55dc91d05e3f756af2004881 testing/test_terminal.py --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -188,7 +188,7 @@ def test_func(): pass """) - result = testdir.runpytest("--collectonly",) + result = testdir.runpytest("--collect-only",) result.stdout.fnmatch_lines([ "<Module 'test_collectonly_basic.py'>", " <Function 'test_func'>", @@ -199,7 +199,7 @@ import pytest pytest.skip("hello") """) - result = testdir.runpytest("--collectonly", "-rs") + result = testdir.runpytest("--collect-only", "-rs") result.stdout.fnmatch_lines([ "SKIP*hello*", "*1 skip*", @@ -207,7 +207,7 @@ def test_collectonly_failed_module(self, testdir): testdir.makepyfile("""raise ValueError(0)""") - result = testdir.runpytest("--collectonly") + result = testdir.runpytest("--collect-only") result.stdout.fnmatch_lines([ "*raise ValueError*", "*1 error*", @@ -218,7 +218,7 @@ def pytest_collectstart(collector): assert 0, "urgs" """) - result = testdir.runpytest("--collectonly") + result = testdir.runpytest("--collect-only") result.stdout.fnmatch_lines([ "*INTERNAL*args*" ]) @@ -232,7 +232,7 @@ def test_method(self): pass """) - result = testdir.runpytest("--collectonly", p) + result = testdir.runpytest("--collect-only", p) stderr = result.stderr.str().strip() #assert stderr.startswith("inserting into sys.path") assert result.ret == 0 @@ -246,7 +246,7 @@ def test_collectonly_error(self, testdir): p = testdir.makepyfile("import Errlkjqweqwe") - result = testdir.runpytest("--collectonly", p) + result = testdir.runpytest("--collect-only", p) stderr = result.stderr.str().strip() assert result.ret == 1 result.stdout.fnmatch_lines(py.code.Source(""" @@ -261,7 +261,7 @@ failure in parseargs will cause session not to have the items attribute """ - result = testdir.runpytest("--collectonly", "uhm_missing_path") + result = testdir.runpytest("--collect-only", "uhm_missing_path") assert result.ret == 4 result.stderr.fnmatch_lines([ '*ERROR: file not found*', @@ -269,14 +269,14 @@ def test_collectonly_quiet(self, testdir): testdir.makepyfile("def test_foo(): pass") - result = testdir.runpytest("--collectonly", "-q") + result = testdir.runpytest("--collect-only", "-q") result.stdout.fnmatch_lines([ '*test_foo*', ]) def test_collectonly_more_quiet(self, testdir): testdir.makepyfile(test_fun="def test_foo(): pass") - result = testdir.runpytest("--collectonly", "-qq") + result = testdir.runpytest("--collect-only", "-qq") result.stdout.fnmatch_lines([ '*test_fun.py: 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. _______________________________________________ pytest-commit mailing list pytest-commit@python.org http://mail.python.org/mailman/listinfo/pytest-commit