Files
@ 110c68468203
Branch filter:
Location: rattail-project/rattail/tests/test_files.py - annotation
110c68468203
1004 B
text/x-python
Update changelog
6f43cfd4d923 5aaf50e5b9bc 6f43cfd4d923 92c03f5d8db0 5aaf50e5b9bc ebd65a8ef921 ebd65a8ef921 ebd65a8ef921 5aaf50e5b9bc 5aaf50e5b9bc 5aaf50e5b9bc 5aaf50e5b9bc 5aaf50e5b9bc 5aaf50e5b9bc ebd65a8ef921 5aaf50e5b9bc 5aaf50e5b9bc ebd65a8ef921 ebd65a8ef921 ebd65a8ef921 ebd65a8ef921 ebd65a8ef921 ebd65a8ef921 ebd65a8ef921 ebd65a8ef921 ebd65a8ef921 ebd65a8ef921 ebd65a8ef921 ebd65a8ef921 ebd65a8ef921 ebd65a8ef921 5aaf50e5b9bc 5aaf50e5b9bc ebd65a8ef921 ebd65a8ef921 5aaf50e5b9bc 5aaf50e5b9bc ebd65a8ef921 | # -*- coding: utf-8; -*-
from __future__ import unicode_literals, absolute_import
import os
import shutil
import tempfile
import unittest
import lockfile
from rattail import files
class TestLockingCopy(unittest.TestCase):
def setUp(self):
self.tempdir = tempfile.mkdtemp()
self.srcdir = os.path.join(self.tempdir, 'src')
os.makedirs(self.srcdir)
self.dstdir = os.path.join(self.tempdir, 'dst')
os.makedirs(self.dstdir)
self.src_file = os.path.join(self.srcdir, 'somefile')
with open(self.src_file, 'wt') as f:
f.write('')
def tearDown(self):
shutil.rmtree(self.tempdir)
def test_normal_copy_succeeds(self):
files.locking_copy(self.src_file, self.dstdir)
dst_file = os.path.join(self.dstdir, 'somefile')
self.assertTrue(os.path.exists(dst_file))
self.assertTrue(os.path.isfile(dst_file))
self.assertFalse(os.path.exists(os.path.join(self.dstdir, 'somefile.lock')))
|