Commit 433d0bfb authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #1009 from rudi-c/paste_test

Test file for paste (and py.test) modules
parents c5f6c9d5 254f3bc4
......@@ -119,6 +119,13 @@ void BoxedTraceback::here(LineInfo lineInfo, Box** tb) {
*tb = new BoxedTraceback(std::move(lineInfo), *tb);
}
static Box* traceback_tb_next(Box* self, void*) {
assert(self->cls == traceback_cls);
BoxedTraceback* traceback = static_cast<BoxedTraceback*>(self);
return traceback->tb_next;
}
void setupTraceback() {
traceback_cls = BoxedClass::create(type_cls, object_cls, BoxedTraceback::gcHandler, 0, 0, sizeof(BoxedTraceback),
false, "traceback");
......@@ -126,6 +133,15 @@ void setupTraceback() {
traceback_cls->giveAttr("getLines",
new BoxedFunction(FunctionMetadata::create((void*)BoxedTraceback::getLines, UNKNOWN, 1)));
/*
* Currently not supported.
traceback_cls->giveAttr("tb_frame", new (pyston_getset_cls) BoxedGetsetDescriptor(traceback_tb_frame, NULL, NULL));
traceback_cls->giveAttr("tb_lasti", new (pyston_getset_cls) BoxedGetsetDescriptor(traceback_tb_lasti, NULL, NULL));
traceback_cls->giveAttr("tb_lineno", new (pyston_getset_cls) BoxedGetsetDescriptor(traceback_tb_lineno, NULL,
NULL));
*/
traceback_cls->giveAttr("tb_next", new (pyston_getset_cls) BoxedGetsetDescriptor(traceback_tb_next, NULL, NULL));
traceback_cls->freeze();
}
}
# expected: fail
# The paste test suite uses pytest, so this test file incentally also tests pytest.
# Pytest relies quite heavily on a number of code introspection features, which
# we currently don't have. This includes:
# 1) The ast module
# 2) traceback.tb_frame, traceback.tb_next
import os, sys, subprocess
sys.path.append(os.path.dirname(__file__) + "/../lib")
from test_helper import create_virtenv, run_test
ENV_NAME = "paste_test_env_" + os.path.basename(sys.executable)
PYTHON_EXE = os.path.abspath(os.path.join(ENV_NAME, "bin", "python"))
PYTEST_EXE = os.path.abspath(os.path.join(ENV_NAME, "bin", "py.test"))
PASTE_DIR = os.path.abspath(os.path.join(ENV_NAME, "paste"))
PASTE_TEST_DIR = os.path.abspath(os.path.join(PASTE_DIR, "tests"))
packages = ["pytest", "paste", "nose==1.3.7"]
create_virtenv(ENV_NAME, packages, force_create = True)
# Need the test files in the source
subprocess.check_call(["hg", "clone", "https://bitbucket.org/ianb/paste"], cwd=ENV_NAME)
print ">> "
print ">> Setting up paste..."
print ">> "
subprocess.check_call([PYTHON_EXE, "setup.py", "build"], cwd=PASTE_DIR)
print ">> "
print ">> Running paste tests..."
print ">> "
subprocess.check_call([PYTEST_EXE], cwd=PASTE_TEST_DIR)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment