python unittest find subdirs

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2020-10-16 01:00:00 +00:00
parent af92b11f82
commit 27fc5deefe
12 changed files with 66 additions and 0 deletions

View File

@@ -20903,6 +20903,15 @@ Examples:
** link:rootfs_overlay/lkmc/python/count.py[]: count once every second ** link:rootfs_overlay/lkmc/python/count.py[]: count once every second
** link:rootfs_overlay/lkmc/python/iter_method.py[]: how to implement `__iter__` on a class ** link:rootfs_overlay/lkmc/python/iter_method.py[]: how to implement `__iter__` on a class
===== Python standard library
====== Python unittest
link:rootfs_overlay/lkmc/python/unittest_find/[] contains examples to test how tests are found by `unittest` within directories. Related questions:
* https://stackoverflow.com/questions/1732438/how-do-i-run-all-python-unit-tests-in-a-directory
* https://stackoverflow.com/questions/46976256/recursive-unittest-discovery-with-python3-and-without-init-py-files
===== Build and install the interpreter ===== Build and install the interpreter
Buildroot has a Python package that can be added to the guest image: Buildroot has a Python package that can be added to the guest image:

View File

@@ -0,0 +1 @@
https://cirosantilli.com/linux-kernel-module-cheat#python-unittest

View File

@@ -0,0 +1,8 @@
import unittest
class SomeTest(unittest.TestCase):
def test_atest(self):
"""
this test passes
"""
self.assertEqual(1, 2)

View File

@@ -0,0 +1,8 @@
import unittest
class SomeTest(unittest.TestCase):
def test_atest(self):
"""
this test passes
"""
self.assertEqual(1, 2)

View File

@@ -0,0 +1,8 @@
import unittest
class SomeTest(unittest.TestCase):
def test_atest(self):
"""
this test passes
"""
self.assertEqual(1, 2)

View File

@@ -0,0 +1,8 @@
import unittest
class SomeTest(unittest.TestCase):
def test_atest(self):
"""
this test passes
"""
self.assertEqual(1, 2)

View File

@@ -0,0 +1,8 @@
import unittest
class SomeTest(unittest.TestCase):
def test_atest(self):
"""
this test passes
"""
self.assertEqual(1, 2)

View File

@@ -0,0 +1,8 @@
import unittest
class SomeTest(unittest.TestCase):
def test_atest(self):
"""
this test passes
"""
self.assertEqual(1, 2)

View File

@@ -0,0 +1,8 @@
import unittest
class SomeTest(unittest.TestCase):
def test_atest(self):
"""
this test passes
"""
self.assertEqual(1, 2)