1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-02 13:29:49 +00:00

oeqa/cases/oelib: Change default case class to unittest.case.TestCase

Some tests doesn't need call bitbake so it is better to use the
basic unittest case class.

[YOCTO #10828]

(From OE-Core rev: 4d01610f36eaee8da3126bb5045856279371fd17)

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Aníbal Limón
2017-06-08 11:32:06 -05:00
committed by Richard Purdie
parent 652df69b02
commit c3587b7d10
5 changed files with 13 additions and 13 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
from oeqa.selftest.case import OESelftestTestCase from unittest.case import TestCase
import oe.qa import oe.qa
class TestElf(OESelftestTestCase): class TestElf(TestCase):
def test_machine_name(self): def test_machine_name(self):
""" """
Test elf_machine_to_string() Test elf_machine_to_string()
@@ -1,4 +1,4 @@
from oeqa.selftest.case import OESelftestTestCase from unittest.case import TestCase
import oe.license import oe.license
class SeenVisitor(oe.license.LicenseVisitor): class SeenVisitor(oe.license.LicenseVisitor):
@@ -9,7 +9,7 @@ class SeenVisitor(oe.license.LicenseVisitor):
def visit_Str(self, node): def visit_Str(self, node):
self.seen.append(node.s) self.seen.append(node.s)
class TestSingleLicense(OESelftestTestCase): class TestSingleLicense(TestCase):
licenses = [ licenses = [
"GPLv2", "GPLv2",
"LGPL-2.0", "LGPL-2.0",
@@ -37,7 +37,7 @@ class TestSingleLicense(OESelftestTestCase):
self.parse(license) self.parse(license)
self.assertEqual(cm.exception.license, license) self.assertEqual(cm.exception.license, license)
class TestSimpleCombinations(OESelftestTestCase): class TestSimpleCombinations(TestCase):
tests = { tests = {
"FOO&BAR": ["FOO", "BAR"], "FOO&BAR": ["FOO", "BAR"],
"BAZ & MOO": ["BAZ", "MOO"], "BAZ & MOO": ["BAZ", "MOO"],
+2 -2
View File
@@ -1,11 +1,11 @@
from oeqa.selftest.case import OESelftestTestCase from unittest.case import TestCase
import oe, oe.path import oe, oe.path
import tempfile import tempfile
import os import os
import errno import errno
import shutil import shutil
class TestRealPath(OESelftestTestCase): class TestRealPath(TestCase):
DIRS = [ "a", "b", "etc", "sbin", "usr", "usr/bin", "usr/binX", "usr/sbin", "usr/include", "usr/include/gdbm" ] DIRS = [ "a", "b", "etc", "sbin", "usr", "usr/bin", "usr/binX", "usr/sbin", "usr/include", "usr/include/gdbm" ]
FILES = [ "etc/passwd", "b/file" ] FILES = [ "etc/passwd", "b/file" ]
LINKS = [ LINKS = [
+3 -3
View File
@@ -1,7 +1,7 @@
from oeqa.selftest.case import OESelftestTestCase from unittest.case import TestCase
from oe.maketype import create from oe.maketype import create
class TestBooleanType(OESelftestTestCase): class TestBooleanType(TestCase):
def test_invalid(self): def test_invalid(self):
self.assertRaises(ValueError, create, '', 'boolean') self.assertRaises(ValueError, create, '', 'boolean')
self.assertRaises(ValueError, create, 'foo', 'boolean') self.assertRaises(ValueError, create, 'foo', 'boolean')
@@ -31,7 +31,7 @@ class TestBooleanType(OESelftestTestCase):
self.assertEqual(create('y', 'boolean'), True) self.assertEqual(create('y', 'boolean'), True)
self.assertNotEqual(create('y', 'boolean'), False) self.assertNotEqual(create('y', 'boolean'), False)
class TestList(OESelftestTestCase): class TestList(TestCase):
def assertListEqual(self, value, valid, sep=None): def assertListEqual(self, value, valid, sep=None):
obj = create(value, 'list', separator=sep) obj = create(value, 'list', separator=sep)
self.assertEqual(obj, valid) self.assertEqual(obj, valid)
+3 -3
View File
@@ -1,7 +1,7 @@
from oeqa.selftest.case import OESelftestTestCase from unittest.case import TestCase
from oe.utils import packages_filter_out_system, trim_version from oe.utils import packages_filter_out_system, trim_version
class TestPackagesFilterOutSystem(OESelftestTestCase): class TestPackagesFilterOutSystem(TestCase):
def test_filter(self): def test_filter(self):
""" """
Test that oe.utils.packages_filter_out_system works. Test that oe.utils.packages_filter_out_system works.
@@ -31,7 +31,7 @@ class TestPackagesFilterOutSystem(OESelftestTestCase):
self.assertEqual(pkgs, ["foo-data"]) self.assertEqual(pkgs, ["foo-data"])
class TestTrimVersion(OESelftestTestCase): class TestTrimVersion(TestCase):
def test_version_exception(self): def test_version_exception(self):
with self.assertRaises(TypeError): with self.assertRaises(TypeError):
trim_version(None, 2) trim_version(None, 2)