1 new commit in pytest: https://bitbucket.org/hpk42/pytest/commits/4c926afb69fc/ Changeset: 4c926afb69fc User: hpk42 Date: 2013-11-21 14:40:14 Summary: remove an old duplicate marker and use recent pytest mechanism for parametrization Affected #: 6 files
diff -r 5db368c10f64e5daaacd5252aefde9cb8f3d389d -r 4c926afb69fc84051e08a2816085a58a74493ebf testing/conftest.py --- a/testing/conftest.py +++ b/testing/conftest.py @@ -12,10 +12,6 @@ help=("run FD checks if lsof is available")) def pytest_configure(config): - config.addinivalue_line("markers", - "multi(arg=[value1,value2, ...]): call the test function " - "multiple times with arg=value1, then with arg=value2, ... " - ) if config.getvalue("lsof"): try: out = py.process.cmdexec("lsof -p %d" % pid) @@ -57,19 +53,6 @@ check_open_files(item.config) return x -def pytest_generate_tests(metafunc): - multi = getattr(metafunc.function, 'multi', None) - if multi is not None: - assert len(multi.kwargs) == 1 - for name, l in multi.kwargs.items(): - for val in l: - metafunc.addcall(funcargs={name: val}) - elif 'anypython' in metafunc.fixturenames: - for name in ('python2.5', 'python2.6', - 'python2.7', 'python3.2', "python3.3", - 'pypy', 'jython'): - metafunc.addcall(id=name, param=name) - # XXX copied from execnet's conftest.py - needs to be merged winpymap = { 'python2.7': r'C:\Python27\python.exe', @@ -100,7 +83,10 @@ cache[name] = executable return executable -def pytest_funcarg__anypython(request): +@pytest.fixture(params=['python2.5', 'python2.6', + 'python2.7', 'python3.2', "python3.3", + 'pypy', 'jython']) +def anypython(request): name = request.param executable = getexecutable(name) if executable is None: diff -r 5db368c10f64e5daaacd5252aefde9cb8f3d389d -r 4c926afb69fc84051e08a2816085a58a74493ebf testing/test_capture.py --- a/testing/test_capture.py +++ b/testing/test_capture.py @@ -32,7 +32,7 @@ assert capman._getmethod(config, sub.join("test_hello.py")) == mode @needsosdup - @pytest.mark.multi(method=['no', 'fd', 'sys']) + @pytest.mark.parametrize("method", ['no', 'fd', 'sys']) def test_capturing_basic_api(self, method): capouter = py.io.StdCaptureFD() old = sys.stdout, sys.stderr, sys.stdin @@ -81,7 +81,7 @@ capouter.reset() @pytest.mark.xfail("hasattr(sys, 'pypy_version_info')") -@pytest.mark.multi(method=['fd', 'sys']) +@pytest.mark.parametrize("method", ['fd', 'sys']) def test_capturing_unicode(testdir, method): if sys.version_info >= (3,0): obj = "'b\u00f6y'" @@ -100,7 +100,7 @@ "*1 passed*" ]) -@pytest.mark.multi(method=['fd', 'sys']) +@pytest.mark.parametrize("method", ['fd', 'sys']) def test_capturing_bytes_in_utf8_encoding(testdir, method): testdir.makepyfile(""" def test_unicode(): diff -r 5db368c10f64e5daaacd5252aefde9cb8f3d389d -r 4c926afb69fc84051e08a2816085a58a74493ebf testing/test_config.py --- a/testing/test_config.py +++ b/testing/test_config.py @@ -41,7 +41,7 @@ "*tox.ini:2*requires*9.0*actual*" ]) - @pytest.mark.multi(name="setup.cfg tox.ini pytest.ini".split()) + @pytest.mark.parametrize("name", "setup.cfg tox.ini pytest.ini".split()) def test_ini_names(self, testdir, name): testdir.tmpdir.join(name).write(py.std.textwrap.dedent(""" [pytest] diff -r 5db368c10f64e5daaacd5252aefde9cb8f3d389d -r 4c926afb69fc84051e08a2816085a58a74493ebf testing/test_conftest.py --- a/testing/test_conftest.py +++ b/testing/test_conftest.py @@ -182,7 +182,7 @@ assert conftest.getconftestmodules(sub) == [] assert conftest.getconftestmodules(conf.dirpath()) == [] -@pytest.mark.multi(name='test tests whatever .dotdir'.split()) +@pytest.mark.parametrize("name", 'test tests whatever .dotdir'.split()) def test_setinitial_conftest_subdirs(testdir, name): sub = testdir.mkdir(name) subconftest = sub.ensure("conftest.py") diff -r 5db368c10f64e5daaacd5252aefde9cb8f3d389d -r 4c926afb69fc84051e08a2816085a58a74493ebf testing/test_mark.py --- a/testing/test_mark.py +++ b/testing/test_mark.py @@ -124,7 +124,7 @@ "*unregisteredmark*not*registered*", ]) -@pytest.mark.multi(spec=[ +@pytest.mark.parametrize("spec", [ ("xyz", ("test_one",)), ("xyz and xyz2", ()), ("xyz2", ("test_two",)), @@ -147,7 +147,7 @@ assert len(passed) == len(passed_result) assert list(passed) == list(passed_result) -@pytest.mark.multi(spec=[ +@pytest.mark.parametrize("spec", [ ("interface", ("test_interface",)), ("not interface", ("test_nointer",)), ]) @@ -172,7 +172,7 @@ assert len(passed) == len(passed_result) assert list(passed) == list(passed_result) -@pytest.mark.multi(spec=[ +@pytest.mark.parametrize("spec", [ ("interface", ("test_interface",)), ("not interface", ("test_nointer",)), ]) diff -r 5db368c10f64e5daaacd5252aefde9cb8f3d389d -r 4c926afb69fc84051e08a2816085a58a74493ebf testing/test_unittest.py --- a/testing/test_unittest.py +++ b/testing/test_unittest.py @@ -236,7 +236,7 @@ reprec.assertoutcome(passed=3) -@pytest.mark.multi(type=['Error', 'Failure']) +@pytest.mark.parametrize("type", ['Error', 'Failure']) def test_testcase_adderrorandfailure_defers(testdir, type): testdir.makepyfile(""" from unittest import TestCase @@ -256,7 +256,7 @@ result = testdir.runpytest() assert 'should not raise' not in result.stdout.str() -@pytest.mark.multi(type=['Error', 'Failure']) +@pytest.mark.parametrize("type", ['Error', 'Failure']) def test_testcase_custom_exception_info(testdir, type): testdir.makepyfile(""" from unittest import TestCase 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 https://mail.python.org/mailman/listinfo/pytest-commit