Runs the test cwd -- the current directory to be set testRunner -- test runner to be used `pytest` or `nose` args -- arguments passed into the test runner
(cwd, testRunner, args)
| 17 | |
| 18 | |
| 19 | def run(cwd, testRunner, args): |
| 20 | """Runs the test |
| 21 | cwd -- the current directory to be set |
| 22 | testRunner -- test runner to be used `pytest` or `nose` |
| 23 | args -- arguments passed into the test runner |
| 24 | """ |
| 25 | |
| 26 | sys.path[0] = os.getcwd() |
| 27 | os.chdir(cwd) |
| 28 | |
| 29 | try: |
| 30 | if testRunner == "pytest": |
| 31 | import pytest |
| 32 | |
| 33 | pytest.main(args) |
| 34 | else: |
| 35 | import nose |
| 36 | |
| 37 | nose.run(argv=args) |
| 38 | sys.exit(0) |
| 39 | finally: |
| 40 | pass |
| 41 | |
| 42 | |
| 43 | if __name__ == "__main__": |