diff --git a/CHANGELOG b/CHANGELOG index 9f8f0c0b5..563cb93f2 100644 --- 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 --git a/doc/en/example/nonpython.txt b/doc/en/example/nonpython.txt index 7aefd7826..632da4478 100644 --- a/doc/en/example/nonpython.txt +++ b/doc/en/example/nonpython.txt @@ -72,7 +72,7 @@ consulted when reporting in ``verbose`` mode:: 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 --git a/doc/en/example/parametrize.txt b/doc/en/example/parametrize.txt index dd1a9c73f..f6a3cb263 100644 --- a/doc/en/example/parametrize.txt +++ b/doc/en/example/parametrize.txt @@ -114,7 +114,7 @@ this is a fully self-contained example which you can run with:: 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 @@ creates a database object for the actual test invocations:: 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 --git a/doc/en/example/pythoncollection.py b/doc/en/example/pythoncollection.py index 5296b8b99..05858eb85 100644 --- 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 --git a/doc/en/example/pythoncollection.txt b/doc/en/example/pythoncollection.txt index 82947a505..2f65b1faf 100644 --- a/doc/en/example/pythoncollection.txt +++ b/doc/en/example/pythoncollection.txt @@ -41,7 +41,7 @@ in functions and classes. For example, if we have:: 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 @@ Finding out what is collected 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 @@ and a setup.py dummy file like this:: 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 --git a/doc/en/funcarg_compare.txt b/doc/en/funcarg_compare.txt index a70f87e22..e951f87ca 100644 --- a/doc/en/funcarg_compare.txt +++ b/doc/en/funcarg_compare.txt @@ -157,7 +157,7 @@ several problems: 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 @@ funcargs/fixture discovery now happens at collection time 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 --git a/doc/ja/example/nonpython.txt b/doc/ja/example/nonpython.txt index 5dfb31c0c..c78042ba5 100644 --- a/doc/ja/example/nonpython.txt +++ b/doc/ja/example/nonpython.txt @@ -101,7 +101,7 @@ Yaml ファイルでテストを指定する基本的なサンプル カスタムテストコレクションや実行処理の開発中、そのコレクションツリーをちょっと見るのもおもしろいです:: - 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 --git a/doc/ja/example/parametrize.txt b/doc/ja/example/parametrize.txt index aba551619..37c4a577f 100644 --- a/doc/ja/example/parametrize.txt +++ b/doc/ja/example/parametrize.txt @@ -218,7 +218,7 @@ Robert Collins による標準ライブラリの unittest フレームワーク ただテストを (実行せずに) 集めるだけなら、テスト関数の変数として '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 @@ Robert Collins による標準ライブラリの unittest フレームワーク コレクション時に先ほどの設定がどうなるかを最初に見てみましょう:: - $ 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 --git a/doc/ja/example/pythoncollection.py b/doc/ja/example/pythoncollection.py index 5296b8b99..05858eb85 100644 --- 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 --git a/doc/ja/example/pythoncollection.txt b/doc/ja/example/pythoncollection.txt index 499c92003..077175925 100644 --- a/doc/ja/example/pythoncollection.txt +++ b/doc/ja/example/pythoncollection.txt @@ -68,7 +68,7 @@ ini ファイルで :confval:`norecursedirs` オプションを設定できま テストコレクションは次のようになります:: - $ 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 がファイルシステムのパスから Python パッケージ名と 次のようにテストを実行せずにコレクションツリーをピークできます:: - . $ 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 --git a/doc/ja/funcargs.txt b/doc/ja/funcargs.txt index 597e0e7bc..783dac5d6 100644 --- a/doc/ja/funcargs.txt +++ b/doc/ja/funcargs.txt @@ -273,7 +273,7 @@ funcarg ファクトリー関数は、特別なテスト関数呼び出しに関 分かりやすいように ``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 --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 1312f9d20..295fe3080 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -151,7 +151,7 @@ class TestGeneralUsage: 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 --git a/testing/python/collect.py b/testing/python/collect.py index 906999f89..2e9e78293 100644 --- a/testing/python/collect.py +++ b/testing/python/collect.py @@ -414,7 +414,7 @@ class TestConftestCustomization: """) 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([ "* """) diff --git a/testing/test_collection.py b/testing/test_collection.py index 45877fc5b..f330002e9 100644 --- a/testing/test_collection.py +++ b/testing/test_collection.py @@ -97,7 +97,7 @@ class TestCollectFS: 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 @@ class TestCustomConftests: """) 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 @@ class TestCustomConftests: 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 --git a/testing/test_session.py b/testing/test_session.py index df7463e02..e8e67bde2 100644 --- a/testing/test_session.py +++ b/testing/test_session.py @@ -179,7 +179,7 @@ class TestNewSession(SessionTests): 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 @@ def test_sessionfinish_with_start(testdir): assert l[0] == os.getcwd() """) - res = testdir.runpytest("--collectonly") + res = testdir.runpytest("--collect-only") assert res.ret == 0 diff --git a/testing/test_terminal.py b/testing/test_terminal.py index 804f3b656..7007bcc67 100644 --- a/testing/test_terminal.py +++ b/testing/test_terminal.py @@ -188,7 +188,7 @@ class TestCollectonly: def test_func(): pass """) - result = testdir.runpytest("--collectonly",) + result = testdir.runpytest("--collect-only",) result.stdout.fnmatch_lines([ "", " ", @@ -199,7 +199,7 @@ class TestCollectonly: 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 @@ class TestCollectonly: 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 @@ class TestCollectonly: 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 @@ class TestCollectonly: 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 @@ class TestCollectonly: 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 @@ class TestCollectonly: 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 @@ class TestCollectonly: 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*', ])