[py-svn] r36942 - in py/branch/config/py/test: . testing
hpk at codespeak.net
hpk at codespeak.net
Thu Jan 18 16:08:08 CET 2007
Author: hpk
Date: Thu Jan 18 16:08:06 2007
New Revision: 36942
Modified:
py/branch/config/py/test/config.py
py/branch/config/py/test/testing/test_config.py
Log:
group things used for testing and not use non-underscore
names (otherwise they are consdiered public and
are possibly seen from apigen through py.test.config!)
Modified: py/branch/config/py/test/config.py
==============================================================================
--- py/branch/config/py/test/config.py (original)
+++ py/branch/config/py/test/config.py Thu Jan 18 16:08:06 2007
@@ -33,7 +33,7 @@
self._parser = optparse.OptionParser(
usage="usage: %prog [options] [query] [filenames of tests]")
self._parsed = False
- self.overwrite_dict = {}
+ self._overwrite_dict = {}
def parse(self, args):
""" parse cmdline arguments into this config object.
@@ -65,11 +65,6 @@
setattr(self.option, opt.dest, opt.default)
return self.option
- def overwrite(self, name, value):
- """ Overwrite value for an option. Very usefull when testing
- """
- self.overwrite_dict[name] = value
-
def getvalue(self, name, path=None):
""" return 'name' value looked up from the first conftest file
found up the path (including the path itself).
@@ -77,7 +72,7 @@
conftest modules found during command line parsing.
"""
try:
- return self.overwrite_dict[name]
+ return self._overwrite_dict[name]
except KeyError:
return self.conftest.rget(name, path)
@@ -99,8 +94,6 @@
""" this is used from tests that want to re-invoke parse(). """
global config
oldconfig = py.test.config
- # we should not keep this values forever
- self.overwrite_dict = {}
try:
config = py.test.config = Config()
config.parse(args)
@@ -108,6 +101,12 @@
finally:
config = py.test.config = oldconfig
+ def _overwrite(self, name, value):
+ """ this is used from tests to overwrite values irrespectives of conftests.
+ """
+ self._overwrite_dict[name] = value
+
+
# this is the one per-process instance of py.test configuration
config = Config()
Modified: py/branch/config/py/test/testing/test_config.py
==============================================================================
--- py/branch/config/py/test/testing/test_config.py (original)
+++ py/branch/config/py/test/testing/test_config.py Thu Jan 18 16:08:06 2007
@@ -78,7 +78,7 @@
o.ensure("conftest.py").write("x=1")
config = py.test.config._reparse([str(o)])
assert config.getvalue('x') == 1
- config.overwrite('x', 2)
+ config._overwrite('x', 2)
assert config.getvalue('x') == 2
config = py.test.config._reparse([str(o)])
assert config.getvalue('x') == 1
More information about the pytest-commit
mailing list