|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import os |
|
import shutil |
|
import socket |
|
import tempfile |
|
|
|
from s3transfer.utils import OSUtils |
|
from tests import skip_if_windows, unittest |
|
|
|
|
|
@skip_if_windows('Windows does not support UNIX special files') |
|
class TestOSUtilsSpecialFiles(unittest.TestCase): |
|
def setUp(self): |
|
self.tempdir = tempfile.mkdtemp() |
|
self.filename = os.path.join(self.tempdir, 'myfile') |
|
|
|
def tearDown(self): |
|
shutil.rmtree(self.tempdir) |
|
|
|
def test_character_device(self): |
|
self.assertTrue(OSUtils().is_special_file('/dev/null')) |
|
|
|
def test_fifo(self): |
|
os.mkfifo(self.filename) |
|
self.assertTrue(OSUtils().is_special_file(self.filename)) |
|
|
|
def test_socket(self): |
|
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) |
|
sock.bind(self.filename) |
|
self.assertTrue(OSUtils().is_special_file(self.filename)) |
|
|