kopia lustrzana https://github.com/micropython/micropython-lib
unittest: Add test for environment isolation.
rodzic
a7b2f63117
commit
cb8d108ac1
|
@ -1,4 +1,5 @@
|
|||
import unittest
|
||||
from test_unittest_isolated import global_context
|
||||
|
||||
|
||||
class TestUnittestAssertions(unittest.TestCase):
|
||||
|
@ -142,6 +143,11 @@ class TestUnittestAssertions(unittest.TestCase):
|
|||
else:
|
||||
self.fail("Unexpected success was not detected")
|
||||
|
||||
def test_NotChangedByOtherTest(self):
|
||||
global global_context
|
||||
assert global_context is None
|
||||
global_context = True
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
import unittest
|
||||
|
||||
|
||||
global_context = None
|
||||
|
||||
|
||||
class TestUnittestIsolated(unittest.TestCase):
|
||||
def test_NotChangedByOtherTest(self):
|
||||
global global_context
|
||||
assert global_context is None
|
||||
global_context = True
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
Ładowanie…
Reference in New Issue