-
Notifications
You must be signed in to change notification settings - Fork 263
Expand file tree
/
Copy pathtest_env_process.py
More file actions
37 lines (33 loc) · 1.26 KB
/
test_env_process.py
File metadata and controls
37 lines (33 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import re
import sys
if sys.version_info[:2] == (2, 6):
import unittest2 as unittest
else:
import unittest
from virttest.env_process import QEMU_VERSION_RE
class QEMUVersion(unittest.TestCase):
def test_regex(self):
versions_expected = {
"QEMU emulator version 2.9.0(qemu-kvm-rhev-2.9.0-16.el7_4.8)": (
"2.9.0",
"qemu-kvm-rhev-2.9.0-16.el7_4.8",
),
"QEMU emulator version 2.10.50 (v2.10.0-594-gf75637badd)": (
"2.10.50",
"v2.10.0-594-gf75637badd",
),
"QEMU emulator version 2.7.1(qemu-2.7.1-7.fc25), Copyright (c) "
"2003-2016 Fabrice Bellard and the QEMU Project developers": (
"2.7.1",
"qemu-2.7.1-7.fc25",
),
"QEMU PC emulator version 0.12.1 (qemu-kvm-0.12.1.2-2.503.el6_9.3),"
" Copyright (c) 2003-2008 Fabrice Bellard": (
"0.12.1",
"qemu-kvm-0.12.1.2-2.503.el6_9.3",
),
"QEMU emulator version 10.1.3": ("10.1.3", None),
}
for version, expected in list(versions_expected.items()):
match = re.match(QEMU_VERSION_RE, version)
self.assertEqual(match.groups(), expected)