doc refinements

introduce '__channelexec__' + docs

--HG--
branch : 1.0.x
This commit is contained in:
holger krekel 2009-06-26 17:48:46 +02:00
parent e412f695dd
commit 296a660a73
6 changed files with 38 additions and 10 deletions

View File

@ -15,6 +15,8 @@ Changes between 1.0.0b3 and 1.0.0
* resolve issue #18, multiprocessing.Manager() and * resolve issue #18, multiprocessing.Manager() and
redirection clash redirection clash
* make __name__ == "__channelexec__" for remote_exec code
Changes between 1.0.0b1 and 1.0.0b3 Changes between 1.0.0b1 and 1.0.0b3
============================================= =============================================

View File

@ -1,32 +1,37 @@
py.test / py lib 1.0.0: distributed testing and dynamic code deployment py.test / py lib 1.0.0: new test plugins, funcargs and cleanups
============================================================================ ============================================================================
Welcome to the 1.0 release bringing new flexibility and Welcome to the 1.0 release bringing new flexibility and
power to testing with Python! Main news: power to testing with Python! Main news:
* new py.test plugin architecture, some examples: * improved architecture, featuring simple single-file plugins, e.g:
pytest_unittest.py: run traditional unittest.py tests
pytest_xfail.py: mark tests as "expected to fail" pytest_xfail.py: mark tests as "expected to fail"
pytest_pocoo.py: automatically send tracebacks to pocoo paste service pytest_pocoo.py: automatically send tracebacks to pocoo paste service
pytest_monkeypatch.py: safely patch parts of your environment in a test function pytest_monkeypatch.py: safely patch parts of your environment in a test function
pytest_figleaf.py: generate html coverage reports pytest_figleaf.py: generate html coverage reports
pytest_resultlog.py: generate buildbot-friendly output pytest_resultlog.py: generate buildbot-friendly output
and much more! and many more!
* funcargs - the new flexible mechanism for managing all your test setup/fixture needs! * funcargs - powerful mechanism for all your setup needs
* flexibly distribute tests to multiple computers from the command line * distributed testing: ad-hoc send and run tests on many platforms
* remove first round of non-test related code, notably
greenlets and apigen (documentation generation) that
now live on their own
See the py.test documentation for more info: See the py.test documentation for more info:
http://pytest.org http://pytest.org
The py lib contains the py.test tool and offers its well-tested code The py lib also got smaller and focuses on offering much of the
independently from the testing tool, mainly: well-tested py.test code in independent namespaces:
* py.execnet: ad-hoc code distribution to SSH, Socket and local sub processes * py.execnet: ad-hoc code distribution to SSH, Socket and local sub processes
* py.code: support for dynamically running and debugging python code * py.code: higher-level introspection and dynamic generation of python code
* py.path: path abstractions over local and subversion files * py.path: path abstractions over local and subversion files
The whole package works well with Linux, OSX and Win32, on The whole package works well with Linux, OSX and Win32, on

View File

@ -233,3 +233,19 @@ socketserver::
socketgw = py.execnet.SocketGateway.new_remote(popengw, ("127.0.0.1", 0)) socketgw = py.execnet.SocketGateway.new_remote(popengw, ("127.0.0.1", 0))
print socketgw._rinfo() # print some info about the remote environment print socketgw._rinfo() # print some info about the remote environment
Sending a module / checking if run through remote_exec
--------------------------------------------------------------
You can pass a module object to ``remote_exec`` in which case
its source code will be sent. No dependencies will be transferred
so the module must be self-contained or only use modules that are
installed on the "other" side. Module code can detect if it is
running in a remote_exec situation by checking for the special
``__name__`` attribute like this::
if __name__ == '__channelexec__':
# ... call module functions ...

View File

@ -19,7 +19,7 @@ For questions please check out http://pylib.org/contact.html
""" """
from initpkg import initpkg from initpkg import initpkg
version = "1.0.0b5" version = "1.0.0b6"
initpkg(__name__, initpkg(__name__,
description = "py.test and pylib: advanced testing tool and networking lib", description = "py.test and pylib: advanced testing tool and networking lib",

View File

@ -230,7 +230,7 @@ class Gateway(object):
from sys import exc_info from sys import exc_info
channel, (source, outid, errid) = item channel, (source, outid, errid) = item
try: try:
loc = { 'channel' : channel } loc = { 'channel' : channel, '__name__': '__channelexec__'}
self._trace("execution starts:", repr(source)[:50]) self._trace("execution starts:", repr(source)[:50])
close = self._local_redirect_thread_output(outid, errid) close = self._local_redirect_thread_output(outid, errid)
try: try:

View File

@ -92,6 +92,11 @@ class BasicRemoteExecution:
def test_repr_doesnt_crash(self): def test_repr_doesnt_crash(self):
assert isinstance(repr(self), str) assert isinstance(repr(self), str)
def test_attribute__name__(self):
channel = self.gw.remote_exec("channel.send(__name__)")
name = channel.receive()
assert name == "__channelexec__"
def test_correct_setup_no_py(self): def test_correct_setup_no_py(self):
channel = self.gw.remote_exec(""" channel = self.gw.remote_exec("""
import sys import sys