コード例 #1
0
    def test_dump_file(self):
        this_file = os.path.splitext(__file__)[0] + '.py'
        f = open(this_file)
        try:
            numlines = len(f.readlines())
        finally:
            f.close()

        dump_file(this_file, 'I am the header')
        self.assertEqual(len(self._logs), numlines+1)
コード例 #2
0
    def test_dump_file(self):
        this_file = __file__.rstrip('co')
        with open(this_file) as f:
            numlines = len(f.readlines())

        dump_file(this_file, 'I am the header')

        logs = []
        for log in self.get_logs(logging.INFO):
            logs.extend(line for line in log.split('\n'))
        self.assertEqual(len(logs), numlines + 2)
コード例 #3
0
    def test_dump_file(self):
        this_file = __file__.rstrip('co')
        f = open(this_file)
        try:
            numlines = len(f.readlines())
        finally:
            f.close()

        dump_file(this_file, 'I am the header')

        logs = []
        for log in self.get_logs(logging.INFO):
            logs.extend(line for line in log.split('\n'))
        self.assertEqual(len(logs), numlines + 2)