Checkup application files in the src dir after tests (closes: #1765)
This commit is contained in:
parent
b1a0a54d56
commit
1219358c38
|
@ -22,6 +22,15 @@ def cleanup(home=None, files=_files):
|
||||||
pass
|
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():
|
def skip_python3():
|
||||||
"""Raise unittest.SkipTest() if detected python3"""
|
"""Raise unittest.SkipTest() if detected python3"""
|
||||||
if sys.hexversion >= 0x3000000:
|
if sys.hexversion >= 0x3000000:
|
||||||
|
|
16
tests.py
16
tests.py
|
@ -18,5 +18,17 @@ def unittest_discover():
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
result = unittest.TextTestRunner(verbosity=2).run(unittest_discover())
|
success = unittest.TextTestRunner(verbosity=2).run(
|
||||||
sys.exit(not result.wasSuccessful())
|
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)
|
||||||
|
|
Reference in New Issue
Block a user