Beispiel #1
0
    def test_find_files(self):
        # making sure we scan a project dir correctly
        mainprogram = MainProgram()

        # building the structure
        tempdir = self.wdir
        dirs = ['pkg1', 'data', 'pkg2', 'pkg2/sub']
        files = [
            'README',
            'data/data1',
            'foo.py',
            'pkg1/__init__.py',
            'pkg1/bar.py',
            'pkg2/__init__.py',
            'pkg2/sub/__init__.py',
        ]

        for dir_ in dirs:
            os.mkdir(os.path.join(tempdir, dir_))

        for file_ in files:
            self.write_file((tempdir, file_), 'xxx')

        mainprogram._find_files()
        mainprogram.data['packages'].sort()

        # do we have what we want?
        self.assertEqual(mainprogram.data['packages'],
                         ['pkg1', 'pkg2', 'pkg2.sub'])
        self.assertEqual(mainprogram.data['modules'], ['foo'])
        data_fn = os.path.join('data', 'data1')
        self.assertEqual(mainprogram.data['extra_files'],
                         ['README', data_fn])
    def test_find_files(self):
        # making sure we scan a project dir correctly
        mainprogram = MainProgram()

        # building the structure
        tempdir = self.wdir
        dirs = ['pkg1', 'data', 'pkg2', 'pkg2/sub']
        files = [
            'README',
            'data/data1',
            'foo.py',
            'pkg1/__init__.py',
            'pkg1/bar.py',
            'pkg2/__init__.py',
            'pkg2/sub/__init__.py',
        ]

        for dir_ in dirs:
            os.mkdir(os.path.join(tempdir, dir_))

        for file_ in files:
            self.write_file((tempdir, file_), 'xxx')

        mainprogram._find_files()
        mainprogram.data['packages'].sort()

        # do we have what we want?
        self.assertEqual(mainprogram.data['packages'],
                         ['pkg1', 'pkg2', 'pkg2.sub'])
        self.assertEqual(mainprogram.data['modules'], ['foo'])
        data_fn = os.path.join('data', 'data1')
        self.assertEqual(mainprogram.data['extra_files'],
                         ['README', data_fn])
Beispiel #3
0
 def test_set_multi(self):
     mainprogram = MainProgram()
     create.raw_input = Inputs('aaaaa')
     mainprogram.data['author'] = []
     mainprogram._set_multi('_set_multi test', 'author')
     self.assertEqual(['aaaaa'], mainprogram.data['author'])
 def test_set_multi(self):
     mainprogram = MainProgram()
     create.input = Inputs('aaaaa')
     mainprogram.data['author'] = []
     mainprogram._set_multi('_set_multi test', 'author')
     self.assertEqual(['aaaaa'], mainprogram.data['author'])