diff options
author | Sylvain <syt@logilab.fr> | 2009-03-04 11:54:23 +0100 |
---|---|---|
committer | Sylvain <syt@logilab.fr> | 2009-03-04 11:54:23 +0100 |
commit | b2a6afa68ec49734659ceeb7961218cf5f17b204 (patch) | |
tree | f810b5d258b2ee0defd451c26f2ef73ea9465dae /test/unittest_shellutils.py | |
parent | 1f235a7313bba3369d109bc1eb9996a6963ef134 (diff) | |
download | logilab-common-b2a6afa68ec49734659ceeb7961218cf5f17b204.tar.gz |
toward py3k
passing tests: unittest_shellutils, unittest_textutils, unittest_modutils, unittest_table, unittest_tree
Diffstat (limited to 'test/unittest_shellutils.py')
-rw-r--r-- | test/unittest_shellutils.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/test/unittest_shellutils.py b/test/unittest_shellutils.py index 17bc0e0..eec78d6 100644 --- a/test/unittest_shellutils.py +++ b/test/unittest_shellutils.py @@ -1,14 +1,14 @@ """unit tests for logilab.common.shellutils""" import sys, os, tempfile, shutil -from os.path import join import datetime, time +from os.path import join +from io import StringIO from logilab.common.testlib import TestCase, unittest_main - from logilab.common.shellutils import globfind, find, ProgressBar, acquire_lock, release_lock from logilab.common.proc import NoSuchProcess -from StringIO import StringIO + DATA_DIR = join('data','find_test') @@ -94,14 +94,15 @@ class ProgressBarTC(TestCase): dots, update = round else: dots, update = round, None + dots = int(dots) pgb.update() if update or (update is None and dots != last): last = dots - expected_stream.write("\r["+('.'*dots)+(' '*(size-dots))+"]") + expected_stream.write('\r[' + ('.'*dots) + (' '*(size-dots)) + ']') self.assertEquals(pgb_stream.getvalue(), expected_stream.getvalue()) def test_default(self): - self._update_test(20, xrange(1,21)) + self._update_test(20, range(1,21)) def test_nbops_gt_size(self): """Test the progress bar for nbops > size""" @@ -145,14 +146,14 @@ class AcquireLockTC(TestCase): def test_wrong_process(self): fd = os.open(self.lock, os.O_EXCL | os.O_RDWR | os.O_CREAT) - os.write(fd, '1111111111') + os.write(fd, b'1111111111') os.close(fd) self.assertTrue(os.path.exists(self.lock)) self.assertRaises(Exception, acquire_lock, self.lock, 1, 1) def test_wrong_process_and_continue(self): fd = os.open(self.lock, os.O_EXCL | os.O_RDWR | os.O_CREAT) - os.write(fd, '1111111111') + os.write(fd, b'1111111111') os.close(fd) self.assertTrue(os.path.exists(self.lock)) self.assertTrue(acquire_lock(self.lock)) |