Author: Ronan Lamy <ronan.l...@gmail.com> Branch: apptest-file Changeset: r94332:e09619779251 Date: 2018-04-15 01:42 +0100 http://bitbucket.org/pypy/pypy/changeset/e09619779251/
Log: Adding some tests (WIP) diff --git a/pypy/tool/pytest/test/apptest_xx.py b/pypy/tool/pytest/test/apptest_xx.py new file mode 100644 --- /dev/null +++ b/pypy/tool/pytest/test/apptest_xx.py @@ -0,0 +1,3 @@ +def test_fail(): + x = 'foo' + assert x == 'bar' diff --git a/pypy/tool/pytest/test/test_appsupport.py b/pypy/tool/pytest/test/test_appsupport.py --- a/pypy/tool/pytest/test/test_appsupport.py +++ b/pypy/tool/pytest/test/test_appsupport.py @@ -23,10 +23,16 @@ def test_method(self): pass """) + testdir.makepyfile(apptest_collection=""" + def test_app(): + pass + """) setpypyconftest(testdir) result = testdir.runpytest("--collectonly") assert result.ret == 0 result.stdout.fnmatch_lines([ + "*AppTestModule*apptest_collection*", + "*AppTestFunction*test_app*", "*Function*test_func*", "*Class*TestClassInt*", "*Function*test_method*", @@ -126,6 +132,45 @@ "*E*application-level*KeyError*42*", ]) +def test_apptest_raise(testdir): + setpypyconftest(testdir) + p = testdir.makepyfile(apptest_raise=""" + def test_raise(): + raise KeyError(42) + """) + result = testdir.runpytest(p) + assert result.ret == 1 + result.stdout.fnmatch_lines([ + "*E*application-level*KeyError*42*", + ]) + +def test_apptest_fail_plain(testdir): + setpypyconftest(testdir) + p = testdir.makepyfile(apptest_fail=""" + def test_fail(): + x = 'foo' + assert x == 'bar' + """) + result = testdir.runpytest(p) + assert result.ret == 1 + result.stdout.fnmatch_lines([ + "*E*application-level*KeyError*42*", + ]) + +def test_apptest_fail_rewrite(testdir): + setpypyconftest(testdir) + p = testdir.makepyfile(apptest_fail_rewrite=""" + def test_fail(): + x = 'foo' + assert x == 'bar' + """) + result = testdir.runpytest(p, "--applevel-rewrite") + assert result.ret == 1 + result.stdout.fnmatch_lines([ + "*E*application-level*KeyError*42*", + ]) + + def app_test_raises(): info = raises(TypeError, id) assert info.type is TypeError _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit