[py-svn] r36954 - py/branch/config/py/test/rsession/testing
fijal at codespeak.net
fijal at codespeak.net
Thu Jan 18 17:25:08 CET 2007
Author: fijal
Date: Thu Jan 18 17:25:06 2007
New Revision: 36954
Modified:
py/branch/config/py/test/rsession/testing/test_rconfig.py
Log:
Add a test for rconfig module
Modified: py/branch/config/py/test/rsession/testing/test_rconfig.py
==============================================================================
--- py/branch/config/py/test/rsession/testing/test_rconfig.py (original)
+++ py/branch/config/py/test/rsession/testing/test_rconfig.py Thu Jan 18 17:25:06 2007
@@ -1,6 +1,36 @@
-""" empty module for now, will probably have some content soon
+""" testing of remote config
"""
import py
+from py.__.test.rsession.rconfig import RConfig, make_repr
+def test_basic_rconfig():
+ tmp = py.test.ensuretemp("rconfig")
+ tmp.ensure("__init__.py")
+ tmp.ensure("conftest.py").write(py.code.Source("""
+ x = 1
+ """))
+ config = py.test.config._reparse([str(tmp)])
+ repr = make_repr(config, to_send=['x'])
+ rconfig = RConfig(repr)
+ assert rconfig.getvalue('x') == 1
+
+def test_option_rconfig():
+ tmp = py.test.ensuretemp("rconfigopt")
+ tmp.ensure("__init__.py")
+ tmp.ensure("conftest.py").write(py.code.Source("""
+ import py
+ Option = py.test.config.Option
+ option = py.test.config.addoptions("testing group",
+ Option('-g', '--glong', action="store", default=42,
+ type="int", dest="gdest", help="g value."))
+ """))
+ config = py.test.config._reparse([str(tmp)])
+ repr = make_repr(config, to_send=['x'])
+ rconfig = RConfig(repr)
+ assert rconfig.option.g == 42
+ config = py.test.config._reparse([str(tmp), "-g", "11"])
+ repr = make_repr(config, to_send=['x'])
+ rconfig = RConfig(repr)
+ assert rconfig.option.g == 11
More information about the pytest-commit
mailing list