示例#1
0
def main():
    parser = argparse.ArgumentParser()

    group = parser.add_mutually_exclusive_group(required=True)

    group.add_argument('-f',
                       '--file',
                       metavar='test_file',
                       nargs=1,
                       help='test file',
                       required=False)

    group.add_argument('-d',
                       '--directory',
                       metavar='test_directory',
                       nargs=1,
                       help='directory of test files')

    args = parser.parse_args()
    user_input = args.directory[0] if args.directory else args.file[0]

    integration_config.load_integrations(user_input)

    threader.launch_threads(
        threader.build_threads(
            registrar.register(loader.load_test_files(user_input))))
示例#2
0
文件: core.py 项目: Pysellus/pysellus
def main():
    parser = argparse.ArgumentParser()

    group = parser.add_mutually_exclusive_group(required=True)

    group.add_argument(
        '-f', '--file', metavar='test_file', nargs=1, help='test file', required=False
    )

    group.add_argument(
        '-d', '--directory', metavar='test_directory', nargs=1, help='directory of test files'
    )

    args = parser.parse_args()
    user_input = args.directory[0] if args.directory else args.file[0]

    integration_config.load_integrations(user_input)

    threader.launch_threads(
        threader.build_threads(
            registrar.register(loader.load_test_files(user_input))
        )
    )
示例#3
0
from pysellus import threader

with description('the threader module'):
    with it('should create as many threads as streams in the supplied dict'):
        a_stream = Mock()
        another_stream = Mock()

        a_tester = Spy().a_tester
        another_tester = Spy().another_tester

        stream_to_testers = {
            a_stream: [a_tester],
            another_stream: [a_tester, another_tester]
        }

        threads = threader.build_threads(stream_to_testers)

        expect(len(threads)).to(be(len(stream_to_testers)))

    with it('should initialize threads by calling the given target function'):
        a_stream = Mock()
        a_subject = Spy()
        target_function = Spy().target_function

        thread = threader._make_thread(target_function, a_stream, a_subject)

        thread.start()
        thread.join()

        expect(target_function).to(have_been_called.once)
示例#4
0
from pysellus import threader

with description('the threader module'):
    with it('should create as many threads as streams in the supplied dict'):
        a_stream = Mock()
        another_stream = Mock()

        a_tester = Spy().a_tester
        another_tester = Spy().another_tester

        stream_to_testers = {
            a_stream: [a_tester],
            another_stream: [a_tester, another_tester]
        }

        threads = threader.build_threads(stream_to_testers)

        expect(len(threads)).to(be(len(stream_to_testers)))

    with it('should initialize threads by calling the given target function'):
        a_stream = Mock()
        a_subject = Spy()
        target_function = Spy().target_function

        thread = threader._make_thread(target_function, a_stream, a_subject)

        thread.start()
        thread.join()

        expect(target_function).to(have_been_called.once)