mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
python unittest find subdirs
This commit is contained in:
@@ -20903,6 +20903,15 @@ Examples:
|
||||
** 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
|
||||
|
||||
===== 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
|
||||
|
||||
Buildroot has a Python package that can be added to the guest image:
|
||||
|
||||
1
rootfs_overlay/lkmc/python/unittest_find/README.adoc
Normal file
1
rootfs_overlay/lkmc/python/unittest_find/README.adoc
Normal file
@@ -0,0 +1 @@
|
||||
https://cirosantilli.com/linux-kernel-module-cheat#python-unittest
|
||||
8
rootfs_overlay/lkmc/python/unittest_find/mydir/myfile.py
Normal file
8
rootfs_overlay/lkmc/python/unittest_find/mydir/myfile.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import unittest
|
||||
|
||||
class SomeTest(unittest.TestCase):
|
||||
def test_atest(self):
|
||||
"""
|
||||
this test passes
|
||||
"""
|
||||
self.assertEqual(1, 2)
|
||||
@@ -0,0 +1,8 @@
|
||||
import unittest
|
||||
|
||||
class SomeTest(unittest.TestCase):
|
||||
def test_atest(self):
|
||||
"""
|
||||
this test passes
|
||||
"""
|
||||
self.assertEqual(1, 2)
|
||||
@@ -0,0 +1,8 @@
|
||||
import unittest
|
||||
|
||||
class SomeTest(unittest.TestCase):
|
||||
def test_atest(self):
|
||||
"""
|
||||
this test passes
|
||||
"""
|
||||
self.assertEqual(1, 2)
|
||||
8
rootfs_overlay/lkmc/python/unittest_find/myfile.py
Normal file
8
rootfs_overlay/lkmc/python/unittest_find/myfile.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import unittest
|
||||
|
||||
class SomeTest(unittest.TestCase):
|
||||
def test_atest(self):
|
||||
"""
|
||||
this test passes
|
||||
"""
|
||||
self.assertEqual(1, 2)
|
||||
8
rootfs_overlay/lkmc/python/unittest_find/myfile2.py
Normal file
8
rootfs_overlay/lkmc/python/unittest_find/myfile2.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import unittest
|
||||
|
||||
class SomeTest(unittest.TestCase):
|
||||
def test_atest(self):
|
||||
"""
|
||||
this test passes
|
||||
"""
|
||||
self.assertEqual(1, 2)
|
||||
8
rootfs_overlay/lkmc/python/unittest_find/test/myfile.py
Normal file
8
rootfs_overlay/lkmc/python/unittest_find/test/myfile.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import unittest
|
||||
|
||||
class SomeTest(unittest.TestCase):
|
||||
def test_atest(self):
|
||||
"""
|
||||
this test passes
|
||||
"""
|
||||
self.assertEqual(1, 2)
|
||||
@@ -0,0 +1,8 @@
|
||||
import unittest
|
||||
|
||||
class SomeTest(unittest.TestCase):
|
||||
def test_atest(self):
|
||||
"""
|
||||
this test passes
|
||||
"""
|
||||
self.assertEqual(1, 2)
|
||||
Reference in New Issue
Block a user