Commits

holger krekel  committed ae4477d

update test config, introduce -g/--glob pattern option.

  • Participants
  • Parent commits ca49310

Comments (0)

Files changed (6)

+
+1.1
+==================================================
+
+- introduce -g/--glob PATTERN to allow to modify which files are searched
 
 1.0
 ==================================================

File pycmd/__init__.py

 #
 #
 
-__version__ = '1.0'
+__version__ = "1.0a2"
 
-from py import apipkg
+from py.apipkg import initpkg
 
-apipkg.initpkg(__name__, dict(
+initpkg(__name__, dict(
     pylookup    = '.pylookup:main',
     pycountloc  = '.pycountloc:main',
     pycleanup   = '.pycleanup:main',

File pycmd/pylookup.py

                   help="ignore case distinctions")
 parser.add_option("-C", "--context", action="store", type="int", dest="context",
             default=0, help="How many lines of output to show")
+parser.add_option("-g", "--glob", action="store", type="string", dest="glob",
+            default="*.py",
+            help="glob-pattern for which files to consider")
 
 terminal_width = get_terminal_width()
 
         string = args[0]
     if options.ignorecase:
         string = string.lower()
-    for x in search_dir.visit('*.py', rec):
+
+    for x in search_dir.visit(options.glob, rec):
         # match filename directly
         s = x.relto(search_dir)
         if options.ignorecase:
         name='pycmd',
         description='pycmd: tools for managing/searching Python related files.',
         long_description = open('README.txt').read(),
-        version='1.0',
+        version= '1.0.a2dev1',
         license='MIT license',
         platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
         author='holger krekel and others',
             "py.convert_unittest = pycmd:pyconvert_unittest",
             "py.svnwcrevert= pycmd:pysvnwcrevert",
         ]},
-        install_requires=['py>=1.4.0a2',],
+        install_requires=['py>=1.4.9',],
         classifiers=['Development Status :: 6 - Mature',
                      'Intended Audience :: Developers',
                      'License :: OSI Approved :: MIT License',
     )
 
 if __name__ == '__main__':
-    main()
+    main()
+

File test_pycmd.py

             ['*%s:*' %(p.basename)]
         )
 
+    def test_glob(self, testdir):
+        p = testdir.maketxtfile(hello="world")
+        result = testdir.run("py.lookup", "-g*.txt", "world")
+        result.stdout.fnmatch_lines(
+            ['*%s:*' %(p.basename)]
+        )
+
     def test_with_explicit_path(self, testdir):
         sub1 = testdir.mkdir("things")
         sub2 = testdir.mkdir("foo")
 [tox]
-envlist=py24,py26,py27,py31
-indexserver=default=http://pypi.testrun.org
+envlist=py26,py27,py33
 
 [testenv]
 commands=py.test -rfsxX --junitxml={envlogdir}/junit-{envname}.xml []