Skip to content

Commit c5ff889

Browse files
tweak to apese deepsource padantics. Less than ideal.
1 parent defb45e commit c5ff889

File tree

3 files changed

+35
-5
lines changed

3 files changed

+35
-5
lines changed

tests/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Python Repo Template
44
# ..................................
5-
# Copyright (c) 2017-2019, Kendrick Walls
5+
# Copyright (c) 2017-2022, Kendrick Walls
66
# ..................................
77
# Licensed under MIT (the "License");
88
# you may not use this file except in compliance with the License.
@@ -16,6 +16,12 @@
1616
# See the License for the specific language governing permissions and
1717
# limitations under the License.
1818

19+
"""Python Repo Testing Module."""
20+
21+
__module__ = """tests"""
22+
"""This is pythonrepo testing module Template."""
23+
24+
1925
try:
2026
try:
2127
import sys
@@ -30,6 +36,9 @@
3036
ImportErr = None
3137
del ImportErr
3238
raise ImportError(str("Test module failed completely."))
39+
from tests import context as context
40+
if context.__name__ is None:
41+
raise ImportError(str("Test module failed to import even the context framework."))
3342
from tests import profiling as profiling
3443
if profiling.__name__ is None:
3544
raise ImportError(str("Test module failed to import even the profiling framework."))

tests/context.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Python Repo Template
44
# ..................................
5-
# Copyright (c) 2017-2019, Kendrick Walls
5+
# Copyright (c) 2017-2022, Kendrick Walls
66
# ..................................
77
# Licensed under MIT (the "License");
88
# you may not use this file except in compliance with the License.
@@ -17,6 +17,10 @@
1717
# limitations under the License.
1818

1919

20+
__module__ = """tests.context"""
21+
"""This is pythonrepo testing module Template."""
22+
23+
2024
try:
2125
import sys
2226
import os

tests/profiling.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
# NO ASSOCIATION
3030

3131

32+
__module__ = """tests.profiling"""
33+
"""This is pythonrepo testing module Template."""
34+
35+
3236
try:
3337
import sys
3438
if sys.__name__ is None: # pragma: no branch
@@ -54,6 +58,19 @@
5458
raise baton
5559

5660

61+
try:
62+
if 'functools' not in sys.modules:
63+
import functools
64+
else: # pragma: no branch
65+
functools = sys.modules["""functools"""]
66+
except Exception as badErr: # pragma: no branch
67+
baton = ImportError(badErr, str("[CWE-758] Test module failed completely."))
68+
baton.module = __module__
69+
baton.path = __file__
70+
baton.__cause__ = badErr
71+
raise baton
72+
73+
5774
try:
5875
import time
5976
if time.__name__ is None: # pragma: no branch
@@ -150,8 +167,6 @@ def do_time_profile(func, timer_name="time_profile"):
150167
>>>
151168
152169
"""
153-
import functools
154-
155170
@functools.wraps(func)
156171
def timer_profile_func(*args, **kwargs):
157172
"""Wraps a function in timewith() function."""
@@ -196,7 +211,9 @@ def do_cprofile(func):
196211
197212
198213
"""
214+
@functools.wraps(func)
199215
def profiled_func(*args, **kwargs):
216+
"""Wraps a function in profile.enable/disable() functions."""
200217
profile = cProfile.Profile()
201218
try:
202219
profile.enable()
@@ -242,7 +259,7 @@ def nothing(*args, **kwargs):
242259
return inner
243260

244261

245-
def main(argv=None): # pragma: no cover
262+
def main(*argv): # pragma: no cover
246263
"""The Main Event makes no sense to profiling."""
247264
raise NotImplementedError("CRITICAL - test profiling main() not implemented. yet?")
248265

0 commit comments

Comments
 (0)