Skip to content
Snippets Groups Projects
Commit 5d01c8d9 authored by tuhe's avatar tuhe
Browse files

Updated how the hidden tests are found

parent 674c90a8
No related branches found
No related tags found
No related merge requests found
...@@ -258,10 +258,26 @@ def methodsWithDecorator(cls, decorator): ...@@ -258,10 +258,26 @@ def methodsWithDecorator(cls, decorator):
print(inspect.getsourcelines(f) ) # How to get all hidden questions. print(inspect.getsourcelines(f) ) # How to get all hidden questions.
""" """
for maybeDecorated in cls.__dict__.values(): for maybeDecorated in cls.__dict__.values():
if hasattr(maybeDecorated, 'decorator'): from types import FunctionType
if maybeDecorated.decorator == decorator:
print(maybeDecorated) def extract_wrapped(decorated):
yield maybeDecorated if decorated.__closure__ is None:
return decorated
closure = (c.cell_contents for c in decorated.__closure__)
return next((c for c in closure if isinstance(c, FunctionType)), None)
import inspect
if inspect.isfunction(maybeDecorated):
# elif not isinstance(maybeDecorated, func):
f = extract_wrapped(maybeDecorated)
source, position = inspect.getsourcelines(f)
for l in source:
if l.strip().startswith("@hide"):
yield f
# if hasattr(maybeDecorated, 'decorator'):
# if maybeDecorated.decorator == decorator:
# print(maybeDecorated)
# yield maybeDecorated
""" Methods responsible for turning a dictionary into a string that can be pickled or put into a json file. """ """ Methods responsible for turning a dictionary into a string that can be pickled or put into a json file. """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment