From 1219358c38db6d8b28a9222a2145f74902763832 Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Thu, 27 May 2021 15:30:17 +0300 Subject: [PATCH] Checkup application files in the src dir after tests (closes: #1765) --- src/tests/common.py | 9 +++++++++ tests.py | 16 ++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/tests/common.py b/src/tests/common.py index e87765a4..2d60c716 100644 --- a/src/tests/common.py +++ b/src/tests/common.py @@ -22,6 +22,15 @@ def cleanup(home=None, files=_files): pass +def checkup(): + """Checkup files in the src dir""" + src_dir = os.path.abspath( + os.path.join(os.path.dirname(__file__), os.pardir)) + for f in _files: + if os.path.isfile(os.path.join(src_dir, f)): + return 'Found application file %s in src dir' % f + + def skip_python3(): """Raise unittest.SkipTest() if detected python3""" if sys.hexversion >= 0x3000000: diff --git a/tests.py b/tests.py index f0c82f77..0e88ba63 100644 --- a/tests.py +++ b/tests.py @@ -18,5 +18,17 @@ def unittest_discover(): if __name__ == "__main__": - result = unittest.TextTestRunner(verbosity=2).run(unittest_discover()) - sys.exit(not result.wasSuccessful()) + success = unittest.TextTestRunner(verbosity=2).run( + unittest_discover()).wasSuccessful() + try: + from src.tests import common + except ImportError: + checkup = False + print('ImportError from src.tests') + else: + checkup = common.checkup() + + if checkup and not success: + print(checkup) + + sys.exit(not success or checkup)