[py-svn] r38548 - in py/trunk/py/test: . rsession terminal testing

hpk at codespeak.net hpk at codespeak.net
Mon Feb 12 13:18:25 CET 2007


Author: hpk
Date: Mon Feb 12 13:18:23 2007
New Revision: 38548

Modified:
   py/trunk/py/test/config.py
   py/trunk/py/test/rsession/slave.py
   py/trunk/py/test/terminal/remote.py
   py/trunk/py/test/testing/test_config.py
Log:
carefully privatizing Config.make_repr and Config.merge_repr
by doing a whole-pylib replace and reviewing the diff in detail


Modified: py/trunk/py/test/config.py
==============================================================================
--- py/trunk/py/test/config.py	(original)
+++ py/trunk/py/test/config.py	Mon Feb 12 13:18:23 2007
@@ -56,7 +56,7 @@
         assert not self._initialized
         self._initialized = True
         self.topdir = py.path.local(topdir)
-        self.merge_repr(repr)
+        self._mergerepr(repr)
         self._coltrails = coltrails 
 
     def getcolitems(self):
@@ -189,7 +189,7 @@
         finally: 
             config_per_process = py.test.config = oldconfig 
 
-    def make_repr(self, conftestnames, optnames=None): 
+    def _makerepr(self, conftestnames, optnames=None): 
         """ return a marshallable representation 
             of conftest and cmdline options. 
             if optnames is None, all options
@@ -214,10 +214,10 @@
             l.append(path.relto(self.topdir)) 
         return l, conftestdict, cmdlineopts
 
-    def merge_repr(self, repr): 
+    def _mergerepr(self, repr): 
         """ merge in the conftest and cmdline option values
             found in the given representation (produced
-            by make_repr above).  
+            by _makerepr above).  
 
             The repr-contained conftest values are
             stored on the default conftest module (last

Modified: py/trunk/py/test/rsession/slave.py
==============================================================================
--- py/trunk/py/test/rsession/slave.py	(original)
+++ py/trunk/py/test/rsession/slave.py	Mon Feb 12 13:18:23 2007
@@ -70,7 +70,7 @@
 defaultconftestnames = ['dist_nicelevel']
 def setup_slave(host, config): 
     channel = host.gw.remote_exec(str(py.code.Source(setup, "setup()")))
-    configrepr = config.make_repr(defaultconftestnames)
+    configrepr = config._makerepr(defaultconftestnames)
     #print "sending configrepr", configrepr
     topdir = host.gw_remotepath 
     if topdir is None:

Modified: py/trunk/py/test/terminal/remote.py
==============================================================================
--- py/trunk/py/test/terminal/remote.py	(original)
+++ py/trunk/py/test/terminal/remote.py	Mon Feb 12 13:18:23 2007
@@ -104,7 +104,7 @@
         """, stdout=self.out, stderr=self.out) 
         try:
             print "MASTER: initiated slave terminal session ->"
-            repr = self.config.make_repr(conftestnames=[])
+            repr = self.config._makerepr(conftestnames=[])
             channel.send((str(topdir), repr, failures))
             print "MASTER: send start info, topdir=%s" % (topdir,)
             try:

Modified: py/trunk/py/test/testing/test_config.py
==============================================================================
--- py/trunk/py/test/testing/test_config.py	(original)
+++ py/trunk/py/test/testing/test_config.py	Mon Feb 12 13:18:23 2007
@@ -128,7 +128,7 @@
     tmp.ensure("conftest.py").write("x=1 ; y=2")
     hello = tmp.ensure("test_hello.py")
     config = py.test.config._reparse([hello])
-    repr = config.make_repr(conftestnames=['x', 'y'])
+    repr = config._makerepr(conftestnames=['x', 'y'])
     config2 = py.test.config._reparse([tmp.dirpath()])
     config2._initialized = False # we have to do that from tests
     config2.initdirect(topdir=tmp.dirpath(), repr=repr)
@@ -148,19 +148,19 @@
     assert col.parent.name == tmp.basename 
     assert col.parent.parent is None 
 
-def test_config_make_and_merge_repr():
+def test_config_make_and__mergerepr():
     tmp = py.test.ensuretemp("reprconfig1")
     tmp.ensure("__init__.py")
     tmp.ensure("conftest.py").write("x=1")
     config = py.test.config._reparse([tmp])
-    repr = config.make_repr(conftestnames=['x'])
+    repr = config._makerepr(conftestnames=['x'])
     config.option.verbose = 42
-    repr2 = config.make_repr(conftestnames=[], optnames=['verbose'])
+    repr2 = config._makerepr(conftestnames=[], optnames=['verbose'])
     config = py.test.config._reparse([tmp.dirpath()])
     py.test.raises(KeyError, "config.getvalue('x')")
-    config.merge_repr(repr)
+    config._mergerepr(repr)
     assert config.getvalue('x') == 1
-    config.merge_repr(repr2) 
+    config._mergerepr(repr2) 
     assert config.option.verbose == 42
 
 def test_config_marshability():
@@ -168,11 +168,11 @@
     tmp.ensure("__init__.py")
     tmp.ensure("conftest.py").write("a = object()")
     config = py.test.config._reparse([tmp])
-    py.test.raises(ValueError, "config.make_repr(conftestnames=['a'])")
+    py.test.raises(ValueError, "config._makerepr(conftestnames=['a'])")
 
     config.option.hello = lambda x: None
-    py.test.raises(ValueError, "config.make_repr(conftestnames=[])")
-    config.make_repr(conftestnames=[], optnames=[])
+    py.test.raises(ValueError, "config._makerepr(conftestnames=[])")
+    config._makerepr(conftestnames=[], optnames=[])
 
 def test_config_rconfig():
     tmp = py.test.ensuretemp("rconfigopt")
@@ -186,10 +186,10 @@
     """))
     config = py.test.config._reparse([tmp, "-G", "11"])
     assert config.option.gdest == 11
-    repr = config.make_repr(conftestnames=[])
+    repr = config._makerepr(conftestnames=[])
     config = py.test.config._reparse([tmp.dirpath()])
     py.test.raises(AttributeError, "config.option.gdest")
-    config.merge_repr(repr) 
+    config._mergerepr(repr) 
     assert config.option.gdest == 11
 
 class TestSessionAndOptions: 



More information about the pytest-commit mailing list