reusing test classess from another module's test directory?
Hello, in the PyObject* converter and executor, I use cpyext to get hold of a PyObject* to send to/receive from the C++ world. That works okay, but it proves rather hard to test. I now have a test that does what I want, based on AppTestCpythonExtensionBase, where pretty much all the heavy lifting is done, saving me tons of work. What is the recommended way to grab test bases from the test area of another module? Right now, I'm doing the moderately ugly: sys.path.append(str(py.path.local(autopath.pypydir).join('module', 'cpyext', 'test'))) from test_cpyext import AppTestCpythonExtensionBase which works fine, but surely there must be a better way? Thanks, Wim -- WLavrijsen@lbl.gov -- +1 (510) 486 6411 -- www.lavrijsen.net
2012/6/4 <wlavrijsen@lbl.gov>
What is the recommended way to grab test bases from the test area of another module? Right now, I'm doing the moderately ugly:
sys.path.append(str(py.path.**local(autopath.pypydir).join('**module', 'cpyext', 'test'))) from test_cpyext import AppTestCpythonExtensionBase
which works fine, but surely there must be a better way?
You surely noticed that pypy uses absolute imports everywhere. Did you try: from pypy.module.cpyext.test.test_cpyext import AppTestCpythonExtensionBase like all test files under pypy/module/cpyext? -- Amaury Forgeot d'Arc
Hi Amaury,
You surely noticed that pypy uses absolute imports everywhere. Did you try: from pypy.module.cpyext.test.test_cpyext import AppTestCpythonExtensionBase like all test files under pypy/module/cpyext?
yes, now I see. Before, I overlooked that directory 'test' actually has an __init__.py, thus being a module as well. Thanks, Wim -- WLavrijsen@lbl.gov -- +1 (510) 486 6411 -- www.lavrijsen.net
participants (2)
-
Amaury Forgeot d'Arc -
wlavrijsen@lbl.gov