Files
vgstation13/tools/travis/run_tests.py
DamianX 191b694b95 Unit testing (#18329)
* Unit testing

* Fixes
2018-05-31 08:32:18 -03:00

31 lines
797 B
Python
Executable File

#!/usr/bin/env python3
import os
import distutils.spawn
import asyncio
import travis_utils
def main():
if os.environ.get("DM_UNIT_TESTS") != "1":
print("DM_UNIT_TESTS is not set, not running tests.")
return
dmb = os.environ.get("PROJECT_NAME") # The DMB file to run.
if not dmb:
print("No project name specified.")
exit(1)
dmb += ".dmb"
executable = "DreamDaemon"
dreamdaemon = distutils.spawn.find_executable(executable)
if not dreamdaemon:
print("Unable to find {}.".format(executable))
exit(1)
loop = travis_utils.get_platform_event_loop()
code = loop.run_until_complete(travis_utils.run_with_timeout_guards([dreamdaemon, dmb, "-close", "-trusted"]))
exit(code)
if __name__ == "__main__":
main()