[narval/debcheck] use a glob instead of a recursive os.walk to find *.changes
We know where those files are, there's no need to do a recursive search.
This also avoids issues with os.walk with non-ascii file names.
***
#!/usr/bin/python
"""unit tests for the apycotlib.writer module"""
import os
from logilab.common.testlib import TestCase, unittest_main
import cubicweb.devtools
import cubes.apycot.testutils
from apycotlib.writer import BaseDataWriter
class BaseDataWriterTC(TestCase):
def setUp(self):
self.writer = BaseDataWriter(None, 1)
def test__msg_info_01(self):
path, line, msg = self.writer._msg_info('bonjour %s', 'vous')
self.assertEqual(path, None)
self.assertEqual(line, None)
self.assertEqual(msg, 'bonjour vous')
def test__msg_info_02(self):
path, line, msg = self.writer._msg_info('bonjour %s', 'vous', path='/tmp', line=1)
self.assertEqual(path, '/tmp')
self.assertEqual(line, 1)
self.assertEqual(msg, 'bonjour vous')
def test__msg_info_03(self):
try:
os.path.isdir(1)
except:
path, line, msg = self.writer._msg_info('oops %s', 'badaboum', tb=True)
self.assertEqual(path, None)
self.assertEqual(line, None)
self.assertTrue(msg.startswith('oops badaboum'))
self.assertTrue('Traceback' in msg)
if __name__ == '__main__':
unittest_main()