[py-svn] r36893 - in py/branch/conftest/py/test: . testing

hpk at codespeak.net hpk at codespeak.net
Wed Jan 17 20:34:05 CET 2007


Author: hpk
Date: Wed Jan 17 20:34:04 2007
New Revision: 36893

Modified:
   py/branch/conftest/py/test/config.py
   py/branch/conftest/py/test/testing/test_config.py
Log:
test that trying to parse twice into a config object fails


Modified: py/branch/conftest/py/test/config.py
==============================================================================
--- py/branch/conftest/py/test/config.py	(original)
+++ py/branch/conftest/py/test/config.py	Wed Jan 17 20:34:04 2007
@@ -27,12 +27,12 @@
     """ central hub for dealing with configuration/initialization data. """ 
     Option = optparse.Option
     conftest = Conftest()
-    _parsed = False
 
     def __init__(self): 
         self.option = CmdOptions()
         self._parser = optparse.OptionParser(
             usage="usage: %prog [options] [query] [filenames of tests]")
+        self._parsed = False
 
     def parse(self, args): 
         """ parse cmdline arguments into this config object. 

Modified: py/branch/conftest/py/test/testing/test_config.py
==============================================================================
--- py/branch/conftest/py/test/testing/test_config.py	(original)
+++ py/branch/conftest/py/test/testing/test_config.py	Wed Jan 17 20:34:04 2007
@@ -29,6 +29,11 @@
         old.chdir() 
     assert config.option.gdest == 17 
 
+def test_parsing_again_fails():
+    dir = py.test.ensuretemp("parsing_again_fails")
+    config, args = py.test.config._reparse([str(dir)])
+    py.test.raises(AssertionError, "config.parse([])")
+
 def test_config_getvalue_honours_conftest():
     o = py.test.ensuretemp('testconfigget') 
     o.ensure("conftest.py").write("x=1")



More information about the pytest-commit mailing list