summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTarek Ziadé <ziade.tarek@gmail.com>2009-07-03 19:01:12 (GMT)
committerTarek Ziadé <ziade.tarek@gmail.com>2009-07-03 19:01:12 (GMT)
commiteea9d0d846cef3299ed2c898b4edb4a871ca2d57 (patch)
tree45250f773199845e583122e4f34433d502585c93
parent1e139607271c578fb480048bc5311f8bd233436c (diff)
downloadcpython-eea9d0d846cef3299ed2c898b4edb4a871ca2d57.zip
cpython-eea9d0d846cef3299ed2c898b4edb4a871ca2d57.tar.gz
cpython-eea9d0d846cef3299ed2c898b4edb4a871ca2d57.tar.bz2
basic tests to raise distutils.file_util coverage
-rw-r--r--Lib/distutils/tests/test_file_util.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/Lib/distutils/tests/test_file_util.py b/Lib/distutils/tests/test_file_util.py
index fac4a5d..99b421f 100644
--- a/Lib/distutils/tests/test_file_util.py
+++ b/Lib/distutils/tests/test_file_util.py
@@ -3,7 +3,7 @@ import unittest
import os
import shutil
-from distutils.file_util import move_file
+from distutils.file_util import move_file, write_file, copy_file
from distutils import log
from distutils.tests import support
@@ -55,6 +55,21 @@ class FileUtilTestCase(support.TempdirManager, unittest.TestCase):
wanted = ['moving %s -> %s' % (self.source, self.target_dir)]
self.assertEquals(self._logs, wanted)
+ def test_write_file(self):
+ lines = ['a', 'b', 'c']
+ dir = self.mkdtemp()
+ foo = os.path.join(dir, 'foo')
+ write_file(foo, lines)
+ content = [line.strip() for line in open(foo).readlines()]
+ self.assertEquals(content, lines)
+
+ def test_copy_file(self):
+ src_dir = self.mkdtemp()
+ foo = os.path.join(src_dir, 'foo')
+ write_file(foo, 'content')
+ dst_dir = self.mkdtemp()
+ copy_file(foo, dst_dir)
+ self.assertTrue(os.path.exists(os.path.join(dst_dir, 'foo')))
def test_suite():
return unittest.makeSuite(FileUtilTestCase)