Exemplo n.º 1
0
    def close_file(self, file_):
        """
        Close and check the file
        """
        file_.seek(0)
        case = ByteStreamToStreamResult(file_)
        result = StreamToDict(self.handle_dict)
        result.startTestRun()
        case.run(result)
        result.stopTestRun()

        file_.close()
Exemplo n.º 2
0
    def get_test_ids(self, run_id):
        """Return the test ids from the specified run.

        :param run_id: the id of the test run to query.
        :return: a list of test ids for the tests that
            were part of the specified test run.
        """
        run = self.get_test_run(run_id)
        ids = []
        def gather(test_dict):
            ids.append(test_dict['id'])
        result = StreamToDict(gather)
        result.startTestRun()
        try:
            run.get_test().run(result)
        finally:
            result.stopTestRun()
        return ids
Exemplo n.º 3
0
def main():
    os.environ["PYTHON_API_KEY"] = api_key

    test_suites = _collect_test_suites()
    main_test_suite = TestSuite()

    for test_suite in test_suites:
        main_test_suite.addTests(test_suite)

    concurrent_suite = ConcurrentStreamTestSuite(lambda: ((case, None) for case in main_test_suite))

    result = StreamToDict(callback)
    result.startTestRun()
    try:
        concurrent_suite.run(result)
    finally:
        result.stopTestRun()

    all = SUCCESS + FAILS
    print("All: " + str(all) + " SUCCESS: " + str(SUCCESS) + " FAILS: " + str(FAILS))

    if 'FAILED' in globals() and FAILED:
        sys.exit(1)