Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
avocado
提交
b06b87ec
A
avocado
项目概览
openeuler
/
avocado
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
avocado
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b06b87ec
编写于
12月 06, 2018
作者:
C
Caio Carrara
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'clebergnu/iso9660_selftests'
Signed-off-by:
N
Caio Carrara
<
ccarrara@redhat.com
>
上级
42f1623a
08a993a3
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
7 addition
and
45 deletion
+7
-45
selftests/unit/test_utils_iso9660.py
selftests/unit/test_utils_iso9660.py
+7
-45
未找到文件。
selftests/unit/test_utils_iso9660.py
浏览文件 @
b06b87ec
...
@@ -45,7 +45,7 @@ class Capabilities(unittest.TestCase):
...
@@ -45,7 +45,7 @@ class Capabilities(unittest.TestCase):
[
'non-existing'
,
'capabilities'
]))
[
'non-existing'
,
'capabilities'
]))
class
BaseIso9660
(
unittest
.
TestCase
):
class
BaseIso9660
(
object
):
"""
"""
Base class defining setup and tests for shared Iso9660 functionality
Base class defining setup and tests for shared Iso9660 functionality
...
@@ -58,12 +58,9 @@ class BaseIso9660(unittest.TestCase):
...
@@ -58,12 +58,9 @@ class BaseIso9660(unittest.TestCase):
self
.
iso
=
None
self
.
iso
=
None
self
.
tmpdir
=
tempfile
.
mkdtemp
(
prefix
=
"avocado_"
+
__name__
)
self
.
tmpdir
=
tempfile
.
mkdtemp
(
prefix
=
"avocado_"
+
__name__
)
def
basic_workflow
(
self
):
def
test_
basic_workflow
(
self
):
"""
"""
Check the basic Iso9660 workflow
Check the basic Iso9660 workflow
:warning: Make sure to include this in per-implementation tests
due to ast loader we can't just define a base-class.
"""
"""
self
.
assertEqual
(
self
.
iso
.
read
(
"file"
),
self
.
assertEqual
(
self
.
iso
.
read
(
"file"
),
b
"file content
\n
"
)
b
"file content
\n
"
)
...
@@ -75,12 +72,9 @@ class BaseIso9660(unittest.TestCase):
...
@@ -75,12 +72,9 @@ class BaseIso9660(unittest.TestCase):
@
unittest
.
skipIf
(
not
process
.
can_sudo
(
"mount"
),
@
unittest
.
skipIf
(
not
process
.
can_sudo
(
"mount"
),
"This test requires mount to run under sudo or root"
)
"This test requires mount to run under sudo or root"
)
def
mnt_dir_workflow
(
self
):
def
test_
mnt_dir_workflow
(
self
):
"""
"""
Check the mnt_dir functionality
Check the mnt_dir functionality
:warning: Make sure to include this in per-implementation tests
due to ast loader we can't just define a base-class.
"""
"""
base
=
self
.
iso
.
mnt_dir
base
=
self
.
iso
.
mnt_dir
dir_path
=
os
.
path
.
join
(
base
,
"Dir"
)
dir_path
=
os
.
path
.
join
(
base
,
"Dir"
)
...
@@ -100,7 +94,7 @@ class BaseIso9660(unittest.TestCase):
...
@@ -100,7 +94,7 @@ class BaseIso9660(unittest.TestCase):
shutil
.
rmtree
(
self
.
tmpdir
)
shutil
.
rmtree
(
self
.
tmpdir
)
class
IsoInfo
(
BaseIso9660
):
class
IsoInfo
(
BaseIso9660
,
unittest
.
TestCase
):
"""
"""
IsoInfo-based check
IsoInfo-based check
...
@@ -112,16 +106,8 @@ class IsoInfo(BaseIso9660):
...
@@ -112,16 +106,8 @@ class IsoInfo(BaseIso9660):
super
(
IsoInfo
,
self
).
setUp
()
super
(
IsoInfo
,
self
).
setUp
()
self
.
iso
=
iso9660
.
Iso9660IsoInfo
(
self
.
iso_path
)
self
.
iso
=
iso9660
.
Iso9660IsoInfo
(
self
.
iso_path
)
def
test_basic_workflow
(
self
):
"""Call the basic workflow"""
self
.
basic_workflow
()
def
test_mnt_dir
(
self
):
"""Use the mnt_dir property"""
self
.
mnt_dir_workflow
()
class
IsoRead
(
BaseIso9660
):
class
IsoRead
(
BaseIso9660
,
unittest
.
TestCase
):
"""
"""
IsoRead-based check
IsoRead-based check
...
@@ -133,16 +119,8 @@ class IsoRead(BaseIso9660):
...
@@ -133,16 +119,8 @@ class IsoRead(BaseIso9660):
super
(
IsoRead
,
self
).
setUp
()
super
(
IsoRead
,
self
).
setUp
()
self
.
iso
=
iso9660
.
Iso9660IsoRead
(
self
.
iso_path
)
self
.
iso
=
iso9660
.
Iso9660IsoRead
(
self
.
iso_path
)
def
test_basic_workflow
(
self
):
"""Call the basic workflow"""
self
.
basic_workflow
()
def
test_mnt_dir
(
self
):
"""Use the mnt_dir property"""
self
.
mnt_dir_workflow
()
class
IsoMount
(
BaseIso9660
,
unittest
.
TestCase
):
class
IsoMount
(
BaseIso9660
):
"""
"""
Mount-based check
Mount-based check
...
@@ -154,16 +132,8 @@ class IsoMount(BaseIso9660):
...
@@ -154,16 +132,8 @@ class IsoMount(BaseIso9660):
super
(
IsoMount
,
self
).
setUp
()
super
(
IsoMount
,
self
).
setUp
()
self
.
iso
=
iso9660
.
Iso9660Mount
(
self
.
iso_path
)
self
.
iso
=
iso9660
.
Iso9660Mount
(
self
.
iso_path
)
def
test_basic_workflow
(
self
):
"""Call the basic workflow"""
self
.
basic_workflow
()
def
test_mnt_dir
(
self
):
"""Use the mnt_dir property"""
self
.
mnt_dir_workflow
()
class
PyCDLib
(
BaseIso9660
):
class
PyCDLib
(
BaseIso9660
,
unittest
.
TestCase
):
"""
"""
PyCDLib-based check
PyCDLib-based check
...
@@ -174,10 +144,6 @@ class PyCDLib(BaseIso9660):
...
@@ -174,10 +144,6 @@ class PyCDLib(BaseIso9660):
super
(
PyCDLib
,
self
).
setUp
()
super
(
PyCDLib
,
self
).
setUp
()
self
.
iso
=
iso9660
.
ISO9660PyCDLib
(
self
.
iso_path
)
self
.
iso
=
iso9660
.
ISO9660PyCDLib
(
self
.
iso_path
)
def
test_basic_workflow
(
self
):
"""Call the basic workflow"""
self
.
basic_workflow
()
def
test_create_write
(
self
):
def
test_create_write
(
self
):
new_iso_path
=
os
.
path
.
join
(
self
.
tmpdir
,
'new.iso'
)
new_iso_path
=
os
.
path
.
join
(
self
.
tmpdir
,
'new.iso'
)
new_iso
=
iso9660
.
ISO9660PyCDLib
(
new_iso_path
)
new_iso
=
iso9660
.
ISO9660PyCDLib
(
new_iso_path
)
...
@@ -190,10 +156,6 @@ class PyCDLib(BaseIso9660):
...
@@ -190,10 +156,6 @@ class PyCDLib(BaseIso9660):
self
.
assertEqual
(
read_iso
.
read
(
path
),
content
)
self
.
assertEqual
(
read_iso
.
read
(
path
),
content
)
self
.
assertTrue
(
os
.
path
.
isfile
(
new_iso_path
))
self
.
assertTrue
(
os
.
path
.
isfile
(
new_iso_path
))
def
test_mnt_dir
(
self
):
"""Use the mnt_dir property"""
self
.
mnt_dir_workflow
()
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
unittest
.
main
()
unittest
.
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录