def register_options(cls, register): super(JUnitRun, cls).register_options(register) register('--batch-size', advanced=True, type=int, default=cls._BATCH_ALL, fingerprint=True, help='Run at most this many tests in a single test process.') register('--test', type=list, fingerprint=True, help='Force running of just these tests. Tests can be specified using any of: ' '[classname], [classname]#[methodname], [filename] or [filename]#[methodname]') register('--per-test-timer', type=bool, help='Show progress and timer for each test.') register('--default-concurrency', advanced=True, fingerprint=True, choices=JUnitTests.VALID_CONCURRENCY_OPTS, default=JUnitTests.CONCURRENCY_SERIAL, help='Set the default concurrency mode for running tests not annotated with' ' @TestParallel or @TestSerial.') register('--parallel-threads', advanced=True, type=int, default=0, fingerprint=True, help='Number of threads to run tests in parallel. 0 for autoset.') register('--test-shard', advanced=True, fingerprint=True, help='Subset of tests to run, in the form M/N, 0 <= M < N. ' 'For example, 1/3 means run tests number 2, 5, 8, 11, ...') register('--output-mode', choices=['ALL', 'FAILURE_ONLY', 'NONE'], default='NONE', help='Specify what part of output should be passed to stdout. ' 'In case of FAILURE_ONLY and parallel tests execution ' 'output can be partial or even wrong. ' 'All tests output also redirected to files in .pants.d/test/junit.') register('--cwd', advanced=True, fingerprint=True, help='Set the working directory. If no argument is passed, use the build root. ' 'If cwd is set on a target, it will supersede this option. It is an error to ' 'use this option in combination with `--chroot`') register('--strict-jvm-version', type=bool, advanced=True, fingerprint=True, help='If true, will strictly require running junits with the same version of java as ' 'the platform -target level. Otherwise, the platform -target level will be ' 'treated as the minimum jvm to run.') register('--failure-summary', type=bool, default=True, help='If true, includes a summary of which test-cases failed at the end of a failed ' 'junit run.') register('--allow-empty-sources', type=bool, advanced=True, fingerprint=True, help='Allows a junit_tests() target to be defined with no sources. Otherwise,' 'such a target will raise an error during the test run.') register('--use-experimental-runner', type=bool, advanced=True, fingerprint=True, help='Use experimental junit-runner logic for more options for parallelism.') register('--html-report', type=bool, fingerprint=True, help='If true, generate an html summary report of tests that were run.') register('--open', type=bool, help='Attempt to open the html summary report in a browser (implies --html-report)') register('--legacy-report-layout', type=bool, default=False, advanced=True, help='Used to link JUnit and coverage reports to the legacy location; now does ' 'nothing.', removal_version='1.8.0.dev0', removal_hint='This option is no longer used and can be safely removed.') # TODO(jtrobec): Remove direct register when coverage steps are moved to their own subsystem. CodeCoverage.register_junit_options(register, cls.register_jvm_tool)
def register_options(cls, register): super().register_options(register) register( "--batch-size", advanced=True, type=int, default=cls._BATCH_ALL, fingerprint=True, help="Run at most this many tests in a single test process.", ) register( "--test", type=list, fingerprint=True, help="Force running of just these tests. Tests can be specified using any of: " "[classname], [classname]#[methodname], [fully qualified classname], " "[fully qualified classname]#[methodname]. If classname is not fully qualified, " "all matching tests will be run. For example, if `foo.bar.TestClass` and " "`foo.baz.TestClass` exist and `TestClass` is supplied, then both will run.", ) register("--per-test-timer", type=bool, help="Show progress and timer for each test.") register( "--default-concurrency", advanced=True, fingerprint=True, choices=JUnitTests.VALID_CONCURRENCY_OPTS, default=JUnitTests.CONCURRENCY_SERIAL, help="Set the default concurrency mode for running tests not annotated with" " @TestParallel or @TestSerial.", ) register( "--parallel-threads", advanced=True, type=int, default=0, fingerprint=True, help="Number of threads to run tests in parallel. 0 for autoset.", ) register( "--test-shard", advanced=True, fingerprint=True, help="Subset of tests to run, in the form M/N, 0 <= M < N. " "For example, 1/3 means run tests number 2, 5, 8, 11, ...", ) register( "--output-mode", choices=["ALL", "FAILURE_ONLY", "NONE"], default="NONE", help="Specify what part of output should be passed to stdout. " "In case of FAILURE_ONLY and parallel tests execution " "output can be partial or even wrong. " "All tests output also redirected to files in .pants.d/test/junit.", ) register( "--cwd", advanced=True, fingerprint=True, help="Set the working directory. If no argument is passed, use the build root. " "If cwd is set on a target, it will supersede this option. It is an error to " "use this option in combination with `--chroot`", ) register( "--strict-jvm-version", type=bool, advanced=True, fingerprint=True, help="If true, will strictly require running junits with the same version of java as " "the platform -target level. Otherwise, the platform -target level will be " "treated as the minimum jvm to run.", ) register( "--failure-summary", type=bool, default=True, help="If true, includes a summary of which test-cases failed at the end of a failed " "junit run.", ) register( "--allow-empty-sources", type=bool, advanced=True, fingerprint=True, help="Allows a junit_tests() target to be defined with no sources. Otherwise," "such a target will raise an error during the test run.", ) register( "--use-experimental-runner", type=bool, advanced=True, fingerprint=True, help="Use experimental junit-runner logic for more options for parallelism.", ) register( "--html-report", type=bool, fingerprint=True, help="If true, generate an html summary report of tests that were run.", ) register( "--html-report-error-on-conflict", type=bool, default=True, help="If true, error when duplicate test cases are found in html results", ) register( "--open", type=bool, help="Attempt to open the html summary report in a browser (implies --html-report)", ) # TODO(jtrobec): Remove direct register when coverage steps are moved to their own subsystem. CodeCoverage.register_junit_options(register, cls.register_jvm_tool)