holger krekel avatar holger krekel committed 134b3fc Merge


Comments (0)

Files changed (7)

 the following tools and modules:
 * py.path:  uniform local and svn path objects
+* py.apipkg:  explicit API control and lazy-importing
+* py.iniconfig:  easy parsing of .ini files
 * py.code: dynamic code generation and introspection
 * py.path:  uniform local and svn path objects
 (c) Holger Krekel and others, 2004-2010
-__version__ = '2.0.0.dev3'
+__version__ = '2.0.0.dev4'
 from py import _apipkg
 """ brain-dead simple parser for ini-style files.
 (C) Ronny Pfannschmidt, Holger Krekel -- MIT licensed
-__version__ = "0.2.dev0"
+__version__ = "0.2.dev2"
 __all__ = ['IniConfig', 'ParseError']
         self.config = config
         self.name = name
+    def lineof(self, name):
+        return self.config.lineof(self.name, name)
     def get(self, key, default=None, convert=str):
         return self.config.get(self.name, key, convert=convert, default=default)
         long_description = long_description,
         install_requires=['py>=1.3.9', ], # force newer py version which removes 'py' namespace
         #                                  # so we can occupy it
-        version='2.0.0.dev3',
+        version='2.0.0.dev4',
         license='MIT license',
         platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],


         if request.param == "path":
             tmpdir = request.getfuncargvalue("tmpdir")
             p = tmpdir.join("tmpfile")
-            tw = py.io.TerminalWriter(p.open('w+'))
+            import codecs
+            f = codecs.open(str(p), 'w+', encoding='utf8')
+            tw = py.io.TerminalWriter(f)
             def getlines():
                 return p.open('r').readlines()


 import py
-from py.iniconfig import IniConfig, ParseError
+from py._iniconfig import IniConfig, ParseError, __all__ as ALL
 from textwrap import dedent
 def pytest_generate_tests(metafunc):
     assert config.lineof('section2') == 3
     assert config.lineof('section', 'value') == 2
     assert config.lineof('section2','value') == 5
+    assert config['section'].lineof('value') == 2
+    assert config['section2'].lineof('value') == 5
 def test_iniconfig_get_convert():
     config= IniConfig("x", data='[section]\nint = 1\nfloat = 1.1')
     assert ['repository', 'username', 'password'] == list(other)
+def test_api_import():
+    assert ALL == ['IniConfig', 'ParseError']
     default http://pypi.testrun.org
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.