root / logilab.pylintinstaller / logilab / common / test / unittest_shellutils.py

Revision 202:d67e86292521, 2.0 kB (checked in by tziade@…, 11 months ago)

added logilab.pylintinstaller

Line 
1"""unit tests for logilab.common.shellutils"""
2
3import sys, os, tempfile, shutil
4from os.path import join
5
6from logilab.common.testlib import TestCase, unittest_main
7
8from logilab.common.fileutils import *
9
10DATA_DIR = 'data'
11
12class FindTC(TestCase):
13    def test_include(self):
14        files = find(DATA_DIR, '.py')
15        self.assertSetEqual(files,
16                            [join('data', f) for f in ['__init__.py', 'module.py',
17                                                       'module2.py', 'noendingnewline.py',
18                                                       'nonregr.py', join('sub', 'momo.py')]])
19        files = find(DATA_DIR, ('.py',), blacklist=('sub',))
20        self.assertSetEqual(files,
21                            [join('data', f) for f in ['__init__.py', 'module.py',
22                                                       'module2.py', 'noendingnewline.py',
23                                                       'nonregr.py']])
24       
25    def test_exclude(self):
26        files = find(DATA_DIR, ('.py', '.pyc'), exclude=True)
27        self.assertSetEqual(files,
28                            [join('data', f) for f in ['foo.txt',
29                                                       'newlines.txt',
30                                                       'normal_file.txt',
31                                                       'test.ini',
32                                                       'test1.msg',
33                                                       'test2.msg',
34                                                       'spam.txt',
35                                                       join('sub', 'doc.txt'),
36                                                       'write_protected_file.txt',
37                                                       ]])
38       
39#    def test_exclude_base_dir(self):
40#        self.assertEquals(files_by_ext(DATA_DIR, include_exts=('.py',), exclude_dirs=(DATA_DIR,)),
41#                          [])
42
43if __name__ == '__main__':
44    unittest_main()
Note: See TracBrowser for help on using the browser.