[py-svn] r36632 - in py/dist: . py/apigen py/builtin py/builtin/testing py/code py/code/testing py/compat py/compat/testing py/documentation py/documentation/apigen py/documentation/future py/documentation/talk py/execnet/script py/misc py/misc/testing py/path/local/testing py/path/svn py/path/svn/testing py/rest py/rest/testing py/rest/testing/data py/test/rsession py/test/rsession/testing py/test/testing/data py/test/web
hpk at codespeak.net
hpk at codespeak.net
Sat Jan 13 08:18:38 CET 2007
Author: hpk
Date: Sat Jan 13 08:18:32 2007
New Revision: 36632
Modified:
py/dist/py/apigen/conftest.py (props changed)
py/dist/py/apigen/layout.py (props changed)
py/dist/py/apigen/project.py (props changed)
py/dist/py/builtin/sorted.py (props changed)
py/dist/py/builtin/testing/test_sorted.py (props changed)
py/dist/py/code/safe_repr.py (props changed)
py/dist/py/code/testing/test_safe_repr.py (props changed)
py/dist/py/compat/subprocess.py (props changed)
py/dist/py/compat/testing/test_subprocess.py (props changed)
py/dist/py/documentation/apigen/ (props changed)
py/dist/py/documentation/apigen.txt (props changed)
py/dist/py/documentation/binary.txt (props changed)
py/dist/py/documentation/future/ (props changed)
py/dist/py/documentation/future/code_template.txt (props changed)
py/dist/py/documentation/future/planning.txt (props changed)
py/dist/py/documentation/future/rsession_todo.txt (props changed)
py/dist/py/documentation/links.txt (props changed)
py/dist/py/documentation/log.txt (props changed)
py/dist/py/documentation/talk/ (props changed)
py/dist/py/execnet/script/socketserverservice.py (contents, props changed)
py/dist/py/misc/_dist.py (contents, props changed)
py/dist/py/misc/findmissingdocstrings.py (props changed)
py/dist/py/misc/svnlook.py (props changed)
py/dist/py/misc/terminal_helper.py (props changed)
py/dist/py/misc/testing/test_svnlook.py (props changed)
py/dist/py/path/local/testing/test_win.py (contents, props changed)
py/dist/py/path/svn/quoting.txt (props changed)
py/dist/py/path/svn/testing/test_test_repo.py (props changed)
py/dist/py/rest/testing/data/formula.txt (props changed)
py/dist/py/rest/testing/data/formula1.txt (props changed)
py/dist/py/rest/testing/test_htmlrest.py (props changed)
py/dist/py/rest/testing/test_transform.py (props changed)
py/dist/py/rest/transform.py (props changed)
py/dist/py/test/rsession/rsync_remote.py (props changed)
py/dist/py/test/rsession/testing/test_webjs.py (props changed)
py/dist/py/test/testing/data/brokenrepr.py (props changed)
py/dist/py/test/testing/data/disabled_module.py (props changed)
py/dist/py/test/web/ (props changed)
py/dist/py/test/web/__init__.py (props changed)
py/dist/py/test/web/exception.py (props changed)
py/dist/py/test/web/post_multipart.py (props changed)
py/dist/py/test/web/webcheck.py (props changed)
py/dist/setup.py (props changed)
Log:
fixeol
Modified: py/dist/py/execnet/script/socketserverservice.py
==============================================================================
--- py/dist/py/execnet/script/socketserverservice.py (original)
+++ py/dist/py/execnet/script/socketserverservice.py Sat Jan 13 08:18:32 2007
@@ -1,91 +1,91 @@
-"""
-A windows service wrapper for the py.execnet socketserver.
-
-To use, run:
- python socketserverservice.py register
- net start ExecNetSocketServer
-"""
-
-import sys
-import os
-import time
-import win32serviceutil
-import win32service
-import win32event
-import win32evtlogutil
-import servicemanager
-import threading
-import socketserver
-
-
-appname = 'ExecNetSocketServer'
-
-
-class SocketServerService(win32serviceutil.ServiceFramework):
- _svc_name_ = appname
- _svc_display_name_ = "%s" % appname
- _svc_deps_ = ["EventLog"]
- def __init__(self, args):
- # The exe-file has messages for the Event Log Viewer.
- # Register the exe-file as event source.
- #
- # Probably it would be better if this is done at installation time,
- # so that it also could be removed if the service is uninstalled.
- # Unfortunately it cannot be done in the 'if __name__ == "__main__"'
- # block below, because the 'frozen' exe-file does not run this code.
- #
- win32evtlogutil.AddSourceToRegistry(self._svc_display_name_,
- servicemanager.__file__,
- "Application")
- win32serviceutil.ServiceFramework.__init__(self, args)
- self.hWaitStop = win32event.CreateEvent(None, 0, 0, None)
- self.WAIT_TIME = 1000 # in milliseconds
-
-
- def SvcStop(self):
- self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
- win32event.SetEvent(self.hWaitStop)
-
-
- def SvcDoRun(self):
- # Redirect stdout and stderr to prevent "IOError: [Errno 9]
- # Bad file descriptor". Windows services don't have functional
- # output streams.
- sys.stdout = sys.stderr = open('nul', 'w')
-
- # Write a 'started' event to the event log...
- win32evtlogutil.ReportEvent(self._svc_display_name_,
- servicemanager.PYS_SERVICE_STARTED,
- 0, # category
- servicemanager.EVENTLOG_INFORMATION_TYPE,
- (self._svc_name_, ''))
- print "Begin: %s" % (self._svc_display_name_)
-
- hostport = ':8888'
- print 'Starting py.execnet SocketServer on %s' % hostport
- serversock = socketserver.bind_and_listen(hostport)
- thread = threading.Thread(target=socketserver.startserver,
- args=(serversock,),
- kwargs={'loop':True})
- thread.setDaemon(True)
- thread.start()
-
- # wait to be stopped or self.WAIT_TIME to pass
- while True:
- result = win32event.WaitForSingleObject(self.hWaitStop,
- self.WAIT_TIME)
- if result == win32event.WAIT_OBJECT_0:
- break
-
- # write a 'stopped' event to the event log.
- win32evtlogutil.ReportEvent(self._svc_display_name_,
- servicemanager.PYS_SERVICE_STOPPED,
- 0, # category
- servicemanager.EVENTLOG_INFORMATION_TYPE,
- (self._svc_name_, ''))
- print "End: %s" % appname
-
-
-if __name__ == '__main__':
- # Note that this code will not be run in the 'frozen' exe-file!!!
- win32serviceutil.HandleCommandLine(SocketServerService)
+"""
+A windows service wrapper for the py.execnet socketserver.
+
+To use, run:
+ python socketserverservice.py register
+ net start ExecNetSocketServer
+"""
+
+import sys
+import os
+import time
+import win32serviceutil
+import win32service
+import win32event
+import win32evtlogutil
+import servicemanager
+import threading
+import socketserver
+
+
+appname = 'ExecNetSocketServer'
+
+
+class SocketServerService(win32serviceutil.ServiceFramework):
+ _svc_name_ = appname
+ _svc_display_name_ = "%s" % appname
+ _svc_deps_ = ["EventLog"]
+ def __init__(self, args):
+ # The exe-file has messages for the Event Log Viewer.
+ # Register the exe-file as event source.
+ #
+ # Probably it would be better if this is done at installation time,
+ # so that it also could be removed if the service is uninstalled.
+ # Unfortunately it cannot be done in the 'if __name__ == "__main__"'
+ # block below, because the 'frozen' exe-file does not run this code.
+ #
+ win32evtlogutil.AddSourceToRegistry(self._svc_display_name_,
+ servicemanager.__file__,
+ "Application")
+ win32serviceutil.ServiceFramework.__init__(self, args)
+ self.hWaitStop = win32event.CreateEvent(None, 0, 0, None)
+ self.WAIT_TIME = 1000 # in milliseconds
+
+
+ def SvcStop(self):
+ self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
+ win32event.SetEvent(self.hWaitStop)
+
+
+ def SvcDoRun(self):
+ # Redirect stdout and stderr to prevent "IOError: [Errno 9]
+ # Bad file descriptor". Windows services don't have functional
+ # output streams.
+ sys.stdout = sys.stderr = open('nul', 'w')
+
+ # Write a 'started' event to the event log...
+ win32evtlogutil.ReportEvent(self._svc_display_name_,
+ servicemanager.PYS_SERVICE_STARTED,
+ 0, # category
+ servicemanager.EVENTLOG_INFORMATION_TYPE,
+ (self._svc_name_, ''))
+ print "Begin: %s" % (self._svc_display_name_)
+
+ hostport = ':8888'
+ print 'Starting py.execnet SocketServer on %s' % hostport
+ serversock = socketserver.bind_and_listen(hostport)
+ thread = threading.Thread(target=socketserver.startserver,
+ args=(serversock,),
+ kwargs={'loop':True})
+ thread.setDaemon(True)
+ thread.start()
+
+ # wait to be stopped or self.WAIT_TIME to pass
+ while True:
+ result = win32event.WaitForSingleObject(self.hWaitStop,
+ self.WAIT_TIME)
+ if result == win32event.WAIT_OBJECT_0:
+ break
+
+ # write a 'stopped' event to the event log.
+ win32evtlogutil.ReportEvent(self._svc_display_name_,
+ servicemanager.PYS_SERVICE_STOPPED,
+ 0, # category
+ servicemanager.EVENTLOG_INFORMATION_TYPE,
+ (self._svc_name_, ''))
+ print "End: %s" % appname
+
+
+if __name__ == '__main__':
+ # Note that this code will not be run in the 'frozen' exe-file!!!
+ win32serviceutil.HandleCommandLine(SocketServerService)
Modified: py/dist/py/misc/_dist.py
==============================================================================
--- py/dist/py/misc/_dist.py (original)
+++ py/dist/py/misc/_dist.py Sat Jan 13 08:18:32 2007
@@ -100,7 +100,7 @@
reg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE)
key = r"SYSTEM\CurrentControlSet\Control\Session Manager\Environment"
path = get_registry_value(reg, key, "Path")
- path += ";" + bindir
+ path += ";" + bindir
print "Setting PATH to:", path
set_registry_value(reg, key, "Path", path)
#print "Current PATH is:", get_registry_value(reg, key, "Path")
@@ -120,16 +120,16 @@
return value
def set_registry_value(reg, key, value_name, value):
- k = _winreg.OpenKey(reg, key, 0, _winreg.KEY_WRITE)
- value_type = _winreg.REG_SZ
- # if we handle the Path value, then set its type to REG_EXPAND_SZ
- # so that things like %SystemRoot% get automatically expanded by the
- # command prompt
- if value_name == "Path":
+ k = _winreg.OpenKey(reg, key, 0, _winreg.KEY_WRITE)
+ value_type = _winreg.REG_SZ
+ # if we handle the Path value, then set its type to REG_EXPAND_SZ
+ # so that things like %SystemRoot% get automatically expanded by the
+ # command prompt
+ if value_name == "Path":
value_type = _winreg.REG_EXPAND_SZ
_winreg.SetValueEx(k, value_name, 0, value_type, value)
_winreg.CloseKey(k)
-
+
### end helpers
def setup(pkg, **kw):
Modified: py/dist/py/path/local/testing/test_win.py
==============================================================================
--- py/dist/py/path/local/testing/test_win.py (original)
+++ py/dist/py/path/local/testing/test_win.py Sat Jan 13 08:18:32 2007
@@ -1,34 +1,34 @@
-import py
-
-class TestWINLocalPath:
- #root = local(TestLocalPath.root)
- disabled = py.std.sys.platform != 'win32'
-
- def setup_class(cls):
- cls.root = py.test.ensuretemp(cls.__name__)
-
- def setup_method(self, method):
- name = method.im_func.func_name
- self.tmpdir = self.root.ensure(name, dir=1)
-
- def test_chmod_simple_int(self):
- print "self.root is", self.root
- mode = self.root.stat().st_mode
- # Ensure that we actually change the mode to something different.
- self.root.chmod(mode == 0 and 1 or 0)
- try:
- print self.root.stat().st_mode
- print mode
- assert self.root.stat().st_mode != mode
- finally:
- self.root.chmod(mode)
- assert self.root.stat().st_mode == mode
-
- def test_allow_unix_style_paths(self):
- t1 = self.root.join('a_path')
- assert t1 == str(self.root) + '\\a_path'
- t1 = self.root.join('a_path/')
- assert t1 == str(self.root) + '\\a_path'
- t1 = self.root.join('dir/a_path')
- assert t1 == str(self.root) + '\\dir\\a_path'
-
+import py
+
+class TestWINLocalPath:
+ #root = local(TestLocalPath.root)
+ disabled = py.std.sys.platform != 'win32'
+
+ def setup_class(cls):
+ cls.root = py.test.ensuretemp(cls.__name__)
+
+ def setup_method(self, method):
+ name = method.im_func.func_name
+ self.tmpdir = self.root.ensure(name, dir=1)
+
+ def test_chmod_simple_int(self):
+ print "self.root is", self.root
+ mode = self.root.stat().st_mode
+ # Ensure that we actually change the mode to something different.
+ self.root.chmod(mode == 0 and 1 or 0)
+ try:
+ print self.root.stat().st_mode
+ print mode
+ assert self.root.stat().st_mode != mode
+ finally:
+ self.root.chmod(mode)
+ assert self.root.stat().st_mode == mode
+
+ def test_allow_unix_style_paths(self):
+ t1 = self.root.join('a_path')
+ assert t1 == str(self.root) + '\\a_path'
+ t1 = self.root.join('a_path/')
+ assert t1 == str(self.root) + '\\a_path'
+ t1 = self.root.join('dir/a_path')
+ assert t1 == str(self.root) + '\\dir\\a_path'
+
More information about the pytest-commit
mailing list