Skip to content

Test.setScanForTestClasses(false) causes all junit4 tests to be skipped #36508

@dweiss

Description

@dweiss

Current Behavior

Trying to upgrade to gradle 9.3.0 in Apache Lucene -
apache/lucene#15623

everything works except tests. We discover tests manually:

              task.setScanForTestClasses(false);
              task.include("**/Test*.class");
              task.exclude("**/*$*");

but this no longer works - it results in zero tests being discovered:

Execution failed for task ':lucene:core:test'.
> There are test sources present and no filters are applied, but the test task did not discover any tests to execute. This is likely due to a misconfiguration. Please check your test configuration. If this is not a misconfiguration, this error can be disabled by setting the 'failOnNoDiscoveredTests' property to false.

Seems like a regression in 9.3.0?

Expected Behavior

setScanForTestClasses should still work?

Context (optional)

No response

Self-contained Reproducer Project

apache/lucene#15623

Clone the branch, then try to run ./gradlew -p lucene/core test

Gradle version

9.3.0

Build scan URL (optional)

No response

Your Environment (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions