summaryrefslogtreecommitdiff
path: root/tests/misc/sys_settrace_subdir/trace_generic.py
diff options
context:
space:
mode:
authorstijn <stijn@ignitron.net>2020-12-15 11:54:34 +0100
committerDamien George <damien@micropython.org>2020-12-18 13:56:45 +1100
commit108183fcc01f722d17e373f91f392a2a60ac787a (patch)
tree33110db9ce8892bd3403de2a3dd4b7b61a1e789a /tests/misc/sys_settrace_subdir/trace_generic.py
parent505a1853b9490246fbb95850ad8dae6d1b49d002 (diff)
tests/misc/sys_settrace: Make test output independent of invoked path.
The original logic of reducing a full path to a relative one assumes "tests/misc" is in the filename which is limited in usage: it never works for CPython on Windows since that will use a backslash as path separator, and also won't work when the filename is a path not relative to the tests directory which happens for example in the common case of running "./run-tests -d misc". Fix all cases by printing only the bare filename, which requires them all to start with sys_settrace_ hence the renaming.
Diffstat (limited to 'tests/misc/sys_settrace_subdir/trace_generic.py')
-rw-r--r--tests/misc/sys_settrace_subdir/trace_generic.py92
1 files changed, 0 insertions, 92 deletions
diff --git a/tests/misc/sys_settrace_subdir/trace_generic.py b/tests/misc/sys_settrace_subdir/trace_generic.py
deleted file mode 100644
index 111a9d19f..000000000
--- a/tests/misc/sys_settrace_subdir/trace_generic.py
+++ /dev/null
@@ -1,92 +0,0 @@
-print("Now comes the language constructions tests.")
-
-# function
-def test_func():
- def test_sub_func():
- print("test_function")
-
- test_sub_func()
-
-
-# closure
-def test_closure(msg):
- def make_closure():
- print(msg)
-
- return make_closure
-
-
-# exception
-def test_exception():
- try:
- raise Exception("test_exception")
-
- except Exception:
- pass
-
- finally:
- pass
-
-
-# listcomp
-def test_listcomp():
- print("test_listcomp", [x for x in range(3)])
-
-
-# lambda
-def test_lambda():
- func_obj_1 = lambda a, b: a + b
- print(func_obj_1(10, 20))
-
-
-# import
-def test_import():
- from sys_settrace_subdir import trace_importme
-
- trace_importme.dummy()
- trace_importme.saysomething()
-
-
-# class
-class TLClass:
- def method():
- pass
-
- pass
-
-
-def test_class():
- class TestClass:
- __anynum = -9
-
- def method(self):
- print("test_class_method")
- self.__anynum += 1
-
- def prprty_getter(self):
- return self.__anynum
-
- def prprty_setter(self, what):
- self.__anynum = what
-
- prprty = property(prprty_getter, prprty_setter)
-
- cls = TestClass()
- cls.method()
- print("test_class_property", cls.prprty)
- cls.prprty = 12
- print("test_class_property", cls.prprty)
-
-
-def run_tests():
- test_func()
- test_closure_inst = test_closure("test_closure")
- test_closure_inst()
- test_exception()
- test_listcomp()
- test_lambda()
- test_class()
- test_import()
-
-
-print("And it's done!")