Checkup application files in the src dir after tests (closes: #1765)

This commit is contained in:
Dmitri Bogomolov 2021-05-27 15:30:17 +03:00
parent b1a0a54d56
commit 1219358c38
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13
2 changed files with 23 additions and 2 deletions

View File

@ -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:

View File

@ -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)