mirror of
https://github.com/gryf/fs-uae-wrapper.git
synced 2025-12-27 08:52:36 +01:00
Moved which function to another module
This commit is contained in:
@@ -60,13 +60,7 @@ class TestArchive(TestCase):
|
||||
self.assertFalse(arch.extract('foo'))
|
||||
call.assert_called_once_with(['false', 'x', 'foo'])
|
||||
|
||||
def test_archive_which(self):
|
||||
self.assertEqual(file_archive.which('sh'), 'sh')
|
||||
self.assertIsNone(file_archive.which('blahblahexec'))
|
||||
self.assertEqual(file_archive.which(['blahblahexec', 'pip', 'sh']),
|
||||
'pip')
|
||||
|
||||
@mock.patch('fs_uae_wrapper.file_archive.which')
|
||||
@mock.patch('fs_uae_wrapper.path.which')
|
||||
@mock.patch('subprocess.call')
|
||||
def test_tar(self, call, which):
|
||||
with open('foo', 'w') as fobj:
|
||||
@@ -122,7 +116,7 @@ class TestArchive(TestCase):
|
||||
self.assertFalse(arch.extract('foo'))
|
||||
call.assert_called_once_with(['tar', 'xf', 'foo'])
|
||||
|
||||
@mock.patch('fs_uae_wrapper.file_archive.which')
|
||||
@mock.patch('fs_uae_wrapper.path.which')
|
||||
@mock.patch('subprocess.call')
|
||||
def test_lha(self, call, which):
|
||||
with open('foo', 'w') as fobj:
|
||||
@@ -142,7 +136,7 @@ class TestArchive(TestCase):
|
||||
self.assertFalse(arch.extract('foo'))
|
||||
call.assert_called_once_with(['lha', 'x', 'foo'])
|
||||
|
||||
@mock.patch('fs_uae_wrapper.file_archive.which')
|
||||
@mock.patch('fs_uae_wrapper.path.which')
|
||||
@mock.patch('subprocess.call')
|
||||
def test_lzx(self, call, which):
|
||||
with open('foo', 'w') as fobj:
|
||||
@@ -162,7 +156,7 @@ class TestArchive(TestCase):
|
||||
self.assertFalse(arch.extract('foo'))
|
||||
call.assert_called_once_with(['unlzx', '-x', 'foo'])
|
||||
|
||||
@mock.patch('fs_uae_wrapper.file_archive.which')
|
||||
@mock.patch('fs_uae_wrapper.path.which')
|
||||
@mock.patch('subprocess.call')
|
||||
def test_7zip(self, call, which):
|
||||
with open('foo', 'w') as fobj:
|
||||
@@ -182,7 +176,7 @@ class TestArchive(TestCase):
|
||||
self.assertFalse(arch.extract('foo'))
|
||||
call.assert_called_once_with(['7z', 'x', 'foo'])
|
||||
|
||||
@mock.patch('fs_uae_wrapper.file_archive.which')
|
||||
@mock.patch('fs_uae_wrapper.path.which')
|
||||
@mock.patch('subprocess.call')
|
||||
def test_zip(self, call, which):
|
||||
with open('foo', 'w') as fobj:
|
||||
@@ -202,7 +196,7 @@ class TestArchive(TestCase):
|
||||
self.assertFalse(arch.extract('foo'))
|
||||
call.assert_called_once_with(['7z', 'x', 'foo'])
|
||||
|
||||
@mock.patch('fs_uae_wrapper.file_archive.which')
|
||||
@mock.patch('fs_uae_wrapper.path.which')
|
||||
@mock.patch('subprocess.call')
|
||||
def test_rar(self, call, which):
|
||||
|
||||
|
||||
12
tests/test_path.py
Normal file
12
tests/test_path.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from unittest import TestCase
|
||||
|
||||
from fs_uae_wrapper import path
|
||||
|
||||
|
||||
class TestPath(TestCase):
|
||||
|
||||
def test_which(self):
|
||||
self.assertEqual(path.which('sh'), 'sh')
|
||||
self.assertIsNone(path.which('blahblahexec'))
|
||||
self.assertEqual(path.which(['blahblahexec', 'pip', 'sh']),
|
||||
'pip')
|
||||
Reference in New Issue
Block a user